当按下亮度键(或使用设置中的滑块)时,Ubuntu 会表现得好像在改变屏幕亮度,但亮度并没有改变。通过四处寻找,我发现我可以使用
echo $N > /sys/class/backlight/radeon_bl0/brightness
其中 $N >= 0 且 $N <= 255。
- iMac=mc813ll/a
- Ubuntu 版本=18.04
- 内核=4.15.0-20-generic(默认)
相关日志摘录;
> tail -n 2 /var/log/auth.log
May 5 11:44:02 imac pkexec: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
May 5 11:44:02 imac pkexec[7310]: $USER: Executing command [USER=root] [TTY=unknown] [CWD=/home/$USER] [COMMAND=/usr/lib/gnome-settings-daemon/gsd-backlight-helper --set-brightness 10]
直接测试;
> sudo /usr/lib/gnome-settings-daemon/gsd-backlight-helper --set-brightness 255
Could not set the value of the backlight: writing '255' to /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0 failed
没有手册页
> man gsd-backlight-helper
No manual entry for gsd-backlight-helper
> man gnome-settings-daemon
No manual entry for gnome-settings-daemon
更长的路径示例;
> echo 20 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness
-bash: echo: write error: Invalid argument
> echo 20 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-eDP-1/radeon_bl0/brightness
好像这是 src,我如何告诉 GNOME 亮度与内核中的什么对话?
[编辑] 我刚刚重启,
/sys/class/backlight/radeon_bl0/brightness
就是现在
/sys/class/backlight/radeon_bl1/brightness
或者
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-eDP-1/radeon_bl1
所以位置并不稳定。
> lspci | grep "VGA compatible controller"
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Whistler [Radeon HD 6730M/6770M/7690M XT]
> sudo dmidecode | grep -A 9 "System Information" | grep "Product Name"
Product Name: iMac12,2
答案1
使用acpi_backlight核参数;
sudo perl -pi -e 's/(GRUB_CMDLINE_LINUX_DEFAULT="[^"]*)(")/$1 acpi_backlight=vendor$2/g' /etc/default/grub