当我使用笔记本电脑按键改变笔记本电脑的亮度时,亮度会在几分钟内出现异常,并且 Xorg 在此期间会消耗 5% 的 CPU 。
我之前的笔记本电脑也出现了同样的问题,我认为这是硬件故障。现在,我使用新笔记本电脑一年后,也遇到了同样的问题。
在第一台笔记本电脑上,我使用专有的 ATI Radeon 驱动程序,而在当前的这台笔记本电脑上,我使用专有的 NVIDIA 驱动程序。
我目前正在使用 Kubuntu-dev,但在旧笔记本电脑上我使用的是稳定版本。
我发现有点类似的旧线程在 ubuntu 论坛上没有任何回应。
编辑
我尝试从 CLI 调整亮度(参见这里和那里) 并且还使用 gui wigdet (我在 KDE 上)——但没有任何作用:草率的状态让我更快地释放——但不会改变亮度。
亮度仅通过笔记本电脑亮度键进行改变,并且需要几分钟才能完成 5% CPU Xorg 任务。
答案1
解决了!
$ 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
这会立即改变亮度!就像以前一样。
但我还是不知道哪里出了问题。
编辑
解决方案可能很容易编写脚本。唯一的缺点是它需要 root 权限,我不知道如何正确设置 PolicyKit 以在没有 root 权限的情况下运行。
编辑2:
我使用以下脚本。它有两个硬编码值:Max
位于BrightnessFile
第 17 行和第 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