I tried to use JInput with gamepad on Linux (kernel 2.4) with no success (and as I read it’s not yet really done, correct?). Everything here is set up properly and I can use the pad with Joystick Driver for Java (http://sourceforge.net/projects/javajoystick/). How are things? Is there any progress in this area (there are no changes in CVS for a few months)? Any expectations about where Linux plugin will work? Can someone with very limited C knowledge be of any help?
OK, now I’m not sure if Linux plugin is really unfinished as I saw two gamepad entries on the HCL for Linux marked as OK. So I add one more question: how to debug the pad (USB MediaTech MT160 Dual Shock) which doesn’t work with JInput? I know it’s working fine in all testing apps, cat /dev/input/js0 shows expected garbage and http://sourceforge.net/projects/javajoystick/ works fine so I think it’s JInput’s problem.
Great, answering myself
I made some progress, now when I run ControllerReadTest I get:
Scanning jar: linux.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/LinuxDevice$LinuxHat.class
Examining file : net/java/games/input/LinuxDevice$ButtonID.class
Examining file : net/java/games/input/LinuxDevice$1.class
Examining file : net/java/games/input/LinuxDevice.class
Examining file : net/java/games/input/LinuxAxis.class
Examining file : net/java/games/input/LinuxEnvironmentPlugin.class
Found candidate class: net/java/games/input/LinuxEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.LinuxEnvironmentPlugin
Examining file : net/java/games/input/LinuxKeyboard$KeyID.class
Examining file : net/java/games/input/LinuxKeyboard.class
Examining file : net/java/games/input/LinuxMouse$LinuxMouseBall.class
Examining file : net/java/games/input/LinuxMouse$LinuxMouseButtons.class
Examining file : net/java/games/input/LinuxMouse$LinuxMouseButton.class
Examining file : net/java/games/input/LinuxMouse.class
Examining file : net/java/games/input/LinuxNativeTypesMap.class
Examining file : net/java/games/input/NativeDefinitions.class
Initing event interface
Initing joystick interface
Trying to open /dev/input/js0
Opened /dev/input/js0, trying to get device name
Getting button and axes information for /dev/input/js0
Initialisation of /dev/input/js0 completed
Trying to open /dev/input/js1
Failed to open device /dev/input/js1
Trying to open /dev/input/js2
Failed to open device /dev/input/js2
Trying to open /dev/input/js3
Failed to open device /dev/input/js3
Getting the number of event devices
Getting 0 event devices
Getting the number of joystick devices
Getting 1 joystick devices
So the pad seems to be detected, yet it’s not showing itself on the getControllers() list… hm… ???
BTW, I don’t want to whine but having to put plugin exactly in controller/ directory :o is about to be the perfect unintuitive way of doing it. I managed to find its rationale which sounds good but then I think it has two serious problems as it is now:
- it should be clearly described in the bold big red flashing letters in the README
- JInput should issue an error, or at least a clear warning if it doesn’t find any plugins – error message should also contain information about controller/ directory
I think I’ll write a short beginner’s guide for linux users when/if I manage to do make JInput work
Well, I think I’m stuck here. With 0 event devices the joystick device isn’t going to be processed by loop at line 84 in file jinput.cpp – at least I think that’s where the problem is.
Any help will be very appreciated.
Ok, as this is a USB device it should work. You should get devices listed in /dev/input/ called event*, these should be read/write to the user running the app. I’ve never tried it on a 2.4 kerne though.
Endolf
Ahhh, mentioning the /dev/input/event* devices was key to success Changing their permissions fixed the problem.
I posted small patch which fixes Linux 2.4 problems, please see https://jinput.dev.java.net/issues/show_bug.cgi?id=31