[Plib-devel] Saitek X52 joystick with 34 buttons
Brought to you by:
sjbaker
From: Trammell H. <hud...@sw...> - 2005-05-04 15:21:07
|
I've recently started using a Saitek X52 joystick with my Linux box and have run into problems with plib's JS module limitation in the number of supported buttons. It only supports up to 32 buttons due to the MAX_BUTTONS definition and the fact that it uses an int to store the button state, but the X52 has 34 buttons (and 12 axes). This code in jsLinux.cxx is the problem: case JS_EVENT_BUTTON : if ( os->js.value == 0 ) /* clear the flag */ os->tmp_buttons &= ~(1 << os->js.number) ; else os->tmp_buttons |= (1 << os->js.number) ; break ; Changing tmp_buttons to a uint64_t, updating the arguments to jsJoystick::rawRead and jsJoystick::read fixed that for me. Another problem is that the mode switch holds down one of three buttons depending on which of the three modes is selected. This interferes with the calibration routine used by FlightGear and required me to modify the fgjs program. Any code that uses level triggered button handling may run into starvation as it always services the mode buttons. With FC3 I had to patch my kernel's USB hid-core file, as documented here to deal with the slow joystick device. Apparently Saitek has some problems across their entire product line -- the patch was originally for an X45 joystick, but works for the X52 as well: http://baron.flightgear.org/pipermail/flightgear-users/2004-July/008234.html Trammell |