Possible gamepad hardware bug? Requesting testers.
I'm hacking together a console app that uses a joystick/gamepad for control. I've tried code from the linux joystick utils, code from the kernel docs, joyd, joy2key and mpcstick and they all suffer the problem outlined below in Test 1. Before I run screaming into the hills (and over to the programming forum with my code), I want to test some hardware and make sure this isn't just me and my system :P (This shouldn't take more than 5 minutes of your time.)
You will need:
A gamepad that is known to work. (Mine's a Thustmaster 12 button USB)
The linux joystick utils (specificaly jstest)
It would help if you posted your distro/kernel version too. (I'm LFS5.1, 2.6.5)
TEST 1: (The Problem)
1) In a console/terminal window run:
$ jstest --normal /dev/js0 (or js1, js2 etc, depending on your setup)
2)Look the values of Axes. It should look like this:
Axes: 0: 0 1: 0 Buttons:......... {snipped}
The 0 values for axes0 (left and right) and axes1 (up and down) indicate you aren't pressing anything.
3) Press and hold a direction (e.g. Up, Down). The value for the Axes will change - all good so far!
4) Continue holding the axes and press ctrl+c to close jstest
5) Release the axes and re-run the jstest --normal /dev/js0 code.
6) Note the values of Axes now - does jstest still report the axes as being pressed even though it's not? Mine does. Try the same test using buttons, not the axes - what happens?
TEST 2:
1) Open two console/terminal windows and run (in both!)
$jstest --normal /dev/js0
2) In console 1, repeat steps 3 and 4 from Test 1. Release the axes.
3) If you look at console 2, you can see the axes is reported as 0 (nothing pressed) - just like it should.
4) Re-run jstest in console 1 and, as expected, the axes is reported correctly, unlike in Test 1. Why does the joystick/gamepad not reset it's values in Test 1?
I'm guessing this might just be my pad/system, because surely someone smarter than me would have noticed this long before I did :P
Last edited by Dr Twox; 07-09-2004 at 08:23 PM.
|