Please understand that I wrote this "howto" before L.I.F.E. with that being the case it may not be as simplified as the documents that L.I.F.E. uses now. However if you have any problems please feel free to email with them.

Kernel 2.4.x Linux Joystick HOWTO

1. Will linux recognize my joystick?

2. What kernel version do I need?

3. What other software do I need?

4. How do setup my joystick?

1. Will linux recognize my joystick?

This howto covers the detection and use of standard gameports and standard analog joysticks. Other joysticks may be configurable in this fashion, but there is no guarantee. Linux has probably already detected your gameport but the way to tell for sure is by executing a few simple steps. step one: First try this "cat /proc/isapnp". Hold shift and press the "page up" key to scroll through the output. Look for something like this in the output: Logical device 1 'CSC0001:GAME' Device is active Active port 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff Active IRQ 255 [0xff],255 [0xff] Active DMA 255,255 Active memory 0xffffffff,0xffffffff,0xffffffff,0xffffffff Resources 0 Priority preferred Port 0x200-0x200, align 0x7, size 0x8, 16-bit address decoding Alternate resources 0:1 Priority acceptable Port 0x208-0x208, align 0x7, size 0x8, 16-bit address decoding If you see something similar to this then you are in luck. Your gameport is more than likely on an isa PnP (Plug and Play) sound card or game card. If you have a PCI sound card or game card then you can type "pnpdump" instead of "cat /proc/isapnp to get a similar output.

2. What kernel version do I need?
This HOWTO is written for kernel versions 2.4.x. For older kernel versions read any joystick related files in the "Documentation" directory of your kernel source directory (usually /usr/src/linux/Documentation/joystick.txt) Since the joystick and compilation have several differences these steps WILL NOT work for earlier versions. Please refer to the "Kernel configuration" section of part 4 of this HOWTO to see suggestions for how to configure your kernel version 2.4.x

3. What other software do I need?
Read the "Changes" file in your source directory. Make sure that you have the version of modutils that is asks for. You can also find joystick testing software on the web (see section 5 of this HOWTO)

4. How do setup my joystick? Ok, the fun part :) Part 4 is set up in 6 steps below.

Step one: configuring your kernel Again this is for kernel versions 2.4.x and will not work on other versions. Run make config, make menuconfig or make xconfig. Make sure you have enabled the following: Input core support (module) Input core support --> Joysticks (module) Character Devices --> Joysticks --> Joystick support (compiled in the kernel) Character Devices --> Joysticks --> ns558 support (module) Character Devices --> Joysticks --> analog joysticks (module) Once again this HOWTO is for setting up analog joysticks with standard gameports, but at this point you can attempt to add support for your joystick if it is not analog....lots of choices here. Also if you use make menuconfig you can highlight the joystick of your choice and then select "help". In the help dialog it will tell you the name of the module file (whatever.o) you probably want to write it down.

Step two: compiling your kernel. If you are unsure about how to do that see the kernel HOWTO, but usually "make dep" then "make clean" then "make bzImage" then "make modules" (VERY IMPORTANT) then "make modules_install" (ALSO IMPORTANT) then optionally "make install" or use lilo (see the lilo HOWTO)to make a boot floppy or "make bzdisk"

Step three: Setup your modules. You should check to make sure your modules are in the right directories. Look in /lib/modules/2.4.4/kernel/drivers/input/ you should see the files "joydev.o" and "input.o" Now look in /lib/modules/2.4.4/kernel/drivers/char/joystick/ look for the files "ns558.o", "analog.o" and "gameport.o" if you compiled module support for any other joysticks you should be able to find modules for them in here as well. If you do not find all of these module files here then you need to repeat steps one and two. Make sure that you have enabled them as modules which will look like not < > or <*> if you ran "make menuconfig"

Step four: Make the device files. Do the following command to set up the correst device files in your /dev directory: cd /dev rm js* mkdir input mknod input/js0 c 13 0 mknod input/js1 c 13 1 (if you have more than one gameport) ln -s input/js0 js0 ln -s input/js1 js1 (if you have more than one gameport) chmod u+rwx input/js0 chmod u+rwx input/js1 (if you have more than one gameport) This will manually make the nessecary device files and symbolic links that your joystick(S) needs to function. I am not sure if the last step (chmod) is nessecary for all systems but it was for mine.

Step five: Modifying rc scripts for the new modules modules.Before you reboot your machine modify the file /etc/rc.d/rc.modules and ad the following lines: /sbin/modprobe joydev /sbin/modprobe ns558 /sbin/modprobe analog (or whichever driver your joystick uses) Now you can reboot your machine.

Step six: Did it work? Take a close look at your start up dialog. You should see: "Using /lib/modules/2.4.4/kernel/drivers/input/joydev.o" "Using /lib/modules/2.4.4/kernel/drivers/char/joystick/ns558.o" "Using /lib/modules/2.4.4/kernel/drivers/char/joystick/analog.o" If you see these lines with no error messages you are probably ready to test your joystick so move to section 5. If testing does not work you can return to this part and continue. If you do see error messages (If your sound card or joystick card is ISA you probably do) DO NOT PANIC. Simply move on to the next step. Step seven: ISAPNP. First do "ls /etc/isapnp.conf" if you get a "file not found" error that's fine. If you do have a /etc/isapnp.conf file then this will get a little tricky, but chances are you don't. If you do not have a isapnp.conf file then simply do "pnpdump -c > /etc/isapnp.conf". If you have your sound card working already and you did not already have a isapnp.conf file then you will probably want to edit /etc/isapnp.conf and comment out any references to your sound card and any other ISA cards that are already working normally (if it ain't broke don't fix it). However you want to leave any references to your gameport. After you are sure you have edited this file properly then you can run "isapnp /etc/isapnp.conf" you should get a response that says your gameport (and only your gameport) is enabled. This is good. Step eight: Try try again. At this point you will want to run "lsmod" to see what modules are running. You should see that "Joydev" and "input" are enabled. Now do "rmmod joydev" then "rmmod input". Now do "insmod joydev" then "insmod ns558" then "insmod analog". Now do "lsmod" again and you should see something like: Module Size Used by analog 7456 0 (unused) ns558 3200 0 (unused) gameport 1808 0 [analog ns558] joydev 6240 0 input 3360 0 [analog joydev] If so all is well. Notice that "input" and "gameport" are loaded as well. They are loaded automatically when you load "joydev" and "ns558". You should be ready to move on to section 5 and test your joystick. If these modules are not loaded or if you got an error when trying to load one of them then you may have a hardware and/or module problem. Try rebooting and see what happens. If it still does not work then try again from section one. 5. How can I test my joystick? There are a few utilities for testing your joystick. Some can be found at: Download the utilities package from the cvs tree. Alternatively you can probably use an older version of the utility jstest like I did. As a last ditch effort you can "cat /dev/js0" while moving the joystick. If you see output you probably have a functional gameport. Note: This process is not fool proof but it worked for my system. Please refer to the file /usr/src/linux/Documentation/joystick.txt for more detailed instructions if this does not do the trick. Let me remind everyone that I am a relatively new Linux user. If anyone has any corrections or suggestions please email them to me.

Special thanks to Urchlay from #linuxhelp, who really DOES know everything.