JInput failing to detect joypads on linux.

As you know, LWJGL input is now a wrapper round JInput. Got this report recently:

http://lwjgl.org/forum/viewtopic.php?t=1237?

Is there some special setup required on a linux box to enable JInput to work? If so, is there a setup guide somewhere (wiki) ?

Kev

Any chance of getting some of the log messages that jinput under linux spews out? :slight_smile:

I suspect it has something to do with the fact that jinput looks under /dev/input for all the files, not /dev.

Each distro seems to layout /dev differently, just to confuse the issue.

I sence a patch to try reading /dev/input, then trying /dev for js devices if none are found in /dev/input.

I’d still like the logs to check :slight_smile:

Endolf

where are the logs kepts?

Thats up to javaws, it seems that there are a bunch of files in ~/.java/deployment/log under java 1.5

They are named nothing useful.

Endolf

The distro in question did indeed have the /dev/js - jinput checking both just seem to make sense… maybe even configurable?

Not to pile on the work - but would it possible to catch the case where /dev/whatever can’t be found and throw a bespoke exception (UnableToFindTheSoddingDeviceException ? ;)) so that users could detect it and display a sensible message “Please Move Your Devices around and break your distro”

Kev

Updates done but not yet tested for checking /dev after /dev/input

First attempt at freeing some of the memory from the init processes

No longer read the 0th element if no device files are found.

No exception yet for kev :slight_smile:

Endolf

Are these builds available somewhere?

You pointed at me via IM but they don’t seem to have natives in?

Kev

http://www.newdawnsoftware.com/resources/jinput/jinput_linux_2005_10_31.tgz

also linked on jinput.dev.java.net

HTH

Endolf

Hi

With the help of kappaOne the issue is known. I’m away this weekend, but I hope to look at it whilst away and commit changes monday.

Endolf

P.S.

Endolf, in case you are reading this over the weekend and have forgotten what the issue is, you are ignoring joysticks that don’t have an event device with them.

P.P.S. was that intentional due to some nastyness with joysticks???

P.P.P.S. Take your gamepad with you to test over the weekend

Hi

I think it’s done, I don’t have a net con from linux in the hotel, so it’ll have to wait till tonight for a build to be uploaded and tested.

Endolf

Webstart demo updated

new d/l here

Endolf

P.S. Expect it to sigsegv, if it does, please send me the whole output.

ok still failing to get the joypad detected properly but is moving a step closer to working, heres the latest output

native output

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
Copying joystick device 0 to jinput device list 0

jws output (btw this is with Typhoon game)

creating input stuff
OS name is: Linux
Linux plugin is supported
OS name is: Linux
Linux plugin is supported
Initing JInputLibrary
Shutdown thread created and run
OS name is: Linux
Linux plugin is supported
0 Controllers Found
Waiting on monitor
800 x 600 x 24 @60Hz

oh btw no need to worry about uploading natives everytime now, cos i found a easy way to get native output when using java webstart, if you just run the jnlp through a console, native output comes on the console window and java webstart output on the java console.

Hi all,

I was trying JInput on Linux and came across this thread when trying to resolve the same problem. I noticed that the joystick appears to be detected, but not until my program has exited. I’ve got test code and its output, which I’ve attached to this post.

It was run on a Slackware 10.2 system with JDK 1.5.0_04 and one joystick on /dev/input/js0. I hope it helps.

Hi

New webstart version and new build here.

Endolf

ok good news just tried JInput through JWS and it works

native code

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
Copying joystick device 0 to jinput device list 0
Gettign device name for jinput device 0.
jinput device 0 is 135050352
Gettign device name for jinput device 0, (SAITEK Tournament Pad)
Gettign number of absolute axes for jinput device 0 (3)
Gettign number of relative axes for jinput device 0 (0)
Gettign number of buttons for jinput device 0 (8)
Getting bus type for device 0
Getting supported buttons for jinput device 0
Getting suported relative axes for jinput device 0
Getting suported absolute axes for jinput device 0
Getting fuzz data for axis 0 on device 0
Getting absolute axes minimum value data for axis 0 on device 0
Getting absolute axes maximum value data for axis 0 on device 0
Getting fuzz data for axis 1 on device 0
Getting absolute axes minimum value data for axis 1 on device 0
Getting absolute axes maximum value data for axis 1 on device 0
Getting fuzz data for axis 2 on device 0
Getting absolute axes minimum value data for axis 2 on device 0
Getting absolute axes maximum value data for axis 2 on device 0
Getting supported buttons for jinput device 0
Getting FFEnabled status for device 0

java console output

OS name is: Linux
Linux plugin is supported
OS name is: Linux
Linux plugin is supported
Initing JInputLibrary
Shutdown thread created and run
Java working on device SAITEK Tournament Pad
Java code thinks FF is disabled for device SAITEK Tournament Pad
Linux plugin claims to have found 1 controllers
Component count = 11
Waiting on monitor

works great and detects all the buttons, however just one thing when i run the jws two windows pop up one with the title SAITEK Tournement Pad and another blank window with title Controller Read Test, is this normal?

good work on getting it up and running! :slight_smile:

Yes the 2 windows are normal from my experience. The test program creates 1 window for each device it detects and one window as the main parent window. So if you close the blank window it closes all the other ones and shutsdown the program.

Hi

Kev’s spot on, it does indeed open a window per device and the main one. If it detects a mouse it will open 3 for that device, one for the main mouse, one for the ball and one for the buttons.

If you feel brave enough, compile a kernel with the event interface enabled and you mouse, keyboard, joystick, and anything else plugged in will show up. If you have a USB scanner with 3 buttons for example, jinput will detect it and allow you to use the buttons in a game :slight_smile:

Endolf

Yes thats normal.

Just my quick and crappy programming on the demo :slight_smile:

The mainf rame is there so you can end the app by closing it.

Each controlelr then gets its own frame.

JK

The new build works perfectly for me as well. Thanks! ;D