Last active
December 18, 2015 03:38
-
-
Save felipe-prenholato/5719520 to your computer and use it in GitHub Desktop.
pm script to halt keyboard backlight allowing Asus G51 notebooks to suspend.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# File: "/etc/pm/sleep.d/20_custom-kbd-backlight". | |
# Based on http://ubuntuforums.org/showthread.php?t=1546748&p=9744985#post9744985 | |
BRIGHTNESSTMPFILE=/tmp/kbd-brightness | |
BRIGHTNESSFILE=/sys/devices/platform/asus_laptop/leds/asus::kbd_backlight/brightness | |
case "${1}" in | |
hibernate|suspend) | |
STATUS="`cat $BRIGHTNESSFILE`" | |
STATUS=$(($STATUS-128)) | |
echo $STATUS > $BRIGHTNESSTMPFILE | |
echo "Shutting down keyboard led ..." | |
echo 0 > $BRIGHTNESSFILE | |
;; | |
resume|thaw) | |
if [ -f $BRIGHTNESSTMPFILE ]; then | |
STATUS=`cat $BRIGHTNESSTMPFILE` | |
else | |
STATUS=1 | |
fi | |
echo "Restoring keyboard led ..." | |
echo $STATUS > $BRIGHTNESSFILE | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment