Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard LED Brightness Issue with hid_backlight.rs #202

Open
NathanaelA opened this issue Nov 30, 2020 · 0 comments
Open

Keyboard LED Brightness Issue with hid_backlight.rs #202

NathanaelA opened this issue Nov 30, 2020 · 0 comments

Comments

@NathanaelA
Copy link

The design here is that if you change the Brightness or Led (or apparently the hardware???)
https://github.com/pop-os/system76-power/blob/master/src/hid_backlight.rs#L90-L92

Then it runs the following keyboard code on brightness or color change:
https://github.com/pop-os/system76-power/blob/master/src/hid_backlight.rs#L8-L40

Which on the surface looks correct; however it creates the following bug...

Issue/Bug Description:
The issue that this code assumes it is the only thing that changes the colors, so if their is anything that changes the keyboard colors externally; (i.e. not using a echo ff0000 > /sys/class/leds/system76_acpi::kbd_backlight/color ) like this example.

20201130_134916

Where I am actually talking to the led controller and setting individual key colors... Looks cool huh? I also use this technique to also change the keyboard colors when long background tasks are completed and it needs to notify me.

What happens when just the brightness changes?

Well normally this wouldn't be a bad issue, as I have no reason to change the keyboard brightness via the /sys/class interface.... BUT, when I walk away from my computer the computer changes the brightness for me on the screen and keyboard... Guess what happens to my cool keyboard colors and any notifications that might occur? 😢

Steps to reproduce:
Walk away and let the computer go into a light sleep mode (i.e. turns off display and keyboard led), and then move the mouse to wake up the computer... Notice the led brightness to the keyboard is reset... Which of course resets the color back to whatever was stuffed into /color

Expected behavior:
I have no issue with computer controlling the brightness when the computer goes into standby modes (although I wouldn't mind some way of opting out); which is the proper behavior -- but I don't expect to lose all my colors and ANY notifications because the OS decided to change the brightness...

Other Notes:

  1. I believe you should cache the current brightness and color values; if they change then change them and cache the new value -- if they haven't changed then don't reset that specific value...
  2. You could also optionally add a /optout or /software_controlled if set to 1, then all /sys/class values are ignored so then external software could control everything w/o the OS interfering...
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

No branches or pull requests

1 participant