Xbox 360 Controller on Slackware
07 Feb 2014Steam for Linux has been available for a while now and it’s coming along nicely. It’s easy enough to set up for Slackware using Alien Bob’s steamclient packages. Big Picture Mode is available which means more people are going to want to use a gamepad. I have a wired Xbox 360 controller that I purchased to use with my emulators. Slackware’s kernel already includes the xpad gamepad module so the controller is detected as soon as it’s plugged in.
[ 6.513624] usb 2-1.6: new full-speed USB device number 3 using ehci-pci [ 6.604012] usb 2-1.6: New USB device found, idVendor=045e, idProduct=028e [ 6.604014] usb 2-1.6: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 6.604016] usb 2-1.6: Product: Controller [ 6.604017] usb 2-1.6: Manufacturer: ©Microsoft Corporation [ 6.604018] usb 2-1.6: SerialNumber: 199BF1B [ 6.870036] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/input/input10 [ 6.870078] usbcore: registered new interface driver xpad
Make sure the xpad module is loaded:
root@hades:~ # lsmod | grep xpad xpad 11426 0
If it’s not, then load it:
root@hades:~ # modprobe xpad
Unfortunately, I had some issues with the gamepad not being recognized by Steam or emulators such as Dolphin.
This can be fixed by creating a udev rule to set the correct permissions for the input device. Stick the rules below in /etc/udev/rules.d/, inside something like 99-joystick.rules:
KERNEL=="event[0-9]*", ENV{ID_BUS}=="?*", ENV{ID_INPUT_JOYSTICK}=="?*", GROUP="games", MODE="0660" KERNEL=="js[0-9]*", ENV{ID_BUS}=="?*", ENV{ID_INPUT_JOYSTICK}=="?*", GROUP="games", MODE="0664"
Add your user to the games group:
root@hades:~ # usermod -G games -a gerardozamudio
The Xbox 360 controller should now be assigned to the games group with read-write access.
root@hades:~ # ls -l /dev/input/ total 0 drwxr-xr-x 2 root root 180 Feb 7 03:10 by-id/ drwxr-xr-x 2 root root 180 Feb 7 03:10 by-path/ crw-r----- 1 root root 13, 64 Feb 7 09:11 event0 crw-r----- 1 root root 13, 65 Feb 7 09:11 event1 crw-rw---- 1 root games 13, 74 Feb 7 09:11 event10 crw-r----- 1 root root 13, 75 Feb 7 09:11 event11 crw-r----- 1 root root 13, 76 Feb 7 09:11 event12 crw-r----- 1 root root 13, 77 Feb 7 09:11 event13 crw-r----- 1 root root 13, 78 Feb 7 09:11 event14 crw-r----- 1 root root 13, 79 Feb 7 09:11 event15 crw-r----- 1 root root 13, 80 Feb 7 09:11 event16 crw-r----- 1 root root 13, 81 Feb 7 09:11 event17 crw-r----- 1 root root 13, 82 Feb 7 09:11 event18 crw-r----- 1 root root 13, 66 Feb 7 09:11 event2 crw-r----- 1 root root 13, 67 Feb 7 09:11 event3 crw-r----- 1 root root 13, 68 Feb 7 09:11 event4 crw-r----- 1 root root 13, 69 Feb 7 09:11 event5 crw-r----- 1 root root 13, 70 Feb 7 09:11 event6 crw-r----- 1 root root 13, 71 Feb 7 09:11 event7 crw-r----- 1 root root 13, 72 Feb 7 09:11 event8 crw-r----- 1 root root 13, 73 Feb 7 09:11 event9 crw-rw-r-- 1 root games 13, 0 Feb 7 09:11 js0 crw-r----- 1 root root 13, 63 Feb 7 09:11 mice crw-r----- 1 root root 13, 32 Feb 7 09:11 mouse0 crw-r----- 1 root root 13, 33 Feb 7 09:11 mouse1
This should cause Steam and your emulators to detect the controller properly and allow you to configure it using each application’s settings.