Unchecking “Disable touchpad while typing” doesn’t work in Ubuntu Karmic after upgrade

After upgrading my system from Ubuntu Jaunty 9.04 to Ubuntu Karmic 9.10 unchecking the “Disable touchpad while typing” option in System > Preferences > Mouse > Touchpad doesn’t work as expected. I don’t want the touchpad to be disabled when typing since that also makes it hard to CTRL-click which I do a lot in Eclipse.

After some digging I found that someone had reported a related bug in Launchpad. Apparently syndaemon, which controls how the touchpad behaves while using the keyboard, can be told not to disable the touchpad when modifier keys like CTRL are pressed using -k switch when started. The syndaemon process is started by the gnome-settings-daemon process. gnome-settings-daemon is a C program which I don’t want to have to modifiy to add the -k switch. Instead I added the following script in /usr/local/bin:


/usr/bin/syndaemon -k $@

By naming this script syndaemon it will be used by gnome-settings-daemon instead of /usr/bin/syndaemon. The script starts the real syndaemon process and adds the -k parameter to any of the parameters specified by gnome-settings-daemon.

Debugging MySQL queries

Here’s how to temporarily enable logging of all statements sent to MySQL:

set global general_log_file='/tmp/queries.log';
set global general_log=1;

This will log all queries to /tmp/queries.log. To disable logging do:

set global general_log=0;

NOTE: This only works in MySQL 5.1+.

Fixing a bad backlight on an IBM ThinkPad R32

Recently I bought an old ThinkPad R32 on Tradera, the Swedish equivalent of EBay. The plan is to use this laptop as the basis of a DIY tablet-PC project.

Anyway, I got the laptop cheap because the LCD panel was broken. The LCD displayed an image but it was very dark, a classic backlight problem. After a bit of googling around I found out that either the CCFL (Cold cathode fluorescent lamp) or the LCD inverter could be the cause of the problem. The CCFL is basically a lamp which illuminates the LCD pixels from the backside while the inverter is a circuit board which supplies the CCFL with the correct voltage.

Replacing a CCFL seems very complicated while replacing the LCD inverter is trivial, at least on this particular ThinkPad model. According to Google the most common cause of backlight problems is the inverter. To confirm that this was the case I ripped the LCD panel out of my old ThinkPad A20m and connected it to the inverter in the R32. I figured that if the R32’s CCFL was broken the A20m’s LCD panel would light up when I plugged it in. It didn’t light up but I did see the same very dark Thinkpad logo during the BIOS initalization so I concluded that the inverter was the problem. After a quick search on EBay I found a new inverter for $30 including shipping to Sweden.

The disassembled ThinkPad A20m (left) and R32 (right)
The new inverter has been installed
The inverter is located below the panel
The new inverter
The new inverter

When the inverter arrived after about a week I followed the instructions over at Laptop Repair to replace the old one. Unfortunately, nothing happened when I turned on the laptop. What Laptop Repair fails to mention is that, at least with ThinkPads, you may have to run a program which updates an EEPROM chip on the inverter after it has been connected. This EEPROM stores the id (manufacturer and size) of the panel connected to it. If the wrong id is set or no id is set at all the panel will stay black.

It took me a while to find this information in the ThinkPad R32 Series Hardware Maintenance Manual:

System board/LCD/Inverter replacement notice
Restoring the LCD panel ID
The EEPROM on the inverter stores its supported LCD type ID code. If you replace a LCD with one of a different brand or use a new inverter, the ID information in the inverter EEPROM should be updated.
Follow the steps blew to set the LCD panel ID:
1. Install the ThinkPad Maintenance Diskette and restart
the computer.
2. When the IBM logo is displayed, press the ′′ESC′′ key
few times until BIOS copyright and diagnostics screen
3. Select 1. LCD Panel ID Utility from the main menu.
4. Follow the instruction on screen to read current or to
set new LCD Panel ID code.
5. Restart computer : the new LCD should work normally.

I quickly found the ThinkPad Maintenance Diskette. Then I spent hours and hours trying to get it to boot from a USB memory stick. According to the forums I’ve read this disk MUST be booted from a floppy drive (it can be a USB floppy drive). The forum posts say that making a bootable CD out of it will not let you write to the EEPROM. Since I don’t have a USB floppy drive at my disposal I tried for days to get the floppy image onto a memory stick and fool the ThinkPad into believing that the memory stick was a floppy disk. It’s supposed to be possible. I finally gave up and bought a USB floppy drive on Tradera.

Now I was finally able to boot the damn disk using the floppy drive but it didn’t seem to be the right disk. No such thing as “1. LCD Panel ID Utility” turned up in the menu. After a bit of more googling I discovered that the maintenance manual was incorrect. I should have used the so called ThinkPad CE Utility Diskette instead. Thank you IBM!

After a couple of hours I managed to find the correct version of the CE Utility Diskette for the R32 ThinkPad model (this link was of great help). First I ran the LCD Panel Utility with the old inverter in place to get the correct LCD Panel ID. Then I replaced the inverter and ran the utility again to set the correct LCD Panel ID. And now, finally, the backlight works great!

First boot up after the panel ID has been set
First boot up after the panel ID has been set

Creating a bootable CD from a floppy image in K3b

What do you do if you need to boot your laptop from a floppy image when all you have is a CD/DVD reader? Turns out this is really simple using K3b. All you have to do is to select New Data CD Project and then go to Project -> Edit Boot Images in the menu. Click New… and select the floppy image. Burn the CD and you will have a bootable CD.

Mime4j used by Android’s e-mail client

It just came to my attention that Google uses Mime4j in the e-mail client which is part of Android. The Mime4j project was initiated by myself and Joe Cheng and was initially hosted at Sourceforge.net. At Trillian we use it in SpamDrain to scan e-mail messages for spam and viruses.

The Mime4j project was later moved to Apache and is now a subproject of the Apache James project. Sadly, I haven’t had time lately to be as involved in the project as I once was. However, it seems as if Google is using a very old version of Mime4j. My Sourceforge.net username (ntherning) is still all over the source code :-) .

Seriously, I hope they will upgrade to a more recent version of Mime4j soon. A lot has happened with the code after some of the extremely talented people of the Apache James project got their hands on the code.

Java, SecureRandom and /dev/random gotchas

After running flawlessly for several months a Java server applications we’re using in SpamDrain started to lock up very frequently. A thread dump taken during such a lock up revealed that all the handler threads were stuck inside a call to java.security.SecureRandom.nextInt(). By reading the source code of the SHA1PRNG SecureRandom implementation I figured out that it uses /dev/random under Linux for its source of random numbers. This was the cause of the lock ups.

Continue reading

Ubuntu — now also in liquid form

Just had my first one and it tastes great! Didn’t know that there was such a thing until I happened to see a bunch of them at Coop Konsum Avenyn in Gothenburg. I bought the last three they had! :)

BTW, It’s got nothing to do with my favorite linux distribution expect for the name and the fact that, just like the guys doing Ubuntu Linux, the people behind Ubuntu Cola is trying to make the world a better place.

Getting the mic working on a Dell Dimension 5000 running Ubuntu 8.04

I’ve been trying hard to get the microphone working on my wife Jenny’s old Dell Dimension 5000 running Ubuntu 8.04. Google wasn’t much help I’m afraid. I finally figured out, after lots of trial and error, that I had to set the option Surround Jack Mode in the Gnome Mixer to the value Independent to get the mic working. Skype seems to be working fine now. Next challenge will be to find a web cam that works…

For your reference, here’s the full output I get when running amixer: Continue reading