Created attachment 8335 patch file xfpm-backlight-helper reads "/sys/class/backlight/<driver>/brightness" this file is for setting brightness, not for reading what the brightness actually is. It happened to sometimes works because "brightness" file remember last written value to it. We should read from "/sys/class/backlight/<driver>/actual_brightness" to get real current brightness level. I'm including a patch that fixes this.
Could this be made configurable? On my Thinkpad A275 actual_brightness has some unchanged 5 digit values instead of 0-255 (255 is max_brightness), so it's broken after this patch.
So I guess this commit triggers the issue on the ThinkpadA275? https://git.xfce.org/xfce/xfce4-power-manager/commit/?id=34fe4403faaf6fe0a9de14153e32d5d3c92b919a @bjo: Could you attach the contents of both files to this bugreport? Maybe we can - instead of adding a configuration option, which will be too hard to figure out for most users anyway - just query the file and decide which one to use based on what it looks like.
Created attachment 8633 actual brightness with wrong values
Created attachment 8634 brightness with correct value
Yes, reverting the commit fixes the issue on the Thinkpad A275. I've attached both files now.
Could you - for completeness sake - also paste the contents of your max_brightness file? Thanks!
Created attachment 8635 max brightness
Ok great, so simply checking if the actual_brightness value is between >=0 and <=max_brightness should suffice as a workaround.
Yes, thanks. I have also created a kernel bugreport for amdgpu, but no clue when this will be fixed.
Created attachment 8670 ugly-fix.diff The attached diff implements the proposed fallback, xfpm's code is not really reuse-friendly or I'm just stupid. I wouldn't push it, IMHO it makes more sense to revert 34fe440, I guess until now people didn't complain about readings from brightness.
Simon Steinbeiss referenced this bugreport in commit 14906574c961575954a72c8bc428000efc6aa879 Revert "Read from actual_brightness instead of brightness" https://git.xfce.org/xfce/xfce4-power-manager/commit?id=14906574c961575954a72c8bc428000efc6aa879
-- GitLab Migration Automatic Message -- This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/xfce4-power-manager/-/issues/50. Please create an account or use an existing account on one of our supported OAuth providers. If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev