NSLU2-Linux
view · edit · print · history

HowTo.AddAJoystick History

Hide minor edits - Show changes to markup

March 27, 2009, at 11:59 AM by Tom Harris -- Added the much easier way - using Debian.
Changed lines 1-2 from:

Adding a joystick to an unslung slug

to:

Adding a joystick to the slug

Update See the end for a much easier way of doing it!

Added lines 49-54:

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.

March 06, 2009, at 05:33 PM by Tom Harris -- Correct minor error
Changed lines 45-46 from:

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 "CONFIG_INPUT_JOYDEV=m". I think that OpenSlug also properly loads the joydev module automatically when a joystick is connected (sorry, it's been a while since I switched over and I can't remember exactly what I had to change). Anyway, jstest builds perfectly well when put into my local copy of the OpenEmbedded build system and I have the slug happily handling three joypads (js0 to js3). As a result, my slug-powered MP3?-jukebox-in-vintage-wallbox project is nearly complete! Only the software (an adaptation of jstest to detect wallbox switch presses and play songs) needs to be finished.

to:

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 "CONFIG_INPUT_JOYDEV=m". I think that OpenSlug also properly loads the joydev module automatically when a joystick is connected (sorry, it's been a while since I switched over and I can't remember exactly what I had to change). Anyway, jstest builds perfectly well when put into my local copy of the OpenEmbedded build system and I have the slug happily handling three joypads (js0 to js2). As a result, my slug-powered MP3?-jukebox-in-vintage-wallbox project is nearly complete! Only the software (an adaptation of jstest to detect wallbox switch presses and play songs) needs to be finished.

March 06, 2009, at 05:32 PM by Tom Harris -- Update on progress with OpenSlug and joystick-using software
Changed lines 42-45 from:

I'm going to go on to look at getting jstest working on the slug, and eventually to using a joypad's switches to interface with some jukebox software. There will be further updates as and when I make progress, but I hope the above is helpful to anyone hoping to follow the same road.

to:

I'm going to go on to look at getting jstest working on the slug, and eventually to using a joypad's switches to interface with some jukebox software. There will be further updates as and when I make progress, but I hope the above is helpful to anyone hoping to follow the same road.

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 "CONFIG_INPUT_JOYDEV=m". I think that OpenSlug also properly loads the joydev module automatically when a joystick is connected (sorry, it's been a while since I switched over and I can't remember exactly what I had to change). Anyway, jstest builds perfectly well when put into my local copy of the OpenEmbedded build system and I have the slug happily handling three joypads (js0 to js3). As a result, my slug-powered MP3?-jukebox-in-vintage-wallbox project is nearly complete! Only the software (an adaptation of jstest to detect wallbox switch presses and play songs) needs to be finished.

April 06, 2008, at 08:40 PM by Tom Harris -- Formatting tweaks
Changed lines 13-14 from:

cd ~/slug and make unslung-image

to:
cd ~/slug and make unslung-image
Changed lines 19-20 from:

ipkg install /public/kernel-module-joydev_2.4.22.l2.3r63-r21_nslu2be.ipk

to:
ipkg install /public/kernel-module-joydev_2.4.22.l2.3r63-r21_nslu2be.ipk
Changed lines 23-24 from:

ipkg install kernel-module-input kernel-module-hid

to:
ipkg install kernel-module-input kernel-module-hid
Changed lines 27-29 from:

mkdir /dev/input mknod /dev/input/js0 c 13 0

to:
mkdir /dev/input
mknod /dev/input/js0 c 13 0
Changed lines 32-35 from:

insmod input insmod hid insmod joydev

to:
insmod input
insmod hid
insmod joydev
Changed lines 38-39 from:

cat /dev/input/js0

to:
cat /dev/input/js0
April 06, 2008, at 08:38 PM by Tom Harris -- Basic (and incomplete) instructions on enabling joystick support. New page.
Added lines 1-42:

Adding a joystick to an unslung slug

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, cd ~/slug, or to wherever your tools are set up. Delete the contents of the unslung/tmp directory, so you can build a modified version cleanly and from scratch.

Edit openembedded/packages/linux/unslung-kernel/defconfig. Find the line that reads "# CONFIG_INPUT_JOYDEV is not set" and change it to "CONFIG_INPUT_JOYDEV=m".

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 jstest working on the slug, and eventually to using a joypad's switches to interface with some jukebox software. There will be further updates as and when I make progress, but I hope the above is helpful to anyone hoping to follow the same road.

view · edit · print · history · Last edited by Tom Harris.
Originally by Tom Harris.
Page last modified on March 27, 2009, at 11:59 AM