# Joystick hell

## tactless

I've been having a really rough time trying to get my joystick to work - my dad just started a flight course, and most of his prior experience came from Windows flight simulators. I've emerged flightgear, but what's a flight sim without a joystick? Here are the techincal details:

Sound card: Creative Vibra 128 (Using the es1371 driver)

Joystick: Wingman Attack - plain old analog, 3 axis (x,y,throttle) 4 button joystick. Defined just like that in Windows, no driver. Connected to the soundcard's gameport.

Kernel options compiled in attempt to get it working:

* Input core support

    * Joystick Support

Character Devices

    Joysticks -->

        * Game port support

            * Classic ISA/PnP gameports

        --- Joysticks

         * Classic PC analog joysticks and gamepads

(I've tried compiling these both as modules and as builtins)

Symptoms:

In dev and its subdirectories, there are no gameport0 nor js0.

The following dmesg output lines seem relevant:

```

es1371: features: joystick 0x0

gameport0: NS558 PnP at 0x201 speed 1924 kHz

```

Any help would be appreciated... my searches for information on this have been unfruitful.[/code]

----------

## oniq

Under 'Input Core' support try compiling in 'Event interface support'.  Give that a try and tell me how it went.  I have a USB joystick so its a little different.

----------

## tactless

Compiled it in... no difference.

----------

## oniq

Can you post your entire dmesg (or a link to it hosted somewhere)?

----------

## tactless

```
Linux version 2.4.19-gentoo-r10 (root@warthog) (gcc version 2.95.3 20010315 (release)) #9 SMP Wed Dec 25 17:32:04 IST 2002

BIOS-provided physical RAM map:

 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)

 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)

 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)

 BIOS-e820: 0000000000100000 - 0000000013ff0000 (usable)

 BIOS-e820: 0000000013ff0000 - 0000000013ff3000 (ACPI NVS)

 BIOS-e820: 0000000013ff3000 - 0000000014000000 (ACPI data)

 BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)

319MB LOWMEM available.

Advanced speculative caching feature not present

On node 0 totalpages: 81904

zone(0): 4096 pages.

zone(1): 77808 pages.

zone(2): 0 pages.

Kernel command line: root=/dev/hda3

Local APIC disabled by BIOS -- reenabling.

Found and enabled local APIC!

Initializing CPU#0

Detected 451.032 MHz processor.

Console: colour VGA+ 80x25

Calibrating delay loop... 897.84 BogoMIPS

Memory: 317848k/327616k available (1620k kernel code, 7204k reserved, 663k data, 124k init, 0k highmem)

Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)

Inode cache hash table entries: 32768 (order: 6, 262144 bytes)

Mount-cache hash table entries: 8192 (order: 4, 65536 bytes)

Buffer-cache hash table entries: 16384 (order: 4, 65536 bytes)

Page-cache hash table entries: 131072 (order: 7, 524288 bytes)

CPU: Before vendor init, caps: 0387fbff 00000000 00000000, vendor = 0

CPU: L1 I cache: 16K, L1 D cache: 16K

CPU: L2 cache: 512K

CPU: After vendor init, caps: 0387fbff 00000000 00000000 00000000

CPU serial number disabled.

Intel machine check architecture supported.

Intel machine check reporting enabled on CPU#0.

CPU:     After generic, caps: 0383fbff 00000000 00000000 00000000

CPU:             Common caps: 0383fbff 00000000 00000000 00000000

Enabling fast FPU save and restore... done.

Enabling unmasked SIMD FPU exception support... done.

Checking 'hlt' instruction... OK.

POSIX conformance testing by UNIFIX

CPU: Before vendor init, caps: 0383fbff 00000000 00000000, vendor = 0

CPU: L1 I cache: 16K, L1 D cache: 16K

CPU: L2 cache: 512K

CPU: After vendor init, caps: 0383fbff 00000000 00000000 00000000

Intel machine check reporting enabled on CPU#0.

CPU:     After generic, caps: 0383fbff 00000000 00000000 00000000

CPU:             Common caps: 0383fbff 00000000 00000000 00000000

CPU0: Intel Pentium III (Katmai) stepping 03

per-CPU timeslice cutoff: 1461.42 usecs.

task migration cache decay timeout: 10 msecs.

SMP motherboard not detected.

enabled ExtINT on CPU#0

ESR value before enabling vector: 00000000

ESR value after enabling vector: 00000000

Using local APIC timer interrupts.

calibrating APIC timer ...

..... CPU clock speed is 451.0459 MHz.

..... host bus clock speed is 100.2323 MHz.

cpu: 0, clocks: 1002323, slice: 501161

CPU0<T0:1002320,T1:501152,D:7,S:501161,C:1002323>

migration_task 0 on cpu=0

PCI: PCI BIOS revision 2.10 entry at 0xfb2d0, last bus=1

PCI: Using configuration type 1

PCI: Probing PCI hardware

PCI: Using IRQ router PIIX [8086/7110] at 00:07.0

Limiting direct PCI/PCI transfers.

isapnp: Scanning for PnP cards...

isapnp: SB audio device quirk - increasing port range

isapnp: Card 'Creative ViBRA16X PnP'

isapnp: 1 Plug & Play card detected total

Linux NET4.0 for Linux 2.4

Based upon Swansea University Computer Society NET3.039

Initializing RT netlink socket

Starting kswapd

Journalled Block Device driver loaded

devfs: v1.12a (20020514) Richard Gooch (rgooch@atnf.csiro.au)

devfs: boot_options: 0x0

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

parport0: PC-style at 0x378 [PCSPP,TRISTATE]

pty: 256 Unix98 ptys configured

Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI ISAPNP enabled

ttyS00 at 0x03f8 (irq = 4) is a 16550A

ttyS01 at 0x02f8 (irq = 3) is a 16550A

lp0: using parport0 (polling).

gameport0: NS558 PnP at 0x201 speed 1988 kHz

Uniform Multi-Platform E-IDE driver Revision: 6.31

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

PIIX4: IDE controller on PCI bus 00 dev 39

PIIX4: chipset revision 1

PIIX4: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:pio, hdb:pio

    ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: hdc:pio, hdd:pio

hda: ST320011A, ATA DISK drive

hdb: ST36422A, ATA DISK drive

hdc: HITACHI DVD-ROM GD-2500, ATAPI CD/DVD-ROM drive

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

ide1 at 0x170-0x177,0x376 on irq 15

hda: 39102336 sectors (20020 MB) w/2048KiB Cache, CHS=2434/255/63, UDMA(33)

hdb: 12500460 sectors (6400 MB) w/256KiB Cache, CHS=778/255/63, UDMA(33)

hdc: ATAPI 24X DVD-ROM drive, 512kB Cache, DMA

Uniform CD-ROM driver Revision: 3.12

Partition check:

 /dev/ide/host0/bus0/target0/lun0: p1 p2 p3 p4

 /dev/ide/host0/bus0/target1/lun0: p1

FDC 0 is a post-1991 82077

Linux agpgart interface v0.99 (c) Jeff Hartmann

agpgart: Maximum main memory to use for agp memory: 262M

agpgart: Detected Intel 440BX chipset

agpgart: AGP aperture is 64M @ 0xe8000000

[drm] Initialized tdfx 1.0.0 20010216 on minor 0

[drm] AGP 0.99 on Intel 440BX @ 0xe8000000 64MB

[drm] Initialized radeon 1.1.1 20010405 on minor 1

SCSI subsystem driver Revision: 1.00

kmod: failed to exec /sbin/modprobe -s -k scsi_hostadapter, errno = 2

es1370: version v0.37 time 17:36:15 Dec 25 2002

es1371: version v0.30 time 17:36:20 Dec 25 2002

PCI: Found IRQ 5 for device 00:10.0

es1371: found chip, vendor id 0x1274 device id 0x1371 revision 0x06

es1371: found es1371 rev 6 at io 0xe800 irq 5

es1371: features: joystick 0x0

ac97_codec: AC97 Audio codec, id: 0x4352:0x5913 (Cirrus Logic CS4297A rev A)

Linux Kernel Card Services 3.1.22

  options:  [pci] [cardbus] [pm]

NET4: Linux TCP/IP 1.0 for NET4.0

IP Protocols: ICMP, UDP, TCP, IGMP

IP: routing cache hash table of 2048 buckets, 16Kbytes

TCP: Hash tables configured (established 32768 bind 32768)

NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.

ds: no socket drivers loaded!

kjournald starting.  Commit interval 5 seconds

EXT3-fs: mounted filesystem with ordered data mode.

VFS: Mounted root (ext3 filesystem) readonly.

Freeing unused kernel memory: 124k freed

Adding Swap: 650624k swap-space (priority -1)

EXT3 FS 2.4-0.9.17, 10 Jan 2002 on ide0(3,3), internal journal

kjournald starting.  Commit interval 5 seconds

EXT3-fs warning: maximal mount count reached, running e2fsck is recommended

EXT3 FS 2.4-0.9.17, 10 Jan 2002 on ide0(3,4), internal journal

EXT3-fs: mounted filesystem with ordered data mode.

MSDOS FS: IO charset iso8859-8

ne2k-pci.c:v1.02 10/19/2000 D. Becker/P. Gortmaker

  http://www.scyld.com/network/ne2k-pci.html

PCI: Found IRQ 11 for device 00:0f.0

eth0: RealTek RTL-8029 found at 0xe400, IRQ 11, 00:00:B4:B6:17:35.

nvidia: loading NVIDIA Linux x86 NVdriver Kernel Module  1.0-3123  Tue Aug 27 15:56:48 PDT 2002

devfs_register(1): could not append to parent, err: -17

devfs_register(1): could not append to parent, err: -17

NVRM: AGPGART: Intel 440BX chipset

NVRM: AGPGART: aperture: 64M @ 0xe8000000

NVRM: AGPGART: aperture mapped from 0xe8000000 to 0xd59bb000

NVRM: AGPGART: mode 2x

NVRM: AGPGART: allocated 16 pages

NVRM: AGPGART: freed 16 pages

NVRM: AGPGART: backend released

NVRM: AGPGART: Intel 440BX chipset

NVRM: AGPGART: aperture: 64M @ 0xe8000000

NVRM: AGPGART: aperture mapped from 0xe8000000 to 0xd59bb000

NVRM: AGPGART: mode 2x
```

(Several more NVRM: AGPART free/allocated several hundred pages messages follow)

----------

## oniq

Most of what I've seen is right after gameport0, input0 is initialized.  I'd double check, and then triple check that you compiled everything in that you said you did.  Try unplugging the joystick and plugging it back in.

Anybody have a direct answer for him??

----------

## tactless

Everything is quad-checked, and I tried reconnecting the joystick... didn't work. I don't see how it would, as there is no gameport device at all.

----------

## tactless

Perhaps you can post relevant lines from your dmesg?

----------

## tactless

Has anyone successfully got a non-USB joystick working? It's either that or my soundcard... it gave me some Joystick problems on Windows as well at various times, but the Creative drivers always seemed to fix those quickly.

----------

## oniq

 *tactless wrote:*   

> Perhaps you can post relevant lines from your dmesg?

 

I use a USB joystick, so when I plug it in I get:

```
Jan  1 13:50:17 angst kernel: input1: USB HID v1.00 Gamepad [Microsoft® Microsoft® SideWinder® Game Pad USB] on usb1:3.0
```

And thats it, I just use input1 (/dev/input/js0).  I wish I could help you further, maybe you should try ALSA drivers for your soundcard?

----------

## the_bard

I've got my Sidewinder Forcefeedback Pro working fine under Linux... I have the following drivers compiled as modules, not in the kernel, so I've got to make sure each is loaded, otherwiser I don't get the joystick input... keep in mind, my sound card is also a Soundblaster Audigy.

1. input (generic input driver?)

2. joydev (joystick input driver?)

3. emu10k1-gp (soundcard gameport)

4. gameport (another gameport driver?)

5. sidewinder (driver for the sidewinder itself).

If you weren't using an Audigy card, you could probably use the ns558 driver instead of the emu10k1-gp driver. The same goes for the joystick... if you're using a straight up analog joystick, you'd want to load the analog module instead of the sidewinder module. Take a look when you compile your kernel, and read the help on the driver modules...

Don't know if that helps or not, but it doesn't hurt too much to be repetive, right?   :Rolling Eyes: 

----------

## tactless

Did exactly that, with ns558 and analog. Everything seems to work, and /dev/input is created... but stays empty. Tried doing this without loading my soundcard modules (es1371)... it didn't help.

----------

## thegarbageman

I have found that when I use ALSA with an es1371, my gameport does not work.  I don't care, because I don't use it - I just thought that might help someone.

----------

## tactless

I'm not using ALSA... at least I don't think I am. How can I check?

----------

## oniq

Do you have a place you can post your kernel config file?  If not email it to me at dominik@snet.net and I'll take a look.  And.. if you can, upgrade to 2.4.20.

----------

## tactless

Okay, switched from Gentoo-Sources-2.4.19-r10 to Vanilla-Sources-2.4.20. Compiled with same options (left the defaults the way they were, performed the same changes I did to my Gentoo kernel config on the Vanilla kernel, using menuconfig), loaded, works. Loading the modules gives the same result: An empty /dev/input is formed.

Modules loaded (in this order):

- input

- joydev

- ns558

- gameport

- analog

I loaded these using modprobe. Here's the relevant output of lsmod:

```

analog                  7456   0 (unused)

ns558                   2076   0 (unused)

joydev                  6912   0 (unused)

input                   3520   0 [analog joydev]

es1371                 30784   1

gameport                1548   0 [analog ns558 es1371]

```

----------

## oniq

You can always try creating the devices by hand, http://atrey.karlin.mff.cuni.cz/~vojtech/input/quick.html

```
Then, to keep a working system after you boot with the new kernel, you also need to change a couple nodes in /dev:

cd /dev

mkdir old

mv mouse js? old

mkdir input

cd input

mknod js0 c 13 0

mknod js1 c 13 1

mknod js2 c 13 2

mknod js3 c 13 3

mknod mouse0 c 13 32

mknod mouse1 c 13 33

mknod mouse2 c 13 34

mknod mouse3 c 13 35

mknod mice c 13 63

mknod event0 c 13 64

mknod event1 c 13 65

mknod event2 c 13 66

mknod event3 c 13 67

cd ..

ln -s input/js0 js0

ln -s input/js1 js1

ln -s input/mice mouse

```

Of course, ignoring the mouse events.

----------

## tactless

Yes, I've tried that... however, js_demo (Flightgear) doesn't identify any joysticks, and trying to cat the devices gives a "no such device" error.

----------

## nalin

i've found (with regular joysticks) some boards are not supported with the ns558 driver, in particular, my last my via mb with onboard sound didnt have great support in this area...eventually i got a usb joystick but obviously not an option for you...

Though I know that blowing money to fix a problem isnt always an ideal solution...gentoo and linux in general works so well with the ideal hardware, particularly in the areas of sound and video.  With audio, I found via's onboard sound sucked, no hardware mixing, artsdsp everything which was problematic at best, and my gameport didnt work.  Eventually I got a sb live and works fantastic though ridding my system of alsa was time consuming (though not strictly necessary).  Perhaps you could search the forums/google for the hardware providing your gameport and see if it isnt a hardware issue...if so pricewatch has sb 5.1 cards for perhaps $25 and if not your likely to find people who have had similar issues and hopefully a solution to get your gameport fired up

-best of luck

----------

## Schmolch

I have the same problem.

I just built a Adapter to connect my good old Competition Pro 5000 (a digital Joystick for Amiga / Atari -Computers) and now i cant get the damn Joystick-port to work (It's working in Windows).

Im using the same chipset on a Soundblaster PCI-Card.

The dmesg-output is the same and no joystick-device is created.

On the gentoo-mailinglist i found a joystick thread where someone suggests the following:

>I don't have a Soundblaster Live Value but a Creative chip (ES1371) on the 

>main board - the gameport connects to that.  I eventually got the 

>joystick (analog) working after contacting the author of the ES1371 

>driver (from /usr/linux/Documentation).  I had to use option "joystick=1" 

>when modprobing the sound chip.

>

>/etc/modules.autoload contains...

>        es1371

>/etc/modules.d/aliases contains...

>        alias sound-slot-0      es1371

>        options es1371          joystick=1

It didnt help me but maybe it helps you.

Please post if you make any progres.

----------

## Schmolch

Its Working !!!

After reading a couple of Threads on other forums i ran across the very good "Linux Joystick Mini Howto v0.11" and now it really works !   :Very Happy: 

I still dont know what Soundcard i exactly have but i know its a PCI-Card   :Wink:  and it has the ES1371 Chip.

Im using the latest Gentoo Kernel, these are the Kernel-settings i use:

Input core support --->

<*> Input Core support

<M> Joystick Support

<M> Event interface support

Character Devices --->

Joysticks --->

<*> Game port support

<M> Classic ISA/PnP gameports  

# This is strange because on other Threads i have read you dont need this module because the ES1371 handles the Gameport itself, BUT the Mini-Howto says you DO need it cause it wont work otherwise.

<M> Classic PC analog joysticks and gamepads

# Choose the modules for your Joystick here   :Wink: 

Thats all for the Kernel-Config but there is something else you need in your /etc/modules.d/aliases

Add these lines:

above input joydev ES1371 gameport

options es1371 joystick=0x200

Now i rebooted my machine with the new kernel and did

modprobe es1371 joystick=0x200

modprobe joydev

modprobe analog

Then i was running jscalibrator and guess what, YEAH the crosshair moved  :Very Happy: 

Oh and btw, lsmod shows me:

Module, Used by

analog, (unused)

joydev,

es1371,

ac97_codec, [es1371]

Hmm.. i would have expected more here.

Oh and a link to the great Mini-Howto is here http://kldp.org/~eunjea/hcol-archive/2002/apps/2002-Feb/0018.html

There are a few minor things that are not totally clear to me, but would you please excuse me now, i am sent on a mission to destroy the Planet of the Machines and restore peace and freedom for all of us!

[img:b32e8a3e97]http://www.mt-fanpage.de/jpg/katakis/ka_pic01.jpg[/img:b32e8a3e97][/img]

----------

## phypor

[img:25e5eba416]http://mylinuxisp.com/~rsi/grip_multiport.jpg[/img:25e5eba416]

I got one on ebay (10$ inc. s/h) and its truly cool.

Nothing like playing Gauntlet 2 or X-Men w/ 4 people

I followed the instructions here and they got it pretty much right on the money. 

Just a small success story of linux and game ports on a cruddy on-board ac'97 sound card.

If anyone wants more info on my setup or config just say so.

~phypor[/img]

----------

## tactless

Oh man, I just switched to ALSA so I can create MIDI  :Sad: 

That means I can't load es1731... and no, loading the modules doesn't give me a joystick now either.

----------

## tactless

Okay, switched back to OSS, and did this:

```

(unloaded all relevant modules)

modprobe es1371 joystick=0x200

modprobe joydev

modprobe input

modprobe gameport

modprobe ns558

modprobe analog js=auto

```

/dev/input/js0 is formed

dmesg output:

```

es1371: version v0.30 time 19:51:12 Jan 22 2003

PCI: Found IRQ 5 for device 00:10.0

es1371: found chip, vendor id 0x1274 device id 0x1371 revision 0x06

es1371: found es1371 rev 6 at io 0xe800 irq 5

es1371: features: joystick 0x200

ac97_codec: AC97 Audio codec, id: CRY19(Cirrus Logic CS4297A rev A)

gameport1: NS558 PnP at 0x208 speed 718 kHz

input0: Analog 3-axis 4-button joystick at gameport0.0 [TSC timer, 449 MHz clock, 1261 ns res]

```

The input0: line is accurate. However, the /dev/input/js0 device seems to be silent... neither fgjs (flightgear) or zsnes are willing to admit that I have a joystick.

----------

## nalin

 *tactless wrote:*   

> 
> 
> ...the /dev/input/js0 device seems to be silent... neither fgjs (flightgear) or zsnes are willing to admit that I have a joystick.

 

Try jstest /dev/input/js0 (jstest is in something merged, cant remeber what, try searching forums or emerge -S jstest).  If joystick is operational you should get feedback from the command line when you push axis or buttons in which case I have no idea whats wrong.  

FYI the /usr/src/linux/Doc*/input/joystick.txt file will give information about how to set up everything including args to analog (or what driver to use if there is one which handles your joystick), which, I suspect, might whats amis here...good luck

----------

