Bug 482306 - Keyboard brightness at 0% after closing lid
Summary: Keyboard brightness at 0% after closing lid
Status: RESOLVED FIXED
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 6.0.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 482541 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-03 13:45 UTC by beaiouns
Modified: 2024-04-18 01:13 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.4


Attachments
kb brightness patch (848 bytes, patch)
2024-03-29 09:43 UTC, Anthony Vital
Details

Note You need to log in before you can comment on or make changes to this bug.
Description beaiouns 2024-03-03 13:45:23 UTC
SUMMARY
***
This is on a Dell Latitude 3400 on KDE Neon 6.0. In the system settings I have the Energy Saving settings on AC Power set to change the keyboard brightness to 50%. This was working fine on 5.27 and works on 6.0 until I close the laptop lid. After that, the keyboard brightness appears to be off. Unchecking and rechecking the keyboard brightness option fixes this but I have to change it after every time I close and reopen the lid.
***


STEPS TO REPRODUCE
1. Close laptop lid
2. Open laptop lid
3. Press a key on the keyboard

OBSERVED RESULT
The keyboard backlight does not come on

EXPECTED RESULT
The keyboard backlight comes on

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: KDE Neon 6.0
(available in About System)
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Comment 1 beaiouns 2024-03-05 05:12:55 UTC
I noticed that the default keyboard shortcut "function + f10" cycles between 0%, 50% and 100% keyboard brightness, so that seems to be an easier workaround to turn the keyboard brightness back up after opening the lid, but if there's a way to get the 5.27 behavior back where it stays at the same level between closing and opening the lid, that would be best.
Comment 2 Nate Graham 2024-03-06 00:01:22 UTC
Your step 3 should not be necessary; the keyboard brightness is supposed to be restored automatically after opening the lid, without you having to hit a key. Was this not happening in Plasma 5, and you were having to hit a key on the keyboard to make the keyboard backlight illuminate again?

If so, I wonder if that was in fact a bug all along that some vendor-specific firmware was working around, and we broke their workaround by fixing the general issue with https://invent.kde.org/plasma/powerdevil/-/merge_requests/317 for Plasma 6.
Comment 3 beaiouns 2024-03-06 00:07:22 UTC
Yep that's how it was working in plasma 5, it seemed like the backlight would time out after 10 or so seconds, so if I don't type anything for a while then it would fade out until the next key press. I'm usually closing the lid for a while and then coming back to it, so I figured it had just timed out from not typing. That's also how it worked with the preinstalled Windows setup so I didn't really think about it.
Comment 4 Werner Sembach [TUXEDO] 2024-03-06 11:41:53 UTC
(In reply to beaiouns from comment #3)
> Yep that's how it was working in plasma 5, it seemed like the backlight
> would time out after 10 or so seconds, so if I don't type anything for a
> while then it would fade out until the next key press. I'm usually closing
> the lid for a while and then coming back to it, so I figured it had just
> timed out from not typing. That's also how it worked with the preinstalled
> Windows setup so I didn't really think about it.

Does it stay off only if it had timed out, or also when you have closed the notebook when it was still on?
Comment 5 Werner Sembach [TUXEDO] 2024-03-06 11:43:30 UTC
(In reply to Nate Graham from comment #2)
> Your step 3 should not be necessary; the keyboard brightness is supposed to
> be restored automatically after opening the lid, without you having to hit a
> key. Was this not happening in Plasma 5, and you were having to hit a key on
> the keyboard to make the keyboard backlight illuminate again?
> 
> If so, I wonder if that was in fact a bug all along that some
> vendor-specific firmware was working around, and we broke their workaround
> by fixing the general issue with
> https://invent.kde.org/plasma/powerdevil/-/merge_requests/317 for Plasma 6.

I don't really see how this could have broken this, all the patch is doing is avoiding to write 0, all other values are unaffected.
Comment 6 beaiouns 2024-03-06 12:12:01 UTC
(In reply to Werner Sembach [TUXEDO] from comment #4)
> (In reply to beaiouns from comment #3)
> > Yep that's how it was working in plasma 5, it seemed like the backlight
> > would time out after 10 or so seconds, so if I don't type anything for a
> > while then it would fade out until the next key press. I'm usually closing
> > the lid for a while and then coming back to it, so I figured it had just
> > timed out from not typing. That's also how it worked with the preinstalled
> > Windows setup so I didn't really think about it.
> 
> Does it stay off only if it had timed out, or also when you have closed the
> notebook when it was still on?

I just tried it and if I close the lid right after typing something, the keyboard light turns off. I had to hit function + f10 to get it to turn back on. If I leave the lid up, even after the screen saver kicks in, the keyboard will light up again as soon as I start typing my password to unlock it.
Comment 7 Nate Graham 2024-03-06 17:43:37 UTC
It seems that there may be some kind of automatic keyboard backlight control in firmware that's interfering with powerdevil's control of it.
Comment 8 Jakob Petsovits 2024-03-06 17:51:13 UTC
(In reply to Nate Graham from comment #7)
> It seems that there may be some kind of automatic keyboard backlight control
> in firmware that's interfering with powerdevil's control of it.

I'd say it's more likely that PowerDevil turns it off on lid-close and fails to bring it back for some reason. If it were a firmware thing, it probably wouldn't work on 5.27 either, but beaiouns reported that it was fine there and regressed on Plasma 6.0.
Comment 9 Nate Graham 2024-03-06 19:48:56 UTC
*** Bug 482541 has been marked as a duplicate of this bug. ***
Comment 10 Dm 2024-03-19 12:23:51 UTC
Having same problem after update to KDE 6 on Neon user

Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.5.0-26-generic (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz
Memory: 15.3 ГиБ of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630
Manufacturer: Dell Inc.
Product Name: XPS 15 9570
Comment 11 Dm 2024-03-20 21:26:37 UTC
In SDDM everything works proper
Comment 12 Anthony Vital 2024-03-29 09:43:50 UTC
Created attachment 167914 [details]
kb brightness patch

Here's a small patch that fixes the issue against the 6.0 branch (I have no easy way to try the master branch, but it should be the same).
So the issue seems to be that after the lid is closed and the brightness set to 0, powerdevil receives a signal keyboardBrightnessChanged, and saves this value for restoration. This patch ensures we store this value only if the lid is open.
This check existed in the 5.27 branch, I'm not sure why it was removed. 

Also I noticed everyone who reported this issue have a Dell computer, so this behaviour might be vendor specific.
Comment 13 Jakob Petsovits 2024-03-30 21:25:16 UTC
(In reply to Anthony Vital from comment #12)
> Here's a small patch that fixes the issue against the 6.0 branch (I have no
> easy way to try the master branch, but it should be the same).
> So the issue seems to be that after the lid is closed and the brightness set
> to 0, powerdevil receives a signal keyboardBrightnessChanged, and saves this
> value for restoration. This patch ensures we store this value only if the
> lid is open.
> This check existed in the 5.27 branch, I'm not sure why it was removed. 

Thanks for the patch, great find. I tested this on my ThinkPad, latest master branch, and it indeed makes a difference there as well.

I did a little bit of digging in the commit history, my reading is that the removal of this condition was probably unintentional. It got removed together with another condition in the same line that did indeed have to disappear due to a refactoring. More details and perhaps also a confirmation of this theory in the merge request that will get linked by the bot in the next comment.
Comment 14 Bug Janitor Service 2024-03-30 21:28:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/343
Comment 15 Jakob Petsovits 2024-04-13 17:17:42 UTC
Git commit 4bb7c6148b1ee0436227e70f510e98e06b158c01 by Jakob Petsovits, on behalf of Anthony Vital.
Committed on 13/04/2024 at 17:13.
Pushed by jpetso into branch 'master'.

actions/handlebuttonevents: Require lid-open again to track kb brightness

Out of the two checks in this line that were removed in
commit d0b43050, one should have remained. We still need to make
storing the old keyboard brightness conditional on an opened lid,
otherwise restoring keyboard brightness can fail after closing and
re-opening the lid.
FIXED-IN: 6.0.4

M  +3    -1    daemon/actions/bundled/handlebuttonevents.cpp

https://invent.kde.org/plasma/powerdevil/-/commit/4bb7c6148b1ee0436227e70f510e98e06b158c01
Comment 16 Jakob Petsovits 2024-04-13 17:29:32 UTC
Git commit 4ca0ce68a303090f0e76719ea021dd4d96e9730b by Jakob Petsovits, on behalf of Anthony Vital.
Committed on 13/04/2024 at 17:25.
Pushed by jpetso into branch 'Plasma/6.0'.

actions/handlebuttonevents: Require lid-open again to track kb brightness

Out of the two checks in this line that were removed in
commit d0b43050, one should have remained. We still need to make
storing the old keyboard brightness conditional on an opened lid,
otherwise restoring keyboard brightness can fail after closing and
re-opening the lid.
FIXED-IN: 6.0.4

(cherry picked from commit 4bb7c6148b1ee0436227e70f510e98e06b158c01)

M  +3    -1    daemon/actions/bundled/handlebuttonevents.cpp

https://invent.kde.org/plasma/powerdevil/-/commit/4ca0ce68a303090f0e76719ea021dd4d96e9730b
Comment 17 beaiouns 2024-04-18 01:13:27 UTC
Works great here, the keyboard light comes back on when I open the lid now!