From 2c2817931b08cba74c2f3b76a818bdb0acaaf82e Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 8 May 2016 21:00:18 +0200 Subject: bin/set_backlight: No separate backlight script for W540 needed, if kernel parameter acpi_backlight=vendor is given. --- bin/set_backlight | 56 ------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100755 bin/set_backlight (limited to 'bin/set_backlight') diff --git a/bin/set_backlight b/bin/set_backlight deleted file mode 100755 index c110321..0000000 --- a/bin/set_backlight +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# Script to set backlight on startup on Lenovo W540 using -# /sys/class/backlight/intel_backlight/brightness -# This must be run as root. - -# check if root -if [[ $EUID -ne 0 ]];then - echo "This must be run as root." -else - # get current and maximum brightness, set maximum steps allowed - brightness_current=$(cat /sys/class/backlight/intel_backlight/brightness) - brightness_max=$(cat /sys/class/backlight/intel_backlight/max_brightness) - brightness_max=$(($brightness_max-1000)) - brightness_steps=20 - brightness_steps_width=$(($brightness_max/$brightness_steps)) - brightness_new=0 - # if first parameter to this script is a number - re='^[0-9]+$' - if [[ $1 =~ $re ]]; then - echo "Direct step called" - if [[ $1 -gt brightness_steps && $1 -ne 0 ]];then - brightness_new=$(($1*brightness_steps_width)) - fi - elif [[ $1 == "up" || $1 == "down" ]];then - brightness_calc=$(($brightness_current / $brightness_steps_width)) - case $1 in - "up" ) - brightness_calc=$((($brightness_calc+1) * $brightness_steps_width)) - echo "brightness_calc: $brightness_calc" - echo "brightness_max: $brightness_max" - if [[ $brightness_max -gt $brightness_calc ]];then - echo "true" - brightness_new=$brightness_calc - else - echo "false" - brightness_new=$brightness_current - fi - ;; - "down" ) - brightness_calc=$((($brightness_calc-1) * $brightness_steps_width)) - echo "brightness_calc: $brightness_calc" - if [[ $brightness_calc -gt 0 ]];then - brightness_new=$brightness_calc - else - brightness_new=$brightness_current - fi - ;; - esac - echo "Step called with: $1" - fi - echo $brightness_current - echo $brightness_new - # set to 234 (around 4th step) - #echo 234 > /sys/class/backlight/intel_backlight/brightness - echo $brightness_new > /sys/class/backlight/intel_backlight/brightness -fi -- cgit v1.2.3-70-g09d2