Howto: Gameport Joystick as Mouse on Slackware GNU/Linux 13.37

Shortly after I began using Slackware in 2005 I realized I wanted to use a joystick as my core pointer instead of a mouse. I never got around to actually obtaining a joystick until last month when I found and purchased a PC Raider Professional Analog Joystick from a local thrift store. It has a male DA-15 D-subminiature connector, so the device sat unused for two weeks as I sought a Soundblaster Live PCI expansion card for the sole purpose of connecting the joystick to it’s DA-15 gameport.

I didn’t find an SB Live card anywhere but finally realized that the Pentium 3 system running Slackware 13.37 I had been using as a router had a gameport on the motherboard. So I replaced the box with another device to handle routing and began configuring it to use the PC Raider as X’s CorePointer input device.

I ran this google search term: linux joystick as mouse.

This search term can be run by clicking the link below.

I found this page: which was very instructive. I basically followed the directions on that site to load the correct kernel modules to allow use of the joystick. I’ll explain how to enable the gameport and joystick, as well as how to configure X windows to use them like a mouse.

Kernel Modules

We must first allow the kernel to see the onboard gameport. This module must be loaded no matter what your gameport hardware is. Do so by loading the ‘gameport’ module:

# modprobe gameport

My gameport also required another module for the chipset, called ‘ns558’. Your gameport may use a different module as it’s driver. to find out what module it needs, I recommend reading the documentation included with the kernel source under the input/joystick directory. Load it:

# modprobe ns558

The next thing we must do is load the module for the joystick. Mine is a PC Raider Professional Analog, which uses the ‘analog’ module. Your joystick may use a different module as it’s driver. Again, reading the kernel documentation in the input/joystick directory is a good starting point to find the correct module to load for your joystick. Some possible modules are listed in the site I mentioned before: Trial and error using modprobe and modprobe -r are how I found the right module. Please keep in mind that even if you have the right module loaded here, you still need to load one more and configure X before you will get any indication that you loaded the correct joystick and gameport modules.

# modprobe analog

The final module we must load is the generic Joysick driver, called ‘joystick’. As far as I understand, this module needs to be loaded no matter what joystick you have.

# modprobe joystick

To summarize, load these modules: gameport, ns558, analog, and joystick. You always need to load gameport and joystick, but ns558 and analog will vary based on your gameport and joystick hardware.

Making It Permanent

Run these four commands to make your changes persistent across reboot:

# echo " /sbin/modprobe gameport" >> \
/etc/rc.d/rc.modules-$(uname -r) 2>/dev/null

# echo ” /sbin/modprobe ns558″ >> \
/etc/rc.d/rc.modules-$(uname -r) 2>/dev/null

# echo ” /sbin/modprobe analog” >> \
/etc/rc.d/rc.modules-$(uname -r) 2>/dev/null

# echo ” /sbin/modprobe joystick” >> \
/etc/rc.d/rc.modules-$(uname -r) 2>/dev/null

Then to review the changes to rc.modules, do this:

tail /etc/rc.d/rc.modules-$(uname -r)

Now reboot!

Configuring X

After reboot, you should see the device ‘js0’ in the directory /dev/input/ if all the correct modules have been loaded. If /dev/input/js0 does not exist, then the required modules are not getting loaded, or you are loading the incorrect modules.

Once you can see /dev/input/js0, run the following command:

cat /dev/input/js0

then move the joystick around. If all is working properly and the correct modules are loaded, you will see junk characters produced as you move the joystick around.

Also after reboot, ‘lsmod’ should list the four modules you configured rc.modules-$(uname -r) to load.

I tried using Slackware’s mouseconfig utility’s ‘js’ selection to tell X to use the joystick on the gameport as it’s CorePointer. This did not work. So I did the following:

# unlink /dev/mouse
# ln -s /dev/input/js0 /dev/mouse

Now ‘cat /dev/mouse’ should show junk characters on the screen when you move the joystick.

The last thing we must do is tell X to use /dev/mouse with the ‘joystick’ driver.

Edit the file /etc/X11/xorg.conf-vesa to alter the line that says

Driver "mouse"

to say “joystick” instead of mouse. on my system this was line # 272.

Next comment out line (#284 on my system) that says

Option "Protocol" "PS/2"

At this point here are three remaining steps.

First, create the file /etc/X11/xorg.conf.d/50-joystickconf and edit it to contain the following lines:

Section "InputClass"
Identifier "joystick catchall"
MatchIsJoystick "on"
MatchDevicePath "/dev/input/js*"
Driver "joystick"
#Option "StartKeysEnabled" "False"
#Option "StartMouseEnabled" "False"

Second, restart X. Try to move the cursor using the joystick. If you cannot– reboot, start X, and you should now be able to to move the cursor using the joystick. If not, now is the time to try using other driver modules for your gameport and joystick instead of ns558 and analog respectively, or whatever you tried to use. Make those changes in the file /etc/rc.d/rc.modules-$(uname -r) .

The third and final remaining step is to calibrate your joystick, which I leave to you as an exercise 🙂

If your cursor moves to the top of the screen and stays there, see URL # 3 below for the bug fix.

Futher Reading

I also referred to the following URLs for clarification, corroboration of (the main reference I used), &c. :




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: