So in that last post, I hinted that getting the user-programmable joystick working properly on Raspberry Pi’s Linux OS was, well, less than ideal. Here’s just how non-ideal it was:
- Download and install tools.
- Run tools and play around to your heart’s content.
- Walk around with a silly glow on your face.
- Linux joystick configuration utility has a link on the manufacturer’s download page.
- Tool must be compiled on the Pi’s particular Linux release. (This is pretty common since Linux runs on all kinds of different processors, and this tool is not part of the “standard” OS.)
- Tool requires libhid library to compile. Locate and download libhid library source. Account must be created on a Debian archive site before download is possible.
- Libhid requires libusb and lib-usbcompat libraries to compile. Locate and download libusb/lib-usbcompat sources.
- Libhid needs to be manually patched before it will compile properly. Locate blog post from other unlucky user who, luckily for me, has already endured and documented all this pain, with the appropriate fixes.
- With libraries compiled and installed, now the joystick utility can be compiled.
- Discover another recommended manual patch, this one to the joystick utility’s source code, apply patch and compile again.
- Running the utility to reconfigure the joystick works successfully, except the joystick is dropped by the Linux kernel’s USB HID driver after reconfiguration, leaving it inoperative.
- Follow instructions from previous blogger to create manual scripts to allow manual re-binding of the stick to the HID driver after uploading revised configurations.
- Discover that the Linux kernel driver also filters out half of the valid joystick location values with any of the customized configurations. Anonymous comment on previous blog indicates a line in the kernel HID driver that can be commented out to disable overzealous validation of stick’s output values.
- Download entire RPi Raspbian Linux kernel source.
- Modify 3 lines of code.
- Recompile entire Linux kernel with Adafruit’s virtual-machine kernel-o-matic. (A breath of fresh air, something easy in a tedious process).
- Install new kernel and cross fingers. Luckily, it boots correctly and doesn’t brick the device. (If you’re attempting to reproduce my pain, make sure you choose the branch that matches your existing kernel!)
- Validate that joystick now functions properly.
- Discover that during some bootups, Joystick is detected as “second” joystick rather than first, causing failure to detect stick in rickety old emulator program.
- Research and create “udev rules” which allow particular devices to be forced to have specific names in the OS, so as not to make the rickety old emulator grumpy.
Linux: It’s the way of the future, you know.