Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Macbook Air 6,2 power management script
- # copy to /etc/pm/power.d/99macbookair and chmod +x
- #
- #
- # @param $1 idVendor
- # @param $2 idProduct
- # @param $3 type of powercontrol (on|auto)
- #
- set_usb_power_control()
- {
- for dev in /sys/bus/usb/devices/* ; do
- if [ -e $dev/idVendor -a \
- -e $dev/idProduct -a \
- -e $dev/power/control ] ; then
- if [ x`cat $dev/idVendor` = x$1 -a \
- x`cat $dev/idProduct` = x$2 ] ; then
- echo Setting $dev to $3
- echo $3 > $dev/power/control
- fi
- fi
- done
- }
- case "$1" in
- true) # powersaving on
- # lower brightness (value from 1 to 15)
- echo 600 > /sys/class/backlight/intel_backlight/brightness
- # lower keyboard brightness value
- echo 16 > /sys/class/leds/smc\:\:kbd_backlight/brightness
- # Autosuspend for USB device Apple Internal Keyboard / Trackpad [Apple Inc.]
- # This is not handled by `tlp`
- set_usb_power_control 05ac 0291 auto
- ;;
- false) # powersaving off
- ;;
- *)
- exit 254
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement