Linux Users' Group of Davis - "Testimonials - 'es1371 and why I love open source'"


es1371 and why I love open source

Gabriel Rosa, December 15, 2001

I have an es1371 based sound card (SoundBlaster128, I believe), and my [Linux Kernel] 2.4.x joystick ride has been kinda bumpy. Some kernels would detect the joystick port, others wouldn't.

I really like having a working joystick so I can play emulated games :)

So tonight I decided that I was gonna get it working again. I inserted the es1371 module, and noticed that it read:

es1371: features: joystick 0x0

That's not right. I knew my port was somewhere in the 0x2** range. If I gave it joystick=0x200, my machine would freeze right away when trying to load the joystick module. (0x200 was the previous value I remembered).

So I looked in /usr/src/linux/drivers/sound/es1371.c, and note that the 0x2** range is not really the address, but the offset. Ok, so far nothing spectacular, just an understanding that my machine hangs because I try to use the soundcard like a joystick ;)

So after some tinkering and printk'ing some values out, I realize that since I wasn't giving a joystick offset, the es1371 driver was skipping right over the joystick code. In reality, (after a bit of looking around) I believe that it only tries to autodetect if there are more than 1 game ports. (Also, the code has a catch for 0x200, since it seems to be a common offset for the gameport). Otherwise, it doesn't even turn the port on.

Luckily, I'm staring right at the code, and I think i understand it ok. So I added an 'else'-clause to the gameport init. code that probes 0x200-0x218 (the documented offset range), and then printk's the probed value.

A prayer to the penguin god, a 'rmmod es1371' and an 'insmod 1371' later and I'm looking at:

es1371: found chip, vendor id 0x1274 device id 0x1371 revision 0x07
es1371: debug -> found 0x218.
ac97_codec: AC97 Audio codec, id: 0x8384:0x7608 (SigmaTel STAC9708)
es1371: found es1371 rev 7 at io 0xe400 irq 5
es1371: features: joystick 0x218

Aha, so my port must have slid over to 0x218, probably due to some small change somewhere else that initialized my hardware differently.

Anyway, so I got it working.

What really makes me sing is that something didn't work, yet because I wanted it to work, and I had the guts to go in and change stuff, it now works.

Now, if I were running Windows and my joystick didn't work, what are the chances that:

I don't think so.

-Gabe has free time after finals, many games to finish

LUGOD: PO Box 1336, Davis, CA 95617

Last updated: 2001 Dec 18 16:07