Repository navigation
Conversation
udev_device_get_sysattr_value() caches sysfs values per udev_device. The smooth transition loop calls get() after every write, so it keeps seeing the old brightness and never reaches the requested target; on intel_backlight this shows up as a 1.00/0.95 ping-pong. Read /sys/class/backlight/<dev>/brightness with open/read instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Read the sysfs backlight value directly instead of through libudev's cached
sysattr value.
Root cause
sysfs.c get()callsudev_device_get_sysattr_value(dev, "brightness").libudev caches sysfs attribute values per
udev_device; after the smoothtransition writes a new brightness,
get()still returns the old value.next_backlight_pct()therefore keeps computing from the stale value andnever reaches the target.
On
intel_backlightthis is visible as a 1.00/0.95 ping-pong (and floodingthe journal) when requesting e.g. 0.5 with
step=0.01, wait=10ms.Note: isolate this from GNOME's own ambient auto-brightness by disabling
org.gnome.settings-daemon.plugins.power ambient-enabledfirst; otherwisetwo writers are involved. This is not the same issue as #124.
Changes
<syspath>/brightnesswithopen()/read()inget().Testing
With GNOME ambient disabled,
Backlight2.Set 0.5 0.01 10now walkssmoothly from 1.0 to 0.5 and stops; before it oscillated between 1.00 and
0.95 forever. Fedora 45, MacBookPro12,1, kernel 7.3.4.