summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-power/acpid/files/acpid-1.0.6-examples.diff')
-rw-r--r--sys-power/acpid/files/acpid-1.0.6-examples.diff116
1 files changed, 116 insertions, 0 deletions
diff --git a/sys-power/acpid/files/acpid-1.0.6-examples.diff b/sys-power/acpid/files/acpid-1.0.6-examples.diff
new file mode 100644
index 000000000000..5a8e21ff3603
--- /dev/null
+++ b/sys-power/acpid/files/acpid-1.0.6-examples.diff
@@ -0,0 +1,116 @@
+diff -Nur acpid-1.0.6.orig/examples/ac acpid-1.0.6/examples/ac
+--- acpid-1.0.6.orig/examples/ac 1970-01-01 01:00:00.000000000 +0100
++++ acpid-1.0.6/examples/ac 2007-07-16 19:37:35.000000000 +0200
+@@ -0,0 +1,11 @@
++# /etc/acpid/events/ac
++# This detects changes to AC power status, and passes them to
++# /etc/acpi/ac.sh for further processing.
++
++# Optionally you can specify the placeholder %e. It will pass
++# through the whole kernel event message to the program you've
++# specified.
++
++event=ac_adapter
++action=/etc/acpi/ac.sh
++
+diff -Nur acpid-1.0.6.orig/examples/ac.sh acpid-1.0.6/examples/ac.sh
+--- acpid-1.0.6.orig/examples/ac.sh 1970-01-01 01:00:00.000000000 +0100
++++ acpid-1.0.6/examples/ac.sh 2007-07-16 19:37:35.000000000 +0200
+@@ -0,0 +1,39 @@
++#!/bin/sh
++# /etc/acpid/ac.sh
++# Detect loss of AC power and regaining of AC power, and take action
++# appropriatly.
++
++# On my laptop anyway, this script doesn't not get different parameters for
++# loss of power and regained power. So, I have to use a separate program to
++# tell what the adapter status is.
++
++# This uses the spicctrl program for probing the sonypi device.
++BACKLIGHT=$(spicctrl -B)
++
++if on_ac_power; then
++ # Now on AC power.
++
++ # Tell longrun to go crazy.
++ longrun -f performance
++ longrun -s 0 100
++
++ # Turn up the backlight unless it's up far enough.
++ if [ "$BACKLIGHT" -lt 108 ]; then
++ spicctrl -b 108
++ fi
++else
++ # Now off AC power.
++
++ # Tell longrun to be a miser.
++ longrun -f economy
++ longrun -s 0 50 # adjust to suite..
++
++ # Don't allow the screen to be too bright, but don't turn the
++ # backlight _up_ on removal, and don't turn it all the way down, as
++ # that is unusable on my laptop in most conditions. Adjust to
++ # taste.
++ if [ "$BACKLIGHT" -gt 68 ]; then
++ spicctrl -b 68
++ fi
++fi
++
+diff -Nur acpid-1.0.6.orig/examples/default acpid-1.0.6/examples/default
+--- acpid-1.0.6.orig/examples/default 1970-01-01 01:00:00.000000000 +0100
++++ acpid-1.0.6/examples/default 2007-07-16 19:37:35.000000000 +0200
+@@ -0,0 +1,18 @@
++# 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
+diff -Nur acpid-1.0.6.orig/examples/default.sh acpid-1.0.6/examples/default.sh
+--- acpid-1.0.6.orig/examples/default.sh 1970-01-01 01:00:00.000000000 +0100
++++ acpid-1.0.6/examples/default.sh 2007-07-16 19:37:35.000000000 +0200
+@@ -0,0 +1,32 @@
++#!/bin/sh
++# Default acpi script that takes an entry for all actions
++
++set $*
++
++# Take care about the way events are reported
++ev_type=`echo "$1" | cut -d/ -f1`
++if [ "$ev_type" = "$1" ]; then
++ event="$2";
++else
++ event=`echo "$1" | cut -d/ -f2`
++fi
++
++
++case "$ev_type" in
++ button)
++ case "$event" in
++ power)
++ logger "acpid: received a shutdown request"
++ /sbin/init 0
++ break
++ ;;
++ *)
++ logger "acpid: action $2 is not defined"
++ ;;
++ esac
++ ;;
++
++ *)
++ logger "ACPI group $1 / action $2 is not defined"
++ ;;
++esac