Reply to topic

Can't set brightness (KDE uses wrong device)

User avatar proton
Registered Member
Posts
4
Karma
0
OS
I have several brightness devices:
Code: Select all
# find /sys/devices -iname 'brightness' -print
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/brightness
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness
/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video1/brightness
/sys/devices/pci0000:00/0000:00:1c.1/0000:08:00.0/leds/phy0-led/brightness
/sys/devices/platform/dell-laptop/leds/dell-laptop::touchpad/brightness


KDE uses "/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video1/brightness" (when I adjust brightness via kde power manager /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video1/brightness changes its content from 0 to 99).

But my real brightness device is /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness (now I can manualy change brightness using echo VALUE > /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/brightness).

How to choose brightness device in kde?
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS
Are both "acpi_video1" and "intel_backlight" present in /sys/class/backlight?


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
User avatar proton
Registered Member
Posts
4
Karma
0
OS
bcooksley wrote:Are both "acpi_video1" and "intel_backlight" present in /sys/class/backlight?

Yes
Code: Select all
# ls /sys/class/backlight -l
total 0
lrwxrwxrwx 1 root root 0 Jan 10 20:54 acpi_video0 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0
lrwxrwxrwx 1 root root 0 Jan 10 20:54 acpi_video1 -> ../../devices/pci0000:00/0000:00:02.0/backlight/acpi_video1
lrwxrwxrwx 1 root root 0 Jan 10 20:54 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS
Can you please check the content of the file "type" in each one of those directories?
It will be either "raw", "firmware" or "platform".


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
User avatar proton
Registered Member
Posts
4
Karma
0
OS
bcooksley wrote:Can you please check the content of the file "type" in each one of those directories?
It will be either "raw", "firmware" or "platform".

/sys/class/backlight/acpi_video0/type
firmware
/sys/class/backlight/acpi_video1/type
firmware
/sys/class/backlight/intel_backlight/type
raw
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS
I'm afraid the raw device, intel_backlight, will never be used by KDE Power Management, as it is coded to prefer firmware devices, followed by platform ones before falling back to raw devices finally. This behaviour is unconfigurable i'm afraid - and for security reasons it cannot be made configurable (in order to manipulate files in /sys, a special helper is used which executes using root privileges - being able to control which file it writes as a user would represent a privilege escalation vulnerability).

I'm not sure if it is possible to make the acpi_video* devices disappear unfortunately. Your only other option would be to self-compile KDE Workspace with alterations made to change the preference order to prefer raw devices first.


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
User avatar proton
Registered Member
Posts
4
Karma
0
OS
bcooksley wrote:I'm afraid the raw device, intel_backlight, will never be used by KDE Power Management, as it is coded to prefer firmware devices, followed by platform ones before falling back to raw devices finally. This behaviour is unconfigurable i'm afraid - and for security reasons it cannot be made configurable (in order to manipulate files in /sys, a special helper is used which executes using root privileges - being able to control which file it writes as a user would represent a privilege escalation vulnerability).

I'm not sure if it is possible to make the acpi_video* devices disappear unfortunately. Your only other option would be to self-compile KDE Workspace with alterations made to change the preference order to prefer raw devices first.


Thank you for your answer.

Now I use this shell script:
Code: Select all
brightness=0
max_brightness=$(cat /sys/class/backlight/intel_backlight/max_brightness)
while true; do
        new_brightness=$(cat /sys/class/backlight/acpi_video1/brightness)
        if [ "$new_brightness" -ne "$brightness" ]; then
            brightness=$new_brightness
            echo $(echo "$brightness*$max_brightness/100" | bc) > /sys/class/backlight/intel_backlight/brightness
        fi
    sleep 0.25
done
User avatar bcooksley
Administrator
Posts
19765
Karma
87
OS
You also might want to report this incorrect behaviour to the Intel graphics driver developers, so this issue can be corrected properly.


KDE Sysadmin
[img]http://forum.kde.org/content/bcooksley_sig.png[/img]
jewe37
Registered Member
Posts
1
Karma
0
Hello, it has been a while but I just came across this very issue. If I use the brightness adjustment buttons in KDE on my ASUS Zenbook UM425IA(using an AMD 4500U) it will also choose the wrong device. In my case a raw and a platform device are available. It is indeed preferring the platform device(going by me monitoring the brightness file while changing brightness), is there still no way to adjust this? Would it be possible to compile powerdevil to fix this? It seems like a pretty trivial change even if it might not otherwise be great for security, it's fine for me: https://github.com/KDE/powerdevil/blob/ ... er.cpp#L92

EDIT: Got it. This only happened to me after fixing a problem with systemd's backlight service not correctly being started. I fixed that by setting "acpi_backlight=vendor" in the kernel command line, but this apparently was not correct. While it fixed the systemd issue, it cause the KDE issue. The option that is now working for both is "acpi_backlight=video".

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], claydoh, DeMus, frantesta, Google [Bot], Sogou [Bot]