Linux laptop tips

I’m using a Compaq (not HP) Evo n410c laptop using Mandrake Linux (cooker) and frankly, its battery life are pretty poor (somehwere around 1 hour).

The problem is that the system configuration and defaults could be handled better.

The first thing to do, is install the suspend-scripts package, if you haven’t already done so, along with the acpi and acpid packages. These will give you everything you need to get full control over your laptops acpi system.

After you do that, we need to fix the configuration – open /etc/sysconfig/laptop for editing and look for the “bettery.sh” part. now change
* BATT_THR to 4. This will set the throttling behavior while on battery power to 50% instead of the default “2” which means 25%.
* BATT_HD to 4. this will set the harddisk spindown time to 20 seconds instead of the default 5 minutes. This is the major thing – the harddisk spins down faster and you save more battery. I have 512MB memory which should be enough to have the necessary applications in memory and so disk is probably not needed for most of the time.

After we fixed the configuration, we need to do some changes to the acpi script. open /etc/acpi/actions/battery.sh for editing, and find the lines that talks about /proc/acpi/processor. we need to change “CPU*” to “C*”. I guess that on most laptops, the CPU is called “CPUsomething”, but on my system its called “C000”.
Now at the bottom of the “on-line” section, right before the exit 0 line, add the following lines:

echo "Setting fan activation points"
echo "94:90:90:80:65:40" > /proc/acpi/thermal_zone/TZ1/trip_points
echo 0 > /proc/acpi/thermal_zone/TZ*/polling_frequency

Also, at the bottom of the “off-line” section, add the following lines:

echo "Setting fan activation points"
echo "94:90:90:80:65:60" > /proc/acpi/thermal_zone/TZ1/trip_points
echo 30 > /proc/acpi/thermal_zone/TZ*/polling_frequency

These change the thermal activation points for the fan on the laptop to only start when the laptop gets to 60 degrees celsius when on battery mode, while setting the fan activation point back to 40 degrees when connected to mains.
60 degrees should still be ok for cpus, but check your laptop’s manual and check what it currently is set too by running cat /proc/acpi/thermal_zone/TZ*/trip_points before you start.
Also – after you do that, take care not to rest the laptop on your lap for too long when operating on battery power – it can get real hot and we don’t want to hurt your sensitive areas – its also a good idea anyway.

You can now unplug your laptop and see that it sets the correct values, and then plug it in again and see that the correct values are set for on-line mode. You might need to have the acpid service running for this to work.

These simple steps should improve battery behavior considerably. But as always – this tip comes with absolutly no warranty and I recommend you to read your manufacturer’s manual carefully and to learn up on this issue before you mess around with things that work. If you do decide to mimick what I did, and your laptop’s CPU melt – don’t go blaming me.

2 Responses to “Linux laptop tips”

  1. RHEEDobserver:

    i have tried this suggestion on my compaq armada 1750.acpi doesnt respond on ubuntu. whether i put acpi=off on installation, or whatever there is that was suggested in the forums (combination of acpi=off, apm=off, noacpi, every combiantion) so i tried mandriva limited 2005. however, same problem, then this blog gave me another solution. it worked in a way, however.i have to reboot before the fan has to work. if you have any suggestion regarding this please feel free to email, ryxramos@gmail.com…..

  2. Guss:

    For enabling ACPI, I use acpi=ht in the kernel command line (IIUC you complained that ACPI doesn’t work when you set acpi=off ? sounds to me like this is how it should work). I also make sure that the acpi module is loaded and the acpid daemon is working.

    To make the fan start and stop manually, I do something like:
    $ for fan in /proc/acpi/fan/*/state; do echo "1" > $fan; done
    (or “0” to disable). For some reason I have 3 fans in the /proc/acpi/fan and only the last one actually does something I can see – start the CPU fan. I’m not sure what the others do, so I just loop on them as well.

    If your fan doesn’t start to work automatically when the temperature reaches the trip point (do cat /proc/acpi/thermal_zone/TZ1/trip_point to make sure what is the real trip point), then you might have some problem (hardware, software ?). If your fan doesn’t stop/start when you change the trip point to be below/above the current temperature, then thats ok – start it manually.

Leave a Reply