summaryrefslogtreecommitdiffstats
path: root/acpihandler
diff options
context:
space:
mode:
authorRaghavendra D Prabhu <raghu.prabhu13@gmail.com>2011-03-13 00:24:47 +0530
committerRaghavendra D Prabhu <raghu.prabhu13@gmail.com>2011-03-13 00:24:47 +0530
commit5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a (patch)
treedeabb15393558ab3a1a629fc0782d8b0c3124c48 /acpihandler
downloadScripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.gz
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.bz2
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.zip
Initial scripts update
Diffstat (limited to 'acpihandler')
-rwxr-xr-xacpihandler66
1 files changed, 66 insertions, 0 deletions
diff --git a/acpihandler b/acpihandler
new file mode 100755
index 0000000..6616d6f
--- /dev/null
+++ b/acpihandler
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Default acpi script that takes an entry for all actions
+
+# NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
+# modify it to not use /sys
+
+minspeed=`cat /sys/devices/system/cpu/cpufreq/ondemand/cpuinfo_min_freq`
+maxspeed=`cat /sys/devices/system/cpu/cpufreq/ondemand/cpuinfo_max_freq`
+setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
+
+set $*
+echo "$@" >> /home/raghavendra/logs/acpid.log
+
+case "$1" in
+ button/power)
+ #echo "PowerButton pressed!">/dev/tty5
+ case "$2" in
+ PWRF) logger "PowerButton pressed: $2" ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/sleep)
+ case "$2" in
+ SLPB) echo -n mem >/sys/power/state ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ ac_adapter)
+ case "$2" in
+ AC)
+ case "$4" in
+ 00000000)
+ echo -n $minspeed >$setspeed
+ #/etc/laptop-mode/laptop-mode start
+ ;;
+ 00000001)
+ echo -n $maxspeed >$setspeed
+ #/etc/laptop-mode/laptop-mode stop
+ ;;
+ esac
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ battery)
+ case "$2" in
+ BAT0)
+ case "$4" in
+ 00000000) #echo "offline" >/dev/tty5
+ ;;
+ 00000001) #echo "online" >/dev/tty5
+ ;;
+ esac
+ ;;
+ CPU0)
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/lid)
+ logger -p user.info "Lid closed"
+ ;;
+ *)
+ logger -p user.err "ACPI group/action undefined: $1 / $2"
+ ;;
+esac