Blob Blame History Raw
From b30c584d6a724d350b7b8f6a30cc4bbbf9dbac3d Mon Sep 17 00:00:00 2001
From: Werner Sembach <wse@tuxedocomputers.com>
Date: Tue, 30 Jan 2024 14:26:53 +0100
Subject: [PATCH] kbd backlight: Fix double brightness restore on
 LidOpen-resume

This fixes the issue that on LidOpen-resume the brightness might get restored
two times. Once to the correct vallue and once incorrectly to 0.

To archive this it uses the same simple "don't restore to 0"-policy as is used
in dimdisplay.cpp, dpms.cpp, and handlebuttonevent.cpp.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>

(cherry picked from commit aa2fa106)
---
 daemon/actions/bundled/keyboardbrightnesscontrol.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daemon/actions/bundled/keyboardbrightnesscontrol.cpp b/daemon/actions/bundled/keyboardbrightnesscontrol.cpp
index a7c5f6408..760e17ff5 100644
--- a/daemon/actions/bundled/keyboardbrightnesscontrol.cpp
+++ b/daemon/actions/bundled/keyboardbrightnesscontrol.cpp
@@ -75,7 +75,7 @@ KeyboardBrightnessControl::KeyboardBrightnessControl(QObject* parent, const QVar
     // My laptop sets the keyboard brightness to zero when I close the lid and it suspends
     // this makes sure the keyboard brightness is restored when we wake up :)
     connect(backend(), &PowerDevil::BackendInterface::resumeFromSuspend, this, [this] {
-        if (m_lastKeyboardBrightness > -1) {
+        if (m_lastKeyboardBrightness > 0) {
             setKeyboardBrightnessSilent(m_lastKeyboardBrightness);
         }
     });
-- 
GitLab