diff options
author | Matthias Hentges <oe@hentges.net> | 2006-05-25 22:07:52 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-05-25 22:07:52 +0000 |
commit | 7b9d7be0ce864c84d6098c1c8521bd2a84633874 (patch) | |
tree | db9a8d128c0b3b00963c181023374a30d369315a /packages/display-brightness/display-brightness.sh | |
parent | 579d6238e817ea11c8b7b09aff2cf36c71027173 (diff) |
display-brightness: Use head -n 1 not head -1 to determine driver, closing bug #1004. Also fixed a problem with poodles kernel 2.6 driver and added a small help text
Diffstat (limited to 'packages/display-brightness/display-brightness.sh')
-rw-r--r-- | packages/display-brightness/display-brightness.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/display-brightness/display-brightness.sh b/packages/display-brightness/display-brightness.sh index 4e706e1e75..5e1a0e97d4 100644 --- a/packages/display-brightness/display-brightness.sh +++ b/packages/display-brightness/display-brightness.sh @@ -7,11 +7,17 @@ STEP=5 -DRIVER="`ls /sys/class/backlight/|head -1`" +DRIVER="`ls /sys/class/backlight/|head -n 1`" MAX_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/max_brightness` ACTUAL_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/actual_brightness` BRIGHTNESS_FILE="/sys/class/backlight/$DRIVER/brightness" +if test "$1" != "up" -a "$1" != "down" -a -n "$1" +then + echo -e "\nUsage:\n\t `basename $0` [up | down]\n" + exit 0 +fi + echo "max / current" echo "$MAX_BRIGHTNESS / $ACTUAL_BRIGHTNESS" if [ ! -n "$1" ]; then @@ -22,7 +28,8 @@ if [ "$1" = "up" ]; then if [ $ACTUAL_BRIGHTNESS -eq $MAX_BRIGHTNESS ]; then exit 0 else - let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS+$STEP + test "$STEP" -gt "$MAX_BRIGHTNESS" -o "$STEP" -eq "$MAX_BRIGHTNESS" && STEP=1 + let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS+$STEP echo $CURRENT_BRIGHTNESS >> $BRIGHTNESS_FILE exit 0 fi @@ -42,3 +49,4 @@ if [ "$1" = "down" ]; then exit 0 fi fi + |