Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  updating linux stick button mappings  (Read 1627 times)
0 Members and 1 Guest are viewing this topic.
Offline tctimmeh

Junior Newbie


Medals: 2



« Posted 2013-02-25 15:19:03 »

I'm having some trouble using jinput with my wireless xbox 360 gamepad on linux. I did some digging into the source and found a couple of problems.

  • The linux plugin NativeDefinitions file says that it's generated from /usr/include/linux/input.h, but hasn't changed in svn in 7 years. A quick comparison against my actual input.h from kernel 3.5.0 shows a lot of differences. Specifically, what's really tripping me up is that it's missing the button codes in the 0x200 range. My gamepad, for instance, is generating codes in this range for the d-pad.
  • Related to the previous point is that the LinuxNativeTypesMap is also out-of-date. For instance, there doesn't appear to be an entry for BTN_START, causing the "start" button on my gamepad to show up as an "unknown" button.
  • Finally, in LinuxNativeTyepsMap.getButtonID, the code is creating a Key.UNKNOWN object instead of a Button.UNKNOWN object when the native button id isn't recognized. I'm using jMonkeyEngine, which expects a joystick to only have buttons and axes, so even though jinput is reporting 5 "unknown" components, jME is throwing them away because they're keys. This might be something to fix in jME but I also believe that returning a key from getButtonID is a defect.

I'd love to get these problems fixed to support the linux gaming community (and my project Grin ). I'm looking for some help here to either have the library updated or, alternatively, get some assistance with building the project so I can fix it myself and submit a patch. Can anyone offer advice?
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2013-02-25 15:47:54 »

I'll take a look later, as long as it's a quick fix I should be able to get a new build out tonight.

Endolf

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #2 - Posted 2013-02-25 20:15:18 »

Hi

I've regenerated the natives file, see if that helps, or makes it worse Smiley

Endolf

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tctimmeh

Junior Newbie


Medals: 2



« Reply #3 - Posted 2013-02-26 06:09:31 »

That's awesome, thank you!

I was able to figure out how to build jinput from source. Using your new native definitions I added the other fixes I mentioned in my original post and everything works way better now. Here is the patch of what I did: http://pastebin.java-gaming.org/ea3436d3d4d

Out of curiosity, I also did some research into where those "trigger happy" button codes came from. Found this commit that describes the reasoning: https://github.com/torvalds/linux/commit/cf2f765f1896064e34c6f0f2ef896ff058dd5c06. Incidentally, as of october 2012, these codes have been moved from include/linux/input.h to include/uapi/linux/input.h. I'm not sure how you're generating that definitions file but you might trip on this sometime in the future.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #4 - Posted 2013-02-26 08:32:08 »

Awesome.

Thank you for the patch, I'll take a look at putting this in this today some time.

Endolf

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #5 - Posted 2013-03-09 13:28:23 »

Hi

Sorry for the delay.

Just been looking at applying your patch. All looks fine, you even fixed a bug for us Smiley

Should be in tonights build.

Thanks

Endolf

Offline gouessej
« Reply #6 - Posted 2013-04-23 11:09:05 »

It seems to affect the whole gamepad support under GNU Linux, doesn't it?

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (24 views)
2014-07-24 01:59:36

Riven (24 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (54 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!