This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

handler.sh

By: kwikshot on Mar 4th, 2012  |  syntax: Bash  |  size: 1.82 KB  |  views: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2. # Default acpi script that takes an entry for all actions
  3.  
  4. minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
  5. maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
  6. setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
  7.  
  8. set $*
  9.  
  10. case "$1" in
  11.     button/power)
  12.         #echo "PowerButton pressed!">/dev/tty5
  13.         case "$2" in
  14.             PBTN|PWRF)  logger "PowerButton pressed: $2" ;;
  15.             *)          logger "ACPI action undefined: $2" ;;
  16.         esac
  17.         ;;
  18.     button/sleep)
  19.         case "$2" in
  20.             SLPB)   echo -n mem >/sys/power/state ;;
  21.             *)      logger "ACPI action undefined: $2" ;;
  22.         esac
  23.         ;;
  24.     ac_adapter)
  25.         case "$2" in
  26.             AC|ACAD|ADP0)
  27.                 case "$4" in
  28.                     00000000)
  29.                         echo -n $minspeed >$setspeed
  30.                         #/etc/laptop-mode/laptop-mode start
  31.                     ;;
  32.                     00000001)
  33.                         echo -n $maxspeed >$setspeed
  34.                         #/etc/laptop-mode/laptop-mode stop
  35.                     ;;
  36.                 esac
  37.                 ;;
  38.             *)  logger "ACPI action undefined: $2" ;;
  39.         esac
  40.         ;;
  41.     battery)
  42.         case "$2" in
  43.             BAT0)
  44.                 case "$4" in
  45.                     00000000)   #echo "offline" >/dev/tty5
  46.                     ;;
  47.                     00000001)   #echo "online"  >/dev/tty5
  48.                     ;;
  49.                 esac
  50.                 ;;
  51.             CPU0)      
  52.                 ;;
  53.             *)  logger "ACPI action undefined: $2" ;;
  54.         esac
  55.         ;;
  56.     button/lid)
  57.         #echo "LID switched!">/dev/tty5
  58.         /usr/sbin/pm-suspend
  59.         esac
  60.         ;;
  61.  
  62.     *)
  63.         logger "ACPI group/action undefined: $1 / $2"
  64.         ;;
  65. esac
clone this paste RAW Paste Data