Persist four-zone keyboard lighting state when settings change#18
Open
RezaT4795 wants to merge 1 commit into
Open
Persist four-zone keyboard lighting state when settings change#18RezaT4795 wants to merge 1 commit into
RezaT4795 wants to merge 1 commit into
Conversation
Signed-off-by: Reza Talebi <reza.talebi.73@outlook.com>
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
This PR fixes four-zone keyboard lighting persistence for supported Acer laptops.
Previously, custom keyboard lighting could be applied successfully while the system was running, but after a reboot the keyboard would fall back to the firmware/default lighting mode, such as Neon mode.
The root cause was that the driver only saved the four-zone keyboard state when the
linuwu_sensekernel module was removed. On systems where the module is not explicitly unloaded during shutdown, the latest keyboard lighting state is never written to disk.This PR saves the keyboard lighting state immediately after a successful lighting change, making the behavior independent of shutdown/module-unload handling.
Problem
The driver already had support for saving and loading keyboard state through:
The saved state was loaded during module initialization, but it was only written during module removal.
That means the persistence flow depended on this happening cleanly:
On systems where the module is not explicitly unloaded at shutdown, this flow breaks:
As a result, custom four-zone keyboard lighting only lasted until reboot.
Changes
Why this fix
Saving state only during module removal is fragile because persistence should happen when the state actually changes, not later during shutdown.
The new behavior is safer:
This avoids relying on systemd service behavior, shutdown ordering, or explicit
rmmodexecution.Scope
This PR only changes kernel module keyboard lighting persistence behavior.
It does not change:
/etc/four_zone_kb_stateTesting
Tested manually on Slackware with
linuwu_senseinstalled and loaded.Verified:
/etc/four_zone_kb_stateis updated after applying keyboard lighting changes.Notes
A separate GUI PR handles DAMX-GUI issues around Keyboard Lighting UI state, Static Mode behavior, fan mode restoration, daemon command serialization, and the Avalonia 12 upgrade.