From 55fc118db2513d17be99e46baa6c640249f991ff Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Thu, 26 Aug 2010 04:23:08 +0200 Subject: [PATCH] op_bright_up.sh / op_bright_down.sh: Fixed them and enhanced them (change brightness more linear) --- testdata/scripts/op_bright_down.sh | 19 +++++++++++++++++++ testdata/scripts/op_bright_up.sh | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/testdata/scripts/op_bright_down.sh b/testdata/scripts/op_bright_down.sh index e69de29..1de2be9 100755 --- a/testdata/scripts/op_bright_down.sh +++ b/testdata/scripts/op_bright_down.sh @@ -0,0 +1,19 @@ +#!/bin/bash +cur=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness); +if [ "$cur" -gt "40" ]; then + new=$(($cur-10)) +elif [ "$cur" -gt "30" ]; then + new=$(($cur-7)) +elif [ "$cur" -gt "20" ]; then + new=$(($cur-5)) +elif [ "$cur" -gt "5" ]; then + new=$(($cur-3)) +elif [ "$cur" -gt "0" ]; then + new=$(($cur-1)) +fi + +if [ "$new" -lt "0" ]; then + new=0 +fi + +echo $new > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness diff --git a/testdata/scripts/op_bright_up.sh b/testdata/scripts/op_bright_up.sh index e69de29..f8df260 100755 --- a/testdata/scripts/op_bright_up.sh +++ b/testdata/scripts/op_bright_up.sh @@ -0,0 +1,21 @@ +#!/bin/bash +cur=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness); +if [ "$cur" -gt "35" ]; then + new=$(($cur+10)) +elif [ "$cur" -gt "20" ]; then + new=$(($cur+7)) +elif [ "$cur" -gt "13" ]; then + new=$(($cur+5)) +elif [ "$cur" -gt "5" ]; then + new=$(($cur+3)) +elif [ "$cur" -gt "0" ]; then + new=$(($cur+1)) +elif [ "$cur" -eq "0" ]; then + new=$(($cur+1)) +fi + +if [ "$new" -gt "54" ]; then + new=54 +fi + +echo $new > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness -- 2.39.5