Created
April 28, 2011 19:37
-
-
Save vain/947142 to your computer and use it in GitHub Desktop.
Control the backlight of an Intel GMA 3150.
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/bash | |
current=$(sudo setpci -s 00:02.0 F4.B) | |
current=$((0x$current)) | |
if [[ "$1" == "up" ]] | |
then | |
((current+=0x10)) | |
else | |
((current-=0x10)) | |
fi | |
if (( current < 5 )) | |
then | |
current=5 | |
elif (( current > 255 )) | |
then | |
current=255 | |
fi | |
sudo setpci -s 00:02.0 F4.B=$(printf "%02X" $current) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment