default.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. # /etc/acpi/default.sh
  3. # Default acpi script that takes an entry for all actions
  4. set $*
  5. group=${1%%/*}
  6. action=${1#*/}
  7. device=$2
  8. id=$3
  9. value=$4
  10. log_unhandled() {
  11. logger "ACPI event unhandled: $*"
  12. }
  13. case "$group" in
  14. jack)
  15. case "$id" in
  16. 'plug')
  17. amixer -D hw:0 cset name='Left Speaker Mixer Left DAC Switch' off
  18. amixer -D hw:0 cset name='Right Speaker Mixer Right DAC Switch' off
  19. amixer -D hw:0 cset name='Headphone Switch Left' on
  20. amixer -D hw:0 cset name='Headphone Switch Right' on
  21. ;;
  22. 'unplug')
  23. amixer -D hw:0 cset name='Left Speaker Mixer Left DAC Switch' on
  24. amixer -D hw:0 cset name='Right Speaker Mixer Right DAC Switch' on
  25. amixer -D hw:0 cset name='Headphone Switch Left' off
  26. amixer -D hw:0 cset name='Headphone Switch Right' off
  27. ;;
  28. *) uhd $+;;
  29. esac
  30. log_unhandled $*
  31. ;;
  32. button)
  33. case "$action" in
  34. #power)
  35. #pm-suspend
  36. # log_unhandled $*
  37. # ;;
  38. lid)
  39. case "$id" in
  40. close) if [ $(cat /sys/class/power_supply/gpio-charger/online) -eq 0 ]; then
  41. pm-suspend
  42. fi;;
  43. open) :;;
  44. *) uhd $*;;
  45. esac
  46. log_unhandled $*
  47. ;;
  48. *) log_unhandled $* ;;
  49. esac
  50. ;;
  51. *) log_unhandled $* ;;
  52. esac