![]() |
Adding a joystick to the slugUpdate See the end for a much easier way of doing it! Joypads and joysticks can be cheap and interesting controllers for various forms of special project - joypads can be seen as a bank of switches with a convenient interface attached and a straightforward API to use them. The default unslung image does not come with the necessary kernel modules installed for joystick use, and one of them (joydev) doesn't seem to be available from the optware feed. I have spent some time trying to get a joystick working and this howto is offered to help others in the right direction. It is almost certainly an inefficient method - I don't yet understand how evrything works! You have been warned... First, set up a cross-development toolchain on another computer, using the instructions at Development.Homepage. Make the unslung image, to make sure there are no problems with your setup. On your development box, Edit openembedded/packages/linux/unslung-kernel/defconfig. Find the line that reads cd ~/slug and make unslung-image
At this point I reflashed the slug with the new firmware image (in ~/slug/unslung/tmp/deploy/images/unslung-nslu2be-6.11-beta-nslu2.bin) and re-unslung the disk, but this causes a lot of aggravation, and I suspect the next stage will probably work without it as the kernel version is the same in the release firmware of unslung and the image you have just built. Manually upload the new kernel-module-joydev package from ~/slug/unslung/tmp/deploy/ipkg/nslu2be/kernel-module-joydev_2.4.22.l2.3r63-r21_nslu2be.ipk to the slug, and then install it: ipkg install /public/kernel-module-joydev_2.4.22.l2.3r63-r21_nslu2be.ipk
And then install the other two necessary kernel modules from the feed: ipkg install kernel-module-input kernel-module-hid
The joystick driver won't work be very useful until you create the /dev/input/js0 node on the slug: mkdir /dev/input
mknod /dev/input/js0 c 13 0
Then, you need to load the kernel modules before plugging in your USB joystick. It should be possible to arrange for this to happen automatically on boot, but I haven't had time to work out how yet: insmod input
insmod hid
insmod joydev
Plug in a joystick into one of the USB ports. Without client software, it's not particularly useful, but you can check it is working by watching the datastream: cat /dev/input/js0
If you get garbage printed to your terminal when you press the buttons on the stick, you know that the driver is working! I'm going to go on to look at getting Update I've now moved the slug onto OpenSlug, but a similar approach works fine (the build system for OpenSlug is different, but IIRC it's still simply a matter of recompiling with Second update - the easy way I eventually moved everything to Debian lenny, and simply asked for the appropriate joystick modules to be added to the kernel image package for the slug. The developers were extremely helpful - I was sent a kernel with them included and they're being added to the main package on the next release. So the very simple answer to using joysticks is - use Debian! The other info is left on this page for people who have good reasons for using Unslung or SlugOS. Page last modified on March 27, 2009, at 04:59 AM
|