Résolu !
$ find /sys -name "max_brightness"
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/max_brightness
/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/phy0-led/max_brightness
/sys/devices/platform/dell-laptop/backlight/dell_backlight/max_brightness
$ cat /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/max_brightness
4648
$ sudo bash -c 'echo 2000 >> /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness'
# note that now it is brightness - not max_brightness
Cela change tout de suite la luminosité ! Comme avant.
Cependant, je ne sais toujours pas ce qui n'allait pas.
Modifier
La solution pourrait être facilement scénarisée. Le seul inconvénient : il faut être root, et je n'ai aucune idée de comment configurer PolicyKit pour s'en passer.
Edit 2 :
J'utilise le script suivant. Il a deux valeurs codées en dur : Max
y BrightnessFile
qui se trouvent aux lignes 17 et 18 :
#!/bin/bash
# to get description use the -h flag
# exit after a single error:
set -e
# ================
## default values:
Inc=
Dec=
Set=
Get=false
Max=4648 # max_brightness
BrightnessFile=/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness
Current=`cat $BrightnessFile`
# ===========
## preambula:
PROGNAME=${0##*/}
PROGVERSION=0.01
noColors=false
usage()
{
cat << EO
usage: $PROGNAME [OPTIONS...]
Changes brightness of the laptop.
The value of the max brightness depends on the hardware, and is hardcoded. On my machine it is 4648:
$ find /sys -name "max_brightness"
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/max_brightness
/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/phy0-led/max_brightness
/sys/devices/platform/dell-laptop/backlight/dell_backlight/max_brightness
$ cat /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/max_brightness
4648
Requires superuser privilages.
Examples:
Increase brightness by 10 percents:
$PROGNAME --inc 10
Decrease brightness by 10 percents:
$PROGNAME --dec 10
Set brightness to 10 percents:
$PROGNAME --set 10
optional arguments:
EO
cat << EO | column -s\& -t
-i, --inc & increase brightness (in percents)
-d, --dec & decrease brightness (in percents)
-s, --set & set brightness (in percents)
-g, --get & print current value (in percents)
-G, --GUI & ask password with kdialog
-h, --help & show this output
-v, --version & show version information
EO
}
SHORTOPTS="hvi:d:s:g"
LONGOPTS="help,version,inc:,dec:,set:get"
ARGS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
case $1 in
-i|--inc)
Inc=$2; shift;;
-d|--dec)
Dec=$2; shift;;
-s|--set)
Set=$2; shift;;
-g|--get)
Get=true;;
-h|--help)
usage; exit 0;;
-v|--version)
echo "$PROGVERSION"; exit 0;;
--)
shift; break;;
*)
shift; break;;
esac
shift
done
# =========
## program:
if $Get; then
CurrentRelVal=`bc <<< "$Current*100/$Max"`
echo "Current brightness: $CurrentRelVal%"
exit 0
elif [ -n "$Inc" -a $Inc -eq $Inc 2>/dev/null ]; then
IncAbsVal=`bc <<< "$Current+$Inc*$Max/100"`
sudo bash -c "echo $IncAbsVal >> $BrightnessFile"
exit
elif [ -n "$Dec" -a $Dec -eq $Dec 2>/dev/null ]; then
DecAbsVal=`bc <<< "$Current-$Dec*$Max/100"`
sudo bash -c "echo $DecAbsVal >> $BrightnessFile"
exit 0
elif [ -n "$Set" -a $Set -eq $Set 2>/dev/null ]; then
SetAbsVal=`bc <<< "$Set*$Max/100"`
sudo bash -c "echo $SetAbsVal >> $BrightnessFile"
exit 0
else
usage
fi