Saitek X52
Obsah
INTRODUCTION
You have a multi-button joystick, i.e. Saitek X52 and it doesn't work. Your joystick is shown in:
# dmesg | grep Joy [ 2.508763] generic-usb 0003:06A3:075C.0004: input,hidraw3: USB HID v1.11 Joystick [Saitek Saitek X52 Flight Control System] on usb-0000:00:0b.1-7.4.1/input0
or
# dmesg | grep Sait [ 2.506482] usb 1-7.4.1: Product: Saitek X52 Flight Control System [ 2.506485] usb 1-7.4.1: Manufacturer: Saitek [ 2.508683] input: Saitek Saitek X52 Flight Control System as /devices/pci0000:00/0000:00:0b.1/usb1/1-7/1-7.4/1-7.4.1/1-7.4.1:1.0/input/input3 [ 2.508763] generic-usb 0003:06A3:075C.0004: input,hidraw3: USB HID v1.11 Joystick [Saitek Saitek X52 Flight Control System] on usb-0000:00:0b.1-7.4.1/input0
but doesn't come up i.e. in js_demo. This is apparently due to problem with some 2.6 kernels. They introduced some changes to the kernel, which lead to break in support of multi-button (>32 button) joysticks or Joystick Systems. The easy solution I tested is to replace a single module joydev.ko (instead of rebuilding and reinstalling all kernel) with a repaired and recompiled module.
0) GET READY
I had installed kernel sources and stuff to compile it. You MUST find out what kernel you're using:
# uname -r
...and use exactly this kernel. In my case it's "linux-2.6.31.5-0.1-Desktop" which sources I will copy to "linux-2.6.31.5-OAK". In all cases you must replace my kernel version for yours in all commands bellow. "OAK" is just a suffix to my kernel sources copy - you can use other suffix of course. I.e.:
/usr/src/linux-2.6.31.5-0.1-Desktop
for
/usr/src/<YOUR KERNEL VERSION>
1) MAKE A COPY OF KERNEL SOURCES
I copied my current kernel to /usr/src/linux-2.6.31.5-OAK so that I can modify the sources safely
# cp /usr/src/linux-2.6.31.5-0.1-Desktop /usr/src/linux-2.6.31.5-OAK
2) MODIFY INCRIMINATED FILE
Modify the file /usr/src/linux-2.6.31.5-OAK/drivers/input/joydev.c - remove following lines:
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, .evbit = { BIT_MASK(EV_KEY) }, .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) },
... which are beteween brackets bellow text "}, /* Avoid itouchpads and touchscreens */".
3) REBUILD THE KERNEL MODULE
I followed tutorial (http://en.opensuse.org/Configure,_Build_and_Install_a_Custom_Linux_Kernel for my OpenSUSE) for rebulding the kernel, up to the point where you run "make". This includes few commands:
cd /usr/src/linux-2.6.31.5-OAK # make clean # make mrproper # make cloneconfig # make xconfig(probably not required for building a module only, but better check the config in xconfig)
... now this is where you would run "make". But instead, build kernel modules for input devices only:
# make SUBDIRS=/usr/src/linux-2.6.31.5-OAK/drivers/input/ modules
... this will take some time, cca 5 minutes on my quad machine. When finished, provided it didn't ended up with an "Error #" statement (install whatever you're missing for kernel building then), replace with your new input.ko module the old one:
4) REPLACE EXISTING MODULE WITH NEW ONE
# mv /lib/modules/2.6.31.5-0.1-desktop/kernel/drivers/input/joydev.ko /lib/modules/2.6.31.5-0.1-desktop/kernel/drivers/input/joydev.ko.bak # cp /usr/src/linux-2.6.31.5-OAK/drivers/input/joydev.ko /lib/modules/2.6.31.5-0.1-desktop/kernel/drivers/input/joydev.ko
5) REBOOT
Reboot and ENJOY! Now when you run (with X52 plugged in :-D) js_demo you should see the joystick and it's reactions:
oak@linux:~> js_demo Joystick test program. ~~~~~~~~~~~~~~~~~~~~~~ Joystick 0: "Saitek Saitek X52 Flight Control System" Joystick 1 not detected Joystick 2 not detected Joystick 3 not detected Joystick 4 not detected Joystick 5 not detected Joystick 6 not detected Joystick 7 not detected +--------------------JS.0----------------------+ | Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 Ax:6 Ax:7 Ax:8 Ax:9 Ax:10 | +----------------------------------------------+
Note: There is a separate driver for the display on the X52 joystick. This driver only works for all the buttons and axes.
--Oakld 24. 4. 2010, 08:20 (UTC)