Skip to content

Instantly share code, notes, and snippets.

@jzuijlek
Created August 22, 2014 06:21
Show Gist options
  • Save jzuijlek/8fb0515cbbc8a6638cbc to your computer and use it in GitHub Desktop.
Save jzuijlek/8fb0515cbbc8a6638cbc to your computer and use it in GitHub Desktop.
Asus backlight/backlit keyboard suspend/resume
#!/bin/bash
## /etc/pm/sleep.d/80_asus-kbd-backlight
BRIGHTNESS_FILE="/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness"
BRIGHTNESS_BAK_FILE="/var/lib/asus-kbd-backlight/brightness"
DEFAULT=1
case "$1" in
thaw|resume)
if [ -f "$BRIGHTNESS_BAK_FILE" ] ; then {
#Restores the last value
cat "$BRIGHTNESS_BAK_FILE" > "$BRIGHTNESS_FILE"
} else {
#Sets the default value
echo "$DEFAULT" > "$BRIGHTNESS_FILE"
} fi
;;
hibernate|suspend)
#Turn of the backlight
echo 0 > "$BRIGHTNESS_FILE"
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment