ACPI and laptop question
Hi
My first time posting here...
I have a problem that I'm trying to find a solution to...
When Linux starts, the startup script checks to see if the filesystem is due to be checked. If I'm running on AC, it's fine to check the filessystem. However, on batteries, I want to prevent the check from happening.
I'm running a 2.6 series kernel.
Once everything is up and ruuning, the /proc filesystem is mounted and I could do something like this in a script:
# If runninng on batteries, /proc/acpi/ac_adapter/ACAD/state
# will have a line that reads: "state: off-line" # We use this to avoid a fsck if on batteries. # The next time we go to AC power, the fsck will get done.
if [ -f /proc/acpi/ac_adapter/ACAD/state ]; then
ac_state=$(grep -o 'off-line' /proc/acpi/ac_adapter/ACAD/state)
echo "AC adapter is $ac_state"
else
echo "AC adapter state file not found"
fi
Unfortunately, the root filesystem check is done before /proc is mounted, so that won't work.
Next I looked at the kernel files to see what it does. I founnd a include/linux/acpi.h which seems to interface with the ACPI subsystem but I can't seem to find any doc on this.
I poked around in the kernel and found various functions driver/acpi/ac.c but I don't think these are avialable as system calls. So.. I can't write a C program to get the ac adapter state.
If anyone cann tell me how to get the ac adapter state __before__ /proc is mounted it would be greatly appreciated.
Please cc my e-mail as I'm not subscribed to this list.
Thanks
John
Signature · 13 lines
The past is history The future is a mystery Now is a gift That's why it's called the present __________________________________________________________________ New! Unlimited Netscape Internet Service. Only $9.95 a month -- Sign up today at http://isp.netscape.com/register Act now to get a personalized email address! Netscape. Just the Net You Need.
Quoted 2 lines
Unfortunately, the root filesystem check is done before /proc is mounted, so that won't work.
But the root filesystem is checked from a script. So you would only need to change that script to mount /proc before performing the check.
Cheers,
Bernd