Jan's Linux Log

This blog started out as an install log of RedHat 9 on a Compaq Presario 2538cl laptop (linuxpresario.blogspot.com) . However, I soon started to include little logs to myself when I made configuration changes to software, etc. So, I've moved it over to our domain, and changed its name to Linux Log. Here you will find some tips & tricks related to Linux configuration on a laptop, as well as software related things that I run into. I log here things that worked for me, of course, your mileage may vary.

Any questions/comments? E-mail me at linux_atsign_boshoff|za|net.

« September 2003 | Main | November 2003 »

October 2003

Hibernate using acpid

October 29, 2003

I've written a little script to hibernate when I hit the power button. On my laptop, everytime you hit the power button it registers two power button events in the acpid log. So I needed to work around it a little, to prevent two consecutive suspend-resume cycles everytime I hit the power. In /etc/acpi/events I have a script "power", which has:

# This is a sample ACPID configuration

event=button[ /]power
#action=sudo /usr/local/sbin/hibernate
action=/etc/acpi/events/start_suspend.sh %e

The %e passes the full entry of the acpi event to the script. I'm not using this yet. Here's the start_suspend.sh script:

#!/usr/bin/perl
$DIR = "/etc/acpi/events";

$counter=`cat $DIR/buttoncounter | bc`;

if ( $counter == 0 ) {
# First button event, suspend computer

$out = `echo 1 > /etc/acpi/events/buttoncounter`;
$out = `sudo /usr/local/sbin/hibernate` || die "Unable to start hibernating: $!";

} else {
# Second button event, insert usb controller module

$out = `echo 0 > /etc/acpi/events/buttoncounter`;

}

What's nice about it is that it makes it easy to run additional things upon resume. I don't need this yet, but I can see how sometimes one would want to do this. As you can tell, it's basically a work-around for my dual-acpi-event-when-power-button-is-pressed problem.

Working swsusp kernel

October 29, 2003

I now have a working 2.4.22 kernel with Software Suspend turned on! No firewire yet, but I don't need this yet, so I'm not messing around with it. My configuration file is available as well:

Download file

USB Hotplug

October 23, 2003

I've noticed that a software resume causes my USB mouse to stop functioning. This is because /etc/hotplug/usb.agent cannot effectively start the drivers required by the mouse when it's plugged into the usb port. Mmmm, annoying, since I rely on the mouse pretty heavily for work. Until I've resolved this, software suspend becomes pretty much useless to me...

[2003-10-29] RESOLVED. Turns out that this problem dissapears if I use the uhci module instead of usb-uhci. The uhci is the alternative host controller driver that one can compile in the kernel. Now it works well! You can download my current 2.4.22swsusp kernel configuration file here.
To make sure that /etc/rc.d/rc.sysinit loads the appropriate driver, I needed to change the file /etc/modules.conf:

WAS: alias usb-controller1 usb-uhci
NOW: alias usb-controller1 uhci

Software Suspend Setup

October 22, 2003

Installed the suspend.sh script today by downloading it from the swsusp mailing list. (Check out the software suspend site).

Then ran suspend.sh --install. Also, since I'd like to be able to suspend without becoming root, I edited /etc/sudoers, and added:

Host_Alias LOCALHOST=localhost,teleo.che.udel.edu
ALL LOCALHOST=NOPASSWD: /usr/local/sbin/hibernate *

It appears to work right off the bat. Woa! It's pretty cool, and definitely cuts down on boot-up and shutdown time. It's really cool not to have to close all windows before turning off the laptop either. I hooked up software suspension to be activated when I press the power button on the laptop: File /etc/acpi/events/power:

event=button[ /]power
action=sudo /usr/local/sbin/hibernate

2.4.22 Kernel

October 09, 2003

I decided to give the kernel.org kernels a shot, instead of using Red Hat's kernels. Here's the log of how I set up the kernel.

This post will now supersede that of May 26th.

The kernel as configured with RedHat's .config file results in a hang on start-up at kudzu. The way around this for me was to disable firewire support. Since I've not needed this in Linux yet, I'll not worry about it for now. Maybe I can get it to work later.

Now it's a matter of getting Software Suspend to work, I haven't tried yet. It will have to wait until I have some time!