Quando cambio la luminosità sul laptop con i tasti di un laptop, la luminosità si comporta in modo strano per un paio di minuti e Xorg consuma il 5% della CPU durante questo periodo.
Ho avuto lo stesso effetto sul mio laptop precedente, che ho attribuito al suo hardware morente. Ora ho lo stesso problema dopo un anno di utilizzo del mio nuovo laptop.
Sul primo laptop ho utilizzato driver ATI Radeon proprietari e su quello attuale utilizzo driver NVIDIA proprietari.
Attualmente sto usando un Kubuntu-dev, ma sul vecchio laptop ho usato una versione stabile.
Ho trovato un vecchio thread in qualche modo simile sui forum di Ubuntu senza alcuna risposta.
Modifica
Ho provato a regolare la luminosità da cli (vedi qua e là) e anche a usare gui wigdet (sono su KDE) — ma niente funziona:lo stato sciatto mi libera più velocemente — ma non cambia la luminosità.
La luminosità viene modificata solo con i tasti di luminosità del laptop e ci vogliono un paio di minuti per completare l'attività Xorg CPU al 5%.
Risposta accettata:
Risolto!
$ 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
Questo cambia subito la luminosità! Proprio come prima.
Tuttavia non so ancora cosa c'era che non andava.
Modifica
La soluzione potrebbe essere facilmente scriptata. L'unico inconveniente:richiede root e non ho idea di come impostare correttamente PolicyKit per farne a meno.
Modifica 2 :
Sto usando il seguente script. Ha due valori hardcoded:Max
e BrightnessFile
si trova alle righe 17 e 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 -- "[email protected]")
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