Skip to content

Fix --kblight reading back 1% low - #391

Merged
JohnAZoidberg merged 1 commit into
FrameworkComputer:mainfrom
ValentinBischof:main
Nov 12, 2026
Merged

JohnAZoidberg merged 1 commit into
FrameworkComputer:mainfrom
ValentinBischof:main

Conversation

@ValentinBischof

Copy link
Copy Markdown
Contributor

Hi,
I use the transparent/clear keyboard cover and thus mostly use low (1-10%) keyboard backlight settings and I noticed that --kblight reads back 1% less than set:

$ framework_tool --kblight 1
$ framework_tool --kblight
> Keyboard backlight: 0%
Write Read
1 0
2 1
10 9
19 18
20 20
21 20
50 49
99 98
100 100

framework_lib/src/chromium_ec/commands.rs:
Both duty_to_percent and percent_to_duty floor, so any write always lands just below the duty cycle and the read then drops a full percent.

So instead of flooring, make duty_to_percent round to the nearest percent.
I tested the changes on my FW13 AMD 7040.

@JohnAZoidberg JohnAZoidberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, tested, works.

@JohnAZoidberg
JohnAZoidberg merged commit 6383825 into FrameworkComputer:main Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants