Comment 53 for bug 337945

Revision history for this message
Peter S. (stoto) wrote :

I found a solution:

I made a script, with that i can control the brightness:

stoto@stoto-laptop:~$ cat backlight.sh
#!/bin/bash

$act
act=`cat /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness`
echo $1
case "$1" in
 inc)
  if [[ $act -lt 255 ]]; then
   act=$((act+5))
   echo $act | tee /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness
  fi
 ;;

 dec)
  if [[ $act -gt 4 ]]; then
                        act=$((act-5))
                        echo $act | tee /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness
                fi
 ;;

 *) echo "Usage: inc or dec"
 ;;
esac

Save the script somewhere. I saved in my home, and made a symlink to /bin/backlight.sh but its optional
I binded it to the brightness control keys in:

System -> Preferences -> Keyboard Shortcuts

Make 2 Custom shortcuts with the add button:
-BrightnessUp, command: /bin/backlight.sh inc
-BrightnessDown, command: /bin/backlight.sh dec

This is only working if you have access to the brightness control file. Putting sudo in the command won't work, it works with gksudo, but then you will have massive amounts of windows popping up when you hold the brightness control key.

So the best solution i found:
sudo chmod 777 /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness

It works like a charm.