Unable to adjust brightness on amd CPU with integrated GPU

** Edit 21/01/21 23:14 CST: This method will not work after a system restart. Investigating solution. **
** Edit 21/01/22 20:10 CST: A workaround for above issue had been found. **

Well, I have a temporary workaround with xrandr, inotifywait, and systemd.
The idea is watching brightness modification, and then apply it with xrandr.

Depends on:

  • inotify-tools package.
  • Screen brightness can be adjusted by xrandr.

Step:

  1. Edit /usr/local/bin/adjust_brightness and make it executable

    #!/bin/sh
    
    bl_dev=/sys/class/backlight/amdgpu_bl1  # Modify device path to meet your brand
    
    ratio=$(echo $(<$bl_dev/brightness) / $(<$bl_dev/max_brightness) | bc -l)
    xrandr --output eDP --brightness $ratio
    
  2. Edit ~/.config/systemd/user/adjust-brightness.service

    [Unit]
    Description=Adjust Screen Brightness
    
    [Service]
    Type=simple
    ExecStart=/bin/bash -c "while true; do inotifywait -q -e modify /sys/class/backlight/amdgpu_bl1/brightness; /usr/local/bin/adjust_brightness; done"
    
    [Install]
    WantedBy=default.target
    
  3. Edit ~/.config/autostart/brightness-adjuster.desktop

    [Desktop Entry]
    Name=Brightness Adjuster
    Exec=systemctl --user start adjust-brightness
    Type=Application
    Terminal=false
    Comment=Adjust Brightness
    

I’m using Lenovo Legion 5 15ARH05H with Manjaro KDE 20.2.1 (5.10.7-3-MANJARO).
Please let me know if this method works for others too.
Further discussion is welcome.

1 Like