musings on java and object oriented software development

Thursday, October 19, 2006

PowerBook narcolepsy issue hack

A few months ago, when doing some photo editing, I noticed that my 1-year-old PowerBook G4 1.67 was a bit sluggish. So I had a look at the available RAM on the machine and sure enough the maximum RAM reported was 512MB, rather than the 1GB that I had installed. I had a look at the memory slots in the System Profiler and one of the memory banks indicated that it was empty.

After a bit of research I found that this was a fairly common problem and Apple were repairing the problem free of charge. So I sent it to a local shop and got it fixed. ( The fix, it turns out, is to replace the Logic Board).

About a week later, my laptop suddenly went to sleep with out warning. It would wake, when you hit the keys, then go back to sleep soon after. Eventually the only way to get it awake was to pull out the battery and power cord. After this cold reboot (which was irritating because you had to reset the clock all the time), it would work fine for an hour or so then the pattern would repeat it self.

I searched about the issue and found that it is a problem with the Trackpad temperature sensor on the PowerBook. The sensor would sporadically display 100+ degrees C, causing the system to think it will melt if it doesn't shut down. The system.log will show a message "Power Management received emergency overtemp signal." prior to it going to sleep.

Very frusted, I searched on the net and tried various remedies which involved removing Kernel Extensions that monitor the temperature of the trackpad. I don't think these extensions actually stop anything, just allow third-party apps to read the temperature sensors, because the fixes didn't make any difference.

After trying all of the fixes, I thought I'd take matters into my own hands (a hardware repair was out of the question because the laptop is out of warranty), so I downloaded the mach kernel source, found the block of code that sleeps after displaying the "emergency overtemp signal" message and commented it out. After rebuilding the kernel, I pointed Open Firmware to the new kernel and rebooted.

I wouldn't recommend anybody doing this because it is potentially very dangerous!. You might ignore real overtemp signals, your PowerBook could catch on fire!

Several minutes after the restart I got the dreaded "emergency overtemp signal" message twice within seconds of each other, while watching the temperature of the trackpad with the very handy app "Temperature Monitor". Because I had commented out the sleep code, the system did not sleep. The temperature of the trackpad temporarily went to 102.5 C, then back to a cool 37 C.

Problem solved ! In future I will change the code so that it is safer, i.e. keep a history of the fluctuation so that random 100+ degress C temperatures can be put in some perspective and only ignoring overtemp signals coming from the Trackpad.