Archive for the 'Linux' Category

Repeating key bug with USB keyboard

May 25th, 2006 | Category: Hardware, Linux

Here’s a solution for that strange repeating key glitch with your USB keyboard. You know, the one where you get repeating letters in the output when you type fast (e.g. when typing “mount” you get “mouount”).

The culprit is the usbkbd module, which is the device driver for the USB keyboard boot protocol. The boot protocol is a stripped-down version of the full USB keyboard protocol that is only supposed to be used in the system BIOS and other limited environments. The thing is, the usbhid module is perfectly capable of driving both your USB keyboard and mouse without the help of usbkbd or usbmouse.

But wait! Don’t go unloading those two modules just yet. If you do, your keyboard and mouse will drop dead. What you need to do is get rid of those two modules files and then reboot, causing the proper drivers to be loaded. Here’s what I did:

  1. Rename usbkbd.ko and usbmouse.ko in /lib/modules/x.y.z/kernel/drivers/usb/input
  2. (x.y.z is your kernel version)

  3. Build a new initrd image (which contains some drivers that are loaded at boot time):
        # cd /boot
        # mv initrd.img-x.y.z initrd.imb-x.y.z.bak
        # mkinitrd -o initrd.img-x.y.z
        
  4. Reboot and check that everything works

Just to be safe I recommend you keep and older kernel version around that you can boot with and restore the original initrd image if something goes wrong.

No comments

nForce 3 and ALSA

October 29th, 2005 | Category: Hardware, Linux

ALSA provides the nice dmix plugin for mixing multiple audio streams together so that more than one program can access a single audio device simultaneously. This is all fine and well, but unfortunately the sound card (intel8×0) on my nForce 3 board doesn’t have a supported hardware volume mixer. This means that to have a working global volume control you need to use the softvol plugin, a software volume mixer.

The idea is to first run the sound through softvol to adjust the global volume of all audio streams. After this the sound is fed into dmix for mixing, and finally the result is routed into the sound card.

Application #1 > softvol > dmix > sound card
Application #2 > softvol >
Application #3 > softvol >

Here’s an asoundrd configuration that brings it all together:

# A softvol mixer is assigned as the default audio device
pcm.!default {
  type softvol
  slave {
    pcm "dmixer"
  }
  control {
    name "PCM Volume"
    card 0
  }
}
# The dmixer device mixes multiple audio streams together
pcm.dmixer {
  type dmix
  ipc_key 12345678
  slave {
    # Change the following to "hw:0,0" to use the analog output jack
    pcm "hw:0,2"
    period_time 0
    period_size 512
    buffer_size 4096
    rate 48000
  }
  bindings {
    0 0   # from 0 => to 0
    1 1   # from 1 => to 1
  }
}
No comments

nForce 3 and DMA

January 17th, 2005 | Category: Hardware, Linux

Having trouble enabling DMA on your nForce 3 mobo?

After getting jerky DVD playback I noticed that DMA was not being enabled for my IDE DVD drive. The canonical hdparm -d1 /dev/cdrom resulted in a rude “Permission denied”.

It seems that to enable DMA, the amd74xx, ide-cd and ide-generic need to be loaded in this order, or you’ll loose DMA and end up with something like this in your system log:

NFORCE3-250: port 0x01f0 already claimed by ide0
No comments