I’m new to Jinput and want to know if it would be possible to read the 3DConnexions SpaceNavigator 6DOF USB input device in my jogl application.
Hi
The information I’ve managed to read suggests that the answer is no (it doesn’t seem to expose anything to directx). We don’t currently have a JInput plugin for it at the moment, but this could be solved ;D
I’m going to speak to them to see if that is correct. I’ll let you know.
HTH
Endolf
Thanks. I’ll wait for your reply.
John
Hi
I contacted them about 24 hours ago, and I’ve heard nothing back. Unless they get back to me, the best I can do is offer you advice if you decide to implement a JInput plugin yourself.
Sorry
Endolf
Advice is good. I can work with that. What do I do.
John
Hi
It depends on the importance of supporting the controller, the time requirements, and the financial status of the project that needs it. The quickest, but most expensive way is to make an offer to the community to purchase a controller for an experienced JInput dev to write a plugin to support it. It worked for the wintab plugin :). The slowest, but cheapest option, is for you to go it alone and try looking at the existing plugins to work out how to implement one for the device.
If you chose to do the implementation yourself, you can always ask questions here, and providing someone knows the answer, you should get a response within a few hours to a day (depending on time zone, unfortunately I am not allowed to post to forums from work, so it has to be when I am home).
HTH
Endolf
Looking at their developers guide it looks like it might show up under Mac and Linux and “just work” already. They do have a JNI wrapper to their SDK, which might you if you decide to do the plugin yourself.
HTH
Endolf
OK. I’l try it and see what happens. The project that needs it dosen’t have too much money but time is more precious.
I’ll be in touch.
John
OK. I downloaded the latest binaries http://www.newdawnsoftware.com/resources/jinput/jinput_combined_dist_latest.zip and http://www.newdawnsoftware.com/resources/jinput/jinput-tests-20060514.jar.
I unpacked them and ran:
java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerTextTest
It didn’t appear to pick up the SpaceNavigator. Just :
When I tried the java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerReadTest
it gave me a number of windows but none of them showed any reaction to my moving the SpaceNavigator.
Does that mean the device was not recognised by the available drivers.
John
[quote]Does that mean the device was not recognised by the available drivers.
[/quote]
Looks that way. The jinput-test.jar should be in the combined distribution zip. That looks like my fault, I’ll sort that :).
I was just going off the fact that it’s a standard HID device. is there an event device node in /dev/input/ for the device?, can you read it with evtest?, is it readable by the user running the jinput tests?, is is writable?
Cheers
Endolf
After plugging in the device I get the following output from dmesg
Looking at /dev/input I get
event6 wasn’t there before.
How do I check this?
John
Thats a good sign :), what are the file permissions on that dev node?
Depends on your distribution, under ubuntu, it’s part of dvb-utils (apt-get install dvb-utils), mandriva and opensuse seems to have an input-utils package
HTH
Endolf
crw------- 1 root root 13, 70 Jun 19 17:07 event6
I am running Fedora Core 6 and I don’t see any input-utils package in the yum repository
John
Are you running JInput as root?
if not, you won’t be able to read that node, and thats why JInput can’t do anything with that device, not even get the name. Best bet is to change the ownership. /etc/udev/rules.d/40-permissions.rules contains the udev rules for event[0-9] on ubuntu, and setting the group to plugdev, and adding my normal user to plugdev group means that I get the right permissions on reboot and whenever I plug in new devices.
Proof again that Linux is still a pain to work with. When it does work, it’s great, but it’s still beyond joe average. Maybe thats safer for the rest of us though ;p
HTH
Endolf
P.S. I got evtest from dvb-utils, maybe FC has that package.
Yes. I’m rnning it as root. I saw the problem with not having permission.
I’ll see if I can install the dvb-utils package and try evtest.
John
What kernel are you running, it appears that there might have been a regression bug in 2.6.16 that stopped the device working properly, but it’s fixed again in 2.6.20, apparently.
Not having one myself, I can’t test it though.
Endolf
Edit, just found this test application. If that works, jinput should, if it doesn’t, and evtest also doesn’t like the device, then it’s a system level thing, not JInput. Let us know how you go.
2.6.20-1.2952.fc6
Wicked!!.
spacenavi /dev/input/event6 found "3Dconnexion SpaceNavigator" on /dev/input/event6 Supported event types: Event type 0x00 (Sync?) Event type 0x01 (Keys or Buttons) Event type 0x02 (Relative Axes) Event type 0x11 (LEDs) detected leds: 8, State: 0 0 0 38 -47 1 - off off
and moving the control shows up in the six variables. OK. So now that we know that the OS recognises it, how do we get jinput to see it. I’m taking it that jinput is the best bet to access it across Linux, Mac and Windows?
John
Hmm
Well, it should at this point ‘just work’. It obviously isn’t though :).
Looks like I’m going to have to put together a zip with shed loads of debug in it so that we can diagnose the issue. I’m guessing that it might fail identifying the class of device or something, but with out one here, all I can do is dump every decision jinput makes and lets see how it goes. I’ll work on it tonight (it’s 6:16pm here now). I’ll post back when I’ve got something to try.
Reporting broken cases like this are invaluable to getting JInput working as it should. So thank you :).
And yes, although I might be bias, I think JInput is your best bet, although with that device, I think directx will be a limitation under windows (the drivers seem to provide their own API rather than using directx).
Endolf
Edit: Try this package.
Thank you.
OK, here goes.
`java -Djava.library.path=dist -cp dist/jinput.jar:dist/jinput-test.jar net.java.games.input.test.RumbleTest
Trying to open /dev/input/event6
Type guess from components: Mouse
Opened /dev/input/event6, found 3Dconnexion SpaceNavigator
Trying to open /dev/input/event4
Type guess from components: Keyboard
Opened /dev/input/event4, found Power Button (FF)
Trying to open /dev/input/event5
Type guess from components: Keyboard
Opened /dev/input/event5, found Sleep Button (CM)
Trying to open /dev/input/event3
Type guess from components: Unknown
Opened /dev/input/event3, found PC Speaker
No clue what type PC Speaker is, we guessed at Unknown
Trying to open /dev/input/event1
Type guess from components: Keyboard
Opened /dev/input/event1, found AT Translated Set 2 keyboard
Trying to open /dev/input/event2
Type guess from components: Mouse
Opened /dev/input/event2, found HID 1241:1177
Trying to open /dev/input/event0
Type guess from components: Mouse
Opened /dev/input/event0, found Macintosh mouse button emulation
Linux plugin claims to have found 5 controllers
Scanning Power Button (FF)
Found 0 rumblers
Scanning Sleep Button (CM)
Found 0 rumblers
Scanning AT Translated Set 2 keyboard
Found 0 rumblers
Scanning HID 1241:1177
Found 0 rumblers
Scanning Macintosh mouse button emulation
Found 0 rumblers
`
`java -Djava.library.path=dist -cp dist/jinput.jar:dist/jinput-test.jar net.java.games.input.test.ControllerTextTest
Controller Env = net.java.games.input.DefaultControllerEnvironment@ab95e6
Trying to open /dev/input/event6
Type guess from components: Mouse
Opened /dev/input/event6, found 3Dconnexion SpaceNavigator
Trying to open /dev/input/event4
Type guess from components: Keyboard
Opened /dev/input/event4, found Power Button (FF)
Trying to open /dev/input/event5
Type guess from components: Keyboard
Opened /dev/input/event5, found Sleep Button (CM)
Trying to open /dev/input/event3
Type guess from components: Unknown
Opened /dev/input/event3, found PC Speaker
No clue what type PC Speaker is, we guessed at Unknown
Trying to open /dev/input/event1
Type guess from components: Keyboard
Opened /dev/input/event1, found AT Translated Set 2 keyboard
Trying to open /dev/input/event2
Type guess from components: Mouse
Opened /dev/input/event2, found HID 1241:1177
Trying to open /dev/input/event0
Type guess from components: Mouse
Opened /dev/input/event0, found Macintosh mouse button emulation
Linux plugin claims to have found 5 controllers
Power Button (FF)
Type: Keyboard
Component Count: 1
Component 0: Unknown
Identifier: Unknown
ComponentType: Absolute Digital
Sleep Button (CM)
Type: Keyboard
Component Count: 1
Component 0: Sleep
Identifier: Sleep
ComponentType: Absolute Digital
AT Translated Set 2 keyboard
Type: Keyboard
Component Count: 144
Component 0: Escape
Identifier: Escape
ComponentType: Absolute Digital
Component 1: 1
Identifier: 1
ComponentType: Absolute Digital
Component 2: 2
Identifier: 2
ComponentType: Absolute Digital
Component 3: 3
Identifier: 3
ComponentType: Absolute Digital
Component 4: 4
Identifier: 4
ComponentType: Absolute Digital
Component 5: 5
Identifier: 5
ComponentType: Absolute Digital
Component 6: 6
Identifier: 6
ComponentType: Absolute Digital
Component 7: 7
Identifier: 7
ComponentType: Absolute Digital
Component 8: 8
Identifier: 8
ComponentType: Absolute Digital
Component 9: 9
Identifier: 9
ComponentType: Absolute Digital
…
…
…
…
Component 142: Unknown
Identifier: Unknown
ComponentType: Absolute Digital
Component 143: Unknown
Identifier: Unknown
ComponentType: Absolute Digital
HID 1241:1177
Type: Mouse
Component Count: 6
Component 0: Left
Identifier: Left
ComponentType: Absolute Digital
Component 1: Right
Identifier: Right
ComponentType: Absolute Digital
Component 2: Middle
Identifier: Middle
ComponentType: Absolute Digital
Component 3: x
Identifier: x
ComponentType: Relative Analog
Component 4: y
Identifier: y
ComponentType: Relative Analog
Component 5: z
Identifier: z
ComponentType: Relative Analog
Macintosh mouse button emulation
Type: Mouse
Component Count: 5
Component 0: Left
Identifier: Left
ComponentType: Absolute Digital
Component 1: Right
Identifier: Right
ComponentType: Absolute Digital
Component 2: Middle
Identifier: Middle
ComponentType: Absolute Digital
Component 3: x
Identifier: x
ComponentType: Relative Analog
Component 4: y
Identifier: y
ComponentType: Relative Analog
`
`java -Djava.library.path=dist -cp dist/jinput.jar:dist/jinput-test.jar net.java.games.input.test.ControllerReadTest
Trying to open /dev/input/event6
Type guess from components: Mouse
Opened /dev/input/event6, found 3Dconnexion SpaceNavigator
Trying to open /dev/input/event4
Type guess from components: Keyboard
Opened /dev/input/event4, found Power Button (FF)
Trying to open /dev/input/event5
Type guess from components: Keyboard
Opened /dev/input/event5, found Sleep Button (CM)
Trying to open /dev/input/event3
Type guess from components: Unknown
Opened /dev/input/event3, found PC Speaker
No clue what type PC Speaker is, we guessed at Unknown
Trying to open /dev/input/event1
Type guess from components: Keyboard
Opened /dev/input/event1, found AT Translated Set 2 keyboard
Trying to open /dev/input/event2
Type guess from components: Mouse
Opened /dev/input/event2, found HID 1241:1177
Trying to open /dev/input/event0
Type guess from components: Mouse
Opened /dev/input/event0, found Macintosh mouse button emulation
Linux plugin claims to have found 5 controllers
Component count = 1
Component count = 1
Component count = 144
Component count = 6
Component count = 5
Failed to poll device: Failed to get device key states (9)
Power Button (FF) disabled
Failed to poll device: Failed to get device key states (9)
Sleep Button (CM) disabled
Failed to poll device: Failed to get device key states (9)
AT Translated Set 2 keyboard disabled
Failed to poll device: Failed to get device key states (9)
HID 1241:1177 disabled
Failed to poll device: Failed to get device key states (9)
Macintosh mouse button emulation disabled
`
The ControllerReadTest opens 6 windows: ControllerReadTest, Power Button (FF), HID 1241:1177, AT Translated Set 2 keyboard, Macintosh mouse button emulation, Sleep Button (CM). None for the Space Navigator
See anything?
John
Ok, try this one. You can run controller event test instead of text test, I’m only interested in my extra debug as hopefully that will tell us why JInput ignores the device. Although I do think I know why now, after seeing your earlier post. JInput is thinking it’s a mouse. I’m betting that there are either no buttons on the device, or they are numbered buttons, and right now, JInput expects the left mouse button to exist as left under Linux.
Lets see if that works
Endolf