https://bugs.kde.org/show_bug.cgi?id=524171
Bug ID: 524171
Summary: Closing the lid on AC power and then unplugging does
not suspend the laptop
Classification: I don't know
Product: kde
Version First unspecified
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
PowerDevil does not execute the battery-profile lid action when the power
profile changes while the lid is already closed.
My configuration is:
- AC profile lid action: Turn off screen
- Battery profile lid action: Sleep
If I close the lid while the laptop is connected to AC power, PowerDevil
correctly turns off the screen. However, if I then unplug the power adapter
while the lid remains closed, the laptop does not suspend.
If I unplug the power adapter first and close the lid afterwards, the laptop
suspends correctly.
Steps to reproduce:
1. Configure the AC profile to turn off the screen when the lid is closed.
2. Configure the Battery profile to suspend when the lid is closed.
3. Connect the laptop to AC power.
4. Close the lid.
5. Disconnect the AC adapter while the lid remains closed.
Actual result:
The power profile changes from AC to Battery, but the laptop remains awake. The
Battery profile's lid action is not executed.
Expected result:
After switching to the Battery profile while the lid is already closed,
PowerDevil should execute the Battery profile's lid action and suspend the
laptop.
This should behave equivalently to switching to the Battery profile first and
then closing the lid.
Environment:
- KDE Plasma: 6.7.4
- PowerDevil: 6.7.4
- systemd: 261.2
- UPower: 1.91.3
- Session: Plasma Wayland
- Distribution: Arch Linux / CachyOS
Suspected regression:
The issue appears to have been introduced by commit:
df8a93efdaa2a6e3e910ca180420144e7917a843
Guard lid re-trigger with profile-change check in loadProfile()
The relevant condition in Core::loadProfile() is:
if (m_lidController->isLidClosed() && (m_currentProfile != profileId || force))
However, m_currentProfile = profileId is assigned earlier in the same function.
Therefore, during a normal profile change, m_currentProfile != profileId is
always false by the time this condition is evaluated.
As a result, the lid-close action is not retriggered after an ordinary
AC-to-Battery profile change.
--
You are receiving this mail because:
You are watching all bug changes.