! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[patch] xfpm-backlight-helper reads wrong file for brightness
Status:
RESOLVED: MOVED
Product:
Xfce4-power-manager
Component:
General

Comments

Description Kacper Piwiński 2019-03-14 21:02:19 CET
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.
Comment 1 bjo 2019-06-15 23:46:08 CEST
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.
Comment 2 Simon Steinbeiss editbugs 2019-06-16 23:40:30 CEST
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.
Comment 3 bjo 2019-06-17 00:23:57 CEST
Created attachment 8633 
actual brightness with wrong values
Comment 4 bjo 2019-06-17 00:25:37 CEST
Created attachment 8634 
brightness with correct value
Comment 5 bjo 2019-06-17 00:26:26 CEST
Yes, reverting the commit fixes the issue on the Thinkpad A275. I've attached both files now.
Comment 6 Simon Steinbeiss editbugs 2019-06-17 00:33:35 CEST
Could you - for completeness sake - also paste the contents of your max_brightness file? Thanks!
Comment 7 bjo 2019-06-17 00:36:41 CEST
Created attachment 8635 
max brightness
Comment 8 Simon Steinbeiss editbugs 2019-06-17 00:38:22 CEST
Ok great, so simply checking if the actual_brightness value is between >=0 and <=max_brightness should suffice as a workaround.
Comment 9 bjo 2019-06-17 00:39:49 CEST
Yes, thanks. I have also created a kernel bugreport for amdgpu, but no clue when this will be fixed.
Comment 10 Andre Miranda editbugs 2019-06-23 22:49:31 CEST
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.
Comment 11 Git Bot editbugs 2019-07-01 00:36:19 CEST
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
Comment 12 Git Bot editbugs 2020-05-27 01:45:01 CEST
-- 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

Bug #15197

Reported by:
Kacper Piwiński
Reported on: 2019-03-14
Last modified on: 2020-05-27

People

Assignee:
Ali Abdallah
CC List:
5 users

Version

Attachments

patch file (902 bytes, patch)
2019-03-14 21:02 CET , Kacper Piwiński
no flags
actual brightness with wrong values (6 bytes, application/octet-stream)
2019-06-17 00:23 CEST , bjo
no flags
brightness with correct value (4 bytes, application/octet-stream)
2019-06-17 00:25 CEST , bjo
no flags
max brightness (4 bytes, application/octet-stream)
2019-06-17 00:36 CEST , bjo
no flags
ugly-fix.diff (1.78 KB, patch)
2019-06-23 22:49 CEST , Andre Miranda
no flags

Additional information