Linux Tutorial Blog

Your regular Linux tutorial source!

Solution: Getting a Gravis GamePad Pro to work on Linux

rechosen | 18 November, 2007 20:56

After a whole afternoon of struggling, I finally found how to get a Gravis GamePad Pro to work correctly (with all ten buttons enabled) on Linux. Because this took me so much effort and the information on it was so scattered and incomplete, I decided to break the frozenness of Linux Tutorial Blog and write a post about it.

Note: This is about the gameport version, I don't have a USB version of the device.

The situation

I have a Gravis GamePad Pro connected to the gameport of a PCI soundcard which is used by the snd_ens1370 driver. When I plugged the GamePad in, nothing seemed to happen (no kernel messages, no /dev/input/js0). After a bit of investigation, the gameport turned out be inactive.

Getting the gameport to work

How did I find out that the gameport was inactive? Well, I did so using the following command:

[rechosen@localhost ~]$ cat /proc/asound/card0/audiopci
Ensoniq AudioPCI ES1370

Joystick enable  : off
MIC +5V bias     : off
Line In to AOUT  : off

Note: In my case, the card with the gameport is alsa card 0. This may vary, so change the digit after "card" to the correspondig number in your case.

As you can see, the joystick (which is the word they use to indicate the gameport) is not enabled. This is by default the case when using the snd_ens1370 driver. I found in the alsa documentation that I had to pass a certain option to the driver, namely "joystick=1" (without the quotes).

Note: When using the snd_ens1371 driver, you need to use the option "joystick_port=1". To find out what option(s) to use for other drivers, have a look at the kernel alsa joystick documentation, for example here.

If you don't know where or how to put this option, you will usually have to look for a file like this:

  • /etc/modules.d/alsa or
  • /etc/modutils/alsa-base or
  • /etc/alsa/modules/1.x

And add the following line:

options snd-ens1370 joystick=1

Or, in the case of snd_ens1371:

options snd-ens1371 joystick_port=1

In the case of an other module:

options <module> <option>=<value>

I hope this is clear enough. After modifying this (with root permissions), you'll probably have to run a command with a name like 'update-modules'. This depends on which distro you're using.

However, just adding this option wasn't enough in my case. The trick to get "Joystick enable" to "on" in /proc/asound/card0/audiopci was to make sure the 'joydev' module was loaded before the 'snd_ens1370' one. You can make sure this happens using the same file we used to pass the option. Add a line like the following:

pre-install snd-ens1370 modprobe joydev; modprobe grip

Replace "snd-ens1370" with the module name of your choice if needed. Again you might need to run a command like 'update-modules'.

Note: In my case, the ns558 module was loaded at boot time and blocked the gameport. I solved this by unloading it before loading the other modules. However, this is more of a hack, and not good practice. If you really want/need to do so, replace the aforementioned line with:

pre-install snd-ens1370 modprobe -r ns558; modprobe joydev; modprobe grip

Again, replace "snd-ens1370" with the module name of your choice if needed and perhaps run a command like 'update-modules'. If you have any clues on why this module could be loaded (probably by alsa, as it isn't specified anywhere in my modules configuration), please leave a comment.

The final trick

After taking care of all these things, the gamepad still didn't work in my case. After quite some time of trying different things and digging through forum topics and Usenet posts, I found that I had to drag the switch on the back of the device to "GrIP" mode. That did the trick. The GamePad was detected, /dev/input/js0 appeared and I could play Super Mario War together with my brother =).

Comments

experiment

ITwebz Linux | 03/10/2008, 05:52

Thats good experiment I wish I could try this one.

Add comment

(optional, will not be published)
(optional)

<><