mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jgluckca@netscape.net (John)
To: linux-kernel@vger.kernel.org
Subject: ACPI and laptop question
Date: Mon, 02 Feb 2004 16:18:27 -0500	[thread overview]
Message-ID: <182E8021.2C94112E.009D6C5C@netscape.net> (raw)

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.

             reply	other threads:[~2004-02-02 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-02 21:18 John [this message]
2004-02-02 23:05 ` Bernd Schubert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=182E8021.2C94112E.009D6C5C@netscape.net \
    --to=jgluckca@netscape.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®