Comment 76 for bug 935778

luca (llucax) wrote :

Hi, I improved the /etc/udev/rules.d/tosh-backlight.sh script as presented in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/935778/comments/68, this script avoids the no-backlight at all issue and sets the brightness using a quadratic function (it works much better in my Z830 where the lower brightness jumps are very big).

#!/bin/sh
acpi_max=$(cat /sys/class/backlight/toshiba/max_brightness)
acpi_curr=$(cat /sys/class/backlight/toshiba/brightness)
intel_max=$(cat /sys/class/backlight/intel_backlight/max_brightness)
intel_min=100 # What we want the brightness 0 to be
# Linear
#intel_curr=$((($intel_max-$intel_min)/$acpi_max*$acpi_curr+$intel_min))
# Cuadratic
intel_curr=$(echo "scale=10; ($intel_max-$intel_min)/($acpi_max^2)*$acpi_curr^2+$intel_min" | bc | cut -d. -f1)
echo $intel_curr > /sys/class/backlight/intel_backlight/brightness