Jinput status

Hi,
I am using jinput in my game, but I have serious problems with it. I am trying to detect and use joystick , but a have few problems. First thing, on linux (Ubuntu Breezy Badger) when I list controllers I got just one controller, which is funny, because I got Keyboard, Mouse and Joystick attached to computer. But the real problem is when I try to find out if this controller is Joystick I cant really do it because getIdentifier for this controller returns Unknown (on windows it returns STICK identifier). I found out that this is Joystick by the number of axis and buttons, but I think this is very bad way to detect it.

Second problems is with Axes. I can’t detect axis right on linux. Here is how I do it:

joystick.getComponent(Identifier.Axis.X)

and I get null. On windows it works OK, I get X Axis.

So , on linux, the only thing I can do is to assume that first axes returned is X, second is Y, and third is Z. I don’t feel comfortable with this, because I am not sure if axes are always returned in this order,(on windows I get Z axes first.). getname method returns “X Axes” for all axes !!!

Ok, now let’s switch to windows. On windows, Jinput returns Keyboard, Mouse and Joystick controller, and I can detect Jostick by Identifier, so far everything is OK. Axis are also detected by Identifier:

joystick.getComponent(Identifier.Axis.X)
joystick.getComponent(Identifier.Axis.Y)
joystick.getComponent(Identifier.Axis.Z)

and it works fine.

The only problem I have on windows are buttons. Once again I can not access desired button by Idenifier, because for every button method getIdentifier returns Unknown. So I must assume that buttons are return in right order form getComponents method of the controller.

With all this said above, I have serious doubts on using JInput at all. Are there some plans to fix this issues soon?

We’ve recently completed some major rework on JInput. Try out a beta from:

http://www.java-gaming.org/forums/index.php?topic=12843.0

The problem with linux and mice/keyboards is that of permissions, and can’t be solved by JInput alone. You’ll have to have read rights to /dev/input/event* if you want keyboards and mice to work.

  • elias

I am glad to here that this API isn’t dead.

I don’t really need mouse and keyboard support, I am handling them through java’s usual event listeners.

I will defenetly try new JInput.

Thanx!

Hi

JInput old and new come with a class for testing

net.java.games.input.test.ControllerTextTest should dump out large amounts of debug information. On the current release it includes loads of information from the native layer too which would be useful. I’ve not managed to get the new one running yet as I needed to rebuild some kernel modules to enable force feedback (I use Ubuntu too and they disable it by default so when I get kernel updates it over writes the module).

If you run the texttest and copy the output to here or post it on a webpage somewhere, i’ll take a look and see what I can find out.

Cheers

Endolf

You should have told me :slight_smile: I’ve comitted a fix that should ignore any problems with the rumbler detection.

  • elias

Hi

Everything works fine. It’s just that my kernel doesn’t have FF enabled, so I can’t run the FF tests :). I ran the linux build (which I had had to modify because ant always overrides my JAVA_HOME to point to the JRE so things like javah don’t work) and built the linux version, and ran the readtest and rumble test. It’s just that with no FF enabled in the kernel, it detected no rumblers, and I know I have one as I used it to write the FF code in the first place :).

Now i’m gonna have to go and do an svn update too :slight_smile:

Endolf

I guess the answer is somewhere in the forum, but I could not find it:

Why does jinput need extra read permissions for mouse/keyboard? Any other application can easily read them and I also think that lwjgl doesn’t need these permissions. For me it is no problem to fix some permissions, but people running our java Web Starts might not be able to do that.

Are there any plans to get around that somehow?

Steffen.

LWJGL has the advantage of being an X11 application, which means it can use X11’s mouse/keyboard objects. JInput uses the /dev/input/event* nodes. These nodes are not always created with read permissions to everyone by the distribution, so they need updating manually.

JInput was specifically designed to not require a windowing system to be present.

There is an AWT plugin, that will capture events through java awt. This will work on any platform where the AWT sub system is in play. You won’t get any joysticks this way, but you also will not need the /dev/input/event* nodes to even exist.

Endolf