mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ACPI and laptop question
@ 2004-02-02 21:18 John
  2004-02-02 23:05 ` Bernd Schubert
  0 siblings, 1 reply; 2+ messages in thread
From: John @ 2004-02-02 21:18 UTC (permalink / raw)
  To: linux-kernel

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




-- 
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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ACPI and laptop question
  2004-02-02 21:18 ACPI and laptop question John
@ 2004-02-02 23:05 ` Bernd Schubert
  0 siblings, 0 replies; 2+ messages in thread
From: Bernd Schubert @ 2004-02-02 23:05 UTC (permalink / raw)
  To: John, linux-kernel

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-02 23:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-02 21:18 ACPI and laptop question John
2004-02-02 23:05 ` Bernd Schubert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®