public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: John Belmonte <jvb-ZFKsivP1bGvOQU1ULcgDhA@public.gmane.org>
To: acpi-devel <acpi-devel-pyega4qmqnRoyOMFzWx49A@public.gmane.org>
Subject: Re: display interface?
Date: Thu, 05 Sep 2002 23:31:54 +0900	[thread overview]
Message-ID: <3D776ADA.3060202@prairienet.org> (raw)
In-Reply-To: 200209050826.g858QYX07834@mailgate5.cinetic.de

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

joerg.beyer-htSm2yLGOjU@public.gmane.org wrote:
> If my assumtion is correct: has anybody an example of how
> to configure acpid to do "something" when the AC adapter is plugged
> in or out?

On battery power, I slow down the cpu, set the hard disk to spin down 
quickly, and lower the LCD brightness.  Attached are the scripts involved:

     /etc/acpi/events/default
     /etc/acpi/default.sh
     /usr/local/sbin/libretto-ac_adapter

-John



-- 
http:// i      .   /

[-- Attachment #2: default --]
[-- Type: text/plain, Size: 630 bytes --]

# This is the ACPID default configuration, it takes all
# events and passes them to /etc/acpi/default.sh for further
# processing.

# event keeps a regular expression matching the event. To get
# power events only, just use something like "event=button power.*"
# to catch it.
# action keeps the command to be executed after an event occurs
# In case of the power event above, your entry may look this way:
#event=button power.*
#action=/sbin/init 0

# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.

event=.*
action=/etc/acpi/default.sh %e

[-- Attachment #3: default.sh --]
[-- Type: application/x-sh, Size: 342 bytes --]

[-- Attachment #4: libretto-ac_adapter --]
[-- Type: text/plain, Size: 951 bytes --]

#!/usr/bin/python

# call longrun and hdparm based on acpi ac adapter status
# John Belmonte <jvb-ZFKsivP1bGvOQU1ULcgDhA@public.gmane.org>

import sys
import re
import commands

device_num = sys.argv[1]
status_name = "/proc/acpi/ac_adapter/%s/status" % device_num

status_file = open(status_name)
status = status_file.read()
status_file.close()

def command(s):
    commands.getstatusoutput(s)

is_off_line = re.search("off-line", status)
# NOTE: hdparm sleep settings seem to trump noflushd
# ISSUE: longrun doesn't like -f and -s at the same time
if is_off_line:
    command("longrun -s 0 30")
    command("longrun -f economy")
    command("hdparm -S 4 /dev/hda") # 20 second sleep timeout
    command("echo 'brightness:1' > /proc/acpi/toshiba/lcd")
else:
    command("longrun -s 0 100")
    command("longrun -f performance")
    command("hdparm -S 48 /dev/hda") # 4 minute sleep timeout
    command("echo 'brightness:6' > /proc/acpi/toshiba/lcd")


  parent reply	other threads:[~2002-09-05 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-05  8:26 Re: display interface? joerg.beyer-htSm2yLGOjU
     [not found] ` <200209050826.g858QYX07834-pb599fR3TxVkExQqqHjIK3sFFmKitW5W@public.gmane.org>
2002-09-05  8:47   ` Charl P. Botha
2002-09-05 14:31 ` John Belmonte [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-09-04 11:57 joerg.beyer-htSm2yLGOjU
2002-09-05  2:54 ` John Belmonte
     [not found]   ` <3D76C770.40807-ZFKsivP1bGvOQU1ULcgDhA@public.gmane.org>
2002-09-05  3:21     ` takawata-l7ZBCLq5RC066kwqclu8Pg

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=3D776ADA.3060202@prairienet.org \
    --to=jvb-zfksivp1bgvoqu1ulcgdha@public.gmane.org \
    --cc=acpi-devel-pyega4qmqnRoyOMFzWx49A@public.gmane.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