Bug 243618 - Powerdevil does not trigger new lid action when profile changes CancelOk
Summary: Powerdevil does not trigger new lid action when profile changes CancelOk
Status: RESOLVED FIXED
Alias: None
Product: solid
Classification: Frameworks and Libraries
Component: powermanagement-daemon (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-05 01:29 UTC by Ryan Thompson
Modified: 2010-11-10 02:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Thompson 2010-07-05 01:29:46 UTC
Version:           unspecified (using KDE 4.4.4) 
OS:                Linux

Assume the following power configuration, which is a simplification of the KDE default:

- There are two power profiles, "AC" and "Battery".
- When the AC adapter is plugged in, the system is configured to switch to the "AC" profile.
- When the adapter is unplugged, the system is configured to switch to the "battery" profile.
- In, the AC profile, when the lid is closed, the system locks the screen.
- In the Battery profile, when the lid is closed, the system goes into sleep mode (suspends to RAM).

With this setup, if I unplug the laptop and then close the lid, the laptop will suspend, as expected. However, if I close the lid *first* and then unplug the laptop, the screen will lock, and the laptop will *not* suspend. This is because the lid is closed while the AC power profile is active. When the adapter is unplugged afterward, the power profile is switched to Battery, but this does not trigger the appropriate lid action from the Battery profile.

In GNOME, there is a hidden gconf setting to fix this problem, but it seems that there is no such setting in KDE.

A possible workaround is to configure the system to emit an ACPI lid event whenever the AC adapter is unplugged, but I don't know how to do this.

Reproducible: Always

Steps to Reproduce:
1. Make sure your Powerdevil configuration matches the one above closely enough. The default settings should be fine.
2. Unplug the laptop, then close the lid. It should suspend, as expected. (This is to verify that things are working normally.)
3. Open the lid, resume the laptop, plug it in, and unlock the screen.
4. Now, close the lid *first*, and then unplug. 

Actual Results:  
The screen is locked, but the laptop does not suspend.

Expected Results:  
The laptop should suspend (i.e. suspend to RAM).

The problem is that Powerdevil does not re-trigger any lid action when changing profiles. If the lid is closed and the profile is changed automatically, Powerdevil should trigger the new profile's lid action, rather than do nothing. This should probably *not* happen if the profile is changed manually.

Also, as mentioned, GNOME has a hidden gconf key to enable this or disable it. If this is implemented, there should probably be a similar option to disable it, because it could certainly cause breakage or unexpected behavior for some people.
Comment 1 Dario Freddi 2010-11-10 02:38:50 UTC
SVN commit 1194869 by dafre:

BUG: 243618

Retrigger lid close event if the lid is closed and the profile is changed.

 M  +12 -1     powerdevilbackendinterface.cpp  
 M  +4 -0      powerdevilbackendinterface.h  
 M  +5 -0      powerdevilcore.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1194869