Archive for April, 2007

How to make ThinkPad volume keys work properly in Kubuntu

Monday, April 2nd, 2007

I really like Ubuntu. I mean, I really, really like it. But it exhibits one really irritating behaviour on most IBM/Lenovo ThinkPads. You see, ThinkPads (except for some in the R series) have a hardware sound mixer, and the volume control buttons operate the mixer directly in hardware, without any interaction from the operating system. This is unusual; most other laptops have software buttons which the OS must interpret and use to control the software mixer.

Now, on most distributions, I would just run tpb, and it gives a little on-screen display when I press one of the buttons. Ubuntu, however, is different. It has a special hotkeys subsystem which interprets the button presses on all sorts of laptops and passes them to a generic control program. Unfortunately, this system doesn’t know that the ThinkPad interprets the keys on its own; so every time you press a volume key, it gets interpreted in hardware and in software. This is really irritating, because the volume jumps in huge steps every time you press the button. And if you change the volume in software, they get out of sync and it all gets really complicated.

The appropriate behaviour, of course, would be to just display a notification without changing the software mixer’s volume; and I hope the Ubuntu folks will eventually implement this. For the meanwhile, anyway, there is a fix at least for Kubuntu. (Sorry, GNOME users, I don’t know what the equivalent solution is for you).

  1. Install the package kmilo-legacy.
  2. Arrange to have read access to the device /dev/nvram. On Feisty, at least, this required setting up a custom udev rule by creating a file /etc/udev/rules.d/50-user-custom.rules with contents KERNEL=="nvram", MODE="0664" and running chmod 0664 /dev/nvram to fix the permissions without rebooting.
  3. Run kcmshell thinkpad, and then tick the “Run Thinkpad Buttons KMilo Plugin” option and untick the “Change volume in software” option.
  4. Remove the file /usr/share/services/kmilo/kmilo_generic.desktop. (Or move it somewhere else, or rename it to something that doesn’t end in .desktop, or whatever else will stop KDE from seeing it.)
  5. Log out and log in again.
  6. Voila!

One useful side effect is that you will now get on-screen notifications when the other ThinkPad special buttons – like the brightness controls, the ThinkLight button, and so on – are pressed.

Another reason I can’t use Windows

Monday, April 2nd, 2007

This is a rant. It’s, hopefully, not a biased Linux fanboy rant; rather, it is a reasonable description of yet another problem with Microsoft Windows. The problem is CPU scheduling. Windows’ CPU scheduler simply can’t cope properly with running CPU-intensive processes concurrently with interactive processes. A few days ago, I was in Windows with iTunes ripping a CD and encoding to AAC, and I was trying to surf the web simultaneously. It was impossible; Internet Explorer was completely unresponsive – it would take several minutes from clicking on the “new tab” button to seeing a new tab appear.

Later that day I was doing the same thing, but in Linux – using Banshee to rip and encode the same CD to AAC (I would use OGG if I didn’t have an iPod). I was also surfing the web with Epiphany, and there was no noticeable slowdown in the web browser. No doubt the ripping/encoding process took a little longer because of the CPU time provided to other processes; but I imagine that most users would rather have their backround tasks take a little longer in return for being able to carry on using the computer while they run.

This is something where Linux really excels: the scheduler is really very good. Windows’ is simply pathetic, and completely unsuited for an interactive system (which doesn’t really make sense, since Windows has never been used as a batch system, as far as I know!).