daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # Default acpi script that takes an entry for all actions
  3.  
  4. # NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
  5. #       modify it to not use /sys
  6.  
  7. minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
  8. maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
  9. setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
  10.  
  11. set $*
  12.  
  13. echo "$1 $2" >> /home/felix/suspendlog.log
  14.  
  15. case "$1" in
  16.     button/power)
  17.         #echo "PowerButton pressed!">/dev/tty5
  18.         case "$2" in
  19.             PWRF)   logger "PowerButton pressed: $2"
  20.             /usr/sbin/pm-suspend
  21.             ;;
  22.             *)      logger "ACPI action undefined: $2" ;;
  23.         esac
  24.         ;;
  25.     button/sleep)
  26.         case "$2" in
  27.             SLPB)   echo -n mem >/sys/power/state ;;
  28.             *)      logger "ACPI action undefined: $2" ;;
  29.         esac
  30.         ;;
  31.     ac_adapter)
  32.         case "$2" in
  33.             AC)
  34.                 case "$4" in
  35.                     00000000)
  36.                         echo -n $minspeed >$setspeed
  37.                         #/etc/laptop-mode/laptop-mode start
  38.                     ;;
  39.                     00000001)
  40.                         echo -n $maxspeed >$setspeed
  41.                         #/etc/laptop-mode/laptop-mode stop
  42.                     ;;
  43.                 esac
  44.                 ;;
  45.             *)  logger "ACPI action undefined: $2" ;;
  46.         esac
  47.         ;;
  48.     battery)
  49.         case "$2" in
  50.             BAT0)
  51.                 case "$4" in
  52.                     00000000)   #echo "offline" >/dev/tty5
  53.                     ;;
  54.                     00000001)   #echo "online"  >/dev/tty5
  55.                     ;;
  56.                 esac
  57.                 ;;
  58.             CPU0)  
  59.                 ;;
  60.             *)  logger "ACPI action undefined: $2" ;;
  61.         esac
  62.         ;;
  63.     button/lid)
  64.         #echo "LID switched!">/dev/tty5
  65.     echo "LID switched, \$2: $2" >> /home/felix/suspendlog.log
  66.         ;;
  67.     *)
  68.         logger "ACPI group/action undefined: $1 / $2"
  69.         ;;
  70. esac
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top