# HOWTO: Joystick Setup

## Exdaix

[Changelog]

For future reference, this article has been moved to the Gentoo-Wiki (http://www.gentoo-wiki.com), and will be updated there from now on.

[Information]

I noticed in quite a few posts that a HOWTO for joysticks was needed, so I figured I would start one with what I did to get my joystick working.  Feel free to post some replies with more tips and info, I will include it in the main post here.

First off, I just bought a Saitek Cyborg Evo joystick (USB), and I am running the 2.4 kernel.  I will be glad to modify this post to include a 2.6 section, but I am not knowledgeable in that area, so I will not write about that yet.  I could not get my old gameport joystick to work on either my sound card, or my motherboard gameport, so this will be a USB HOWTO for now.

[USB Setup]

Ok, first thing I did was emerge libjsw, so I had all the joystick tools and libraries ready, and so I would not forget later.

```
su

emerge libjsw
```

Now go into your kernel menu.

```
cd /usr/src/linux

make menuconfig
```

Turn on the following options in your kernel:

```
Input Core Support --->

 <*> Input Core Support

 <*> Joystick Support

 <*> Event Interface Support

USB Support -->

 <*> Support for USB

 [*] Preliminary USB device filesystem

 <*> UHCI Alternate Driver (JE) support

 <*> OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support

 <*> USB Human Interface Device (full HID) support

 [*] HID input layer support
```

Then compile your kernel and copy it to /boot and run grub or lilo:

```
make dep && make bzImage modules modules_install

mount /boot

cp arch/i386/boot/bzImage /boot/bzImage

lilo
```

Reboot, then do a dmesg.

```
dmesg
```

Look for USB and Joystick information.

```
hub.c: new USB device 00:07.3-2, assigned address 2

input: USB HID v1.00 Joystick [06a3:0464] on usb2:2.0
```

If you see something like this, then your joystick is detected and should work.

Now, since I could not find out how to download/install the old jscal program and utilities, I just used the joystick calibration program included in the libjsw package.

```
jscalibrator
```

That will create a .joystick file in your ~/home directory, so now your joystick should be ready for play in gl-117 or SearchAndRescue.

[FlightGear]

I've noticed that in FlightGear, if you run jscalibrator and run FlightGear on the same boot, FlightGear won't do much except use your trigger button as the brakes.  But I discovered that if you reboot and do not run jscalibrator that boot, FlightGear uses the joystick just fine, and games such as gl-117 are still calibrated and still work because of the .joystick file that was created last boot.  For some reason, jscalibrator seems to do something funky that FlightGear does not like, and you have to reboot each time you run jscalibrator.  It's not a big deal for me, since my joystick does not go out of calibration often.

Also, for some reason, the js_demo program that comes with FlightGear does not show axis movement unless I unplug and re-plug the joystick back in.  (I have hotplug installed and setup, so the kernel just detects the joystick every time its plugged back in.)  This in turn, does not let you configure your joystick with fgjs correctly, since it is not detecting the axis movement.  So I discovered if you unplug and re-plug the joystick back into the USB port, js_demo and fgjs detect the axis movement.Last edited by Exdaix on Mon Jul 05, 2004 5:18 pm; edited 1 time in total

----------

## soroh6

Thanks.  :Smile: 

----------

## Exdaix

For future reference, this article has been moved to the Gentoo-Wiki (http://www.gentoo-wiki.com), and will be updated there from now on.

----------

## X-Drum

hi,

you know if this works with sidewinder usb joypads??

----------

## Exdaix

It _should_, but I make no garuntees.

I remember reading a lot of stuff about Sidewinder products while making this HOWTO.

----------

## zaiyon

Hi, as you said you don't know where to find these options in 2.6er Kernels, but I would love to use my Saitek Cyborg Evo 3D Thing on a 2.6.7 Kernel, does anybody know where I can find these options:

```

Input Core Support --->

 <*> Input Core Support

 <*> Joystick Support

 <*> Event Interface Support

USB Support -->

 [*] Preliminary USB device filesystem

```

In newer menuconfigs?

I activated the following:

```

Input Device Support --->

 <*> Joystick interface

 <*> Event interface

 [*] Joysticks

```

But I didn't chose a specific Joystick, because my one was not with those listet...

----------

## Exdaix

If it is USB, you don't have to select a specific joystick.  The USB driver detects it for you.

----------

## Gentree

 *Exdaix wrote:*   

> For future reference, this article has been moved to the Gentoo-Wiki (http://www.gentoo-wiki.com), and will be updated there from now on.

 

Oh yeah? , any chance of a precise link, I see nothing from the main page.

 :Confused: 

[EDIT]

One wiki: http://gentoo-wiki.com/HOWTO_Joystick_Setup#Installation

BTW if jscalibrator that is buggy not flightgear:

```
bash-3.00#jstest /dev/js0

Joystick (Analog 2-axis 4-button joystick) has 2 axes and 4 buttons. Driver version is 2.1.0.

Testing ... (interrupt to exit)

Axes:  0:     0  1:     0 Buttons:  0:off  1:off  2:off  3:off 

bash-3.00#jscalibrator

bash-3.00#jstest /dev/js0

Joystick (Analog 2-axis 4-button joystick) has 2 axes and 4 buttons. Driver version is 2.1.0.

Testing ... (interrupt to exit)

Axes:  0:  4099  1:  3022 Buttons:  0:off  1:off  2:off  3:off 

bash-3.00#
```

I just launched jscalibirator and closed it using the X button on the frame. I did not even touch the joystick , let alone save a calibration.

Note how it has squewed the co-ordinates !

The good news is we are not running windows here WE DONT LIKE TO REBOOT LINUX.

```
bash-3.00#modprobe -r snd_cmipci 

bash-3.00#modprobe snd_cmipci joystick_port=1

bash-3.00#jstest /dev/js0

Joystick (Analog 2-axis 4-button joystick) has 2 axes and 4 buttons. Driver version is 2.1.0.

Testing ... (interrupt to exit)

Axes:  0:     0  1:     0 Buttons:  0:off  1:off  2:off  3:off 

```

You may like to correct the original post that tells ppl they need to reboot. :Rolling Eyes: 

BTW the jstest used above was grabbed as binary from SuSE 9.2. YaST sets up the joystick modules in about 2 minutes. I has taken be 2 DAYS to find all the info to do this on Gentoo. This is very dispersed untidy and undocumented.

----------

## thomasvk

```
jstest /dev/input/js0

Driver version is 2.1.0.

Joystick (Logitech Logitech RumblePad 2 USB) has 6 axes (X, X, X, X, X, X)

Segmentation fault
```

I can't seem to find an answer. Anyone any ideas?

Edit:

It seems it needs =linux-headers-2.6.11-r3.

----------

## Conzar

I also get that seg fault too.  Another problem that I haven't been able to figure out is permissions with all devices that get put in /dev/input.

Is there a way to perminatly change the group to all devices in dev/input to say the games group?

----------

## zbyte64

I get a seg fault as well:

```
zbyte16 linux # jstest --select /dev/input/js0

Driver version is 2.1.0.

Joystick (GreenAsia Electronics  4Axes 12Keys GamePad ) has 12 axes (X, X, X, X, X, X, X, X, X, X, X, X)

Segmentation fault

```

I know ubuntu had some similiar issues:  https://launchpad.net/distros/ubuntu/+source/joystick/+bug/45930

also on the wiki someone suggested using linux-headers-2.6.11-r3: http://gentoo-wiki.com/Talk:HOWTO_Joystick_Setup

[EDIT] using linux-headers-2.6.11-r3 works for me

----------

## Gentree

 *Conzar wrote:*   

> I also get that seg fault too.  Another problem that I haven't been able to figure out is permissions with all devices that get put in /dev/input.
> 
> Is there a way to perminatly change the group to all devices in dev/input to say the games group?

 

yes , look into udev rules in /etc/udev/rules.d  

this should be pretty well covered in handbook , wiki , forums now your know what to look for.

HTH   :Cool: 

----------

