Bug 293575

Summary: Lid closed event should not fire upon power profile change (eg upon unplugging AC) if lid is already closed
Product: [Frameworks and Libraries] solid Reporter: JR <zorael>
Component: powermanagementAssignee: Dario Freddi <drf>
Status: RESOLVED WAITINGFORINFO    
Severity: normal CC: afiestas, cespinal17, oliver.henshaw
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description JR 2012-02-07 20:47:27 UTC
Version:           unspecified (using KDE 4.8.0) 
OS:                Linux

Kubuntu 11.10, KDE packages from kubuntu ppas. libsolid is version 4:4.8.0-0ubuntu1~oneiric1~ppa1.

Use-case: I have a laptop that I use as my primary desktop computer. As such, I like to keep it connected to a wall socket, so it can stay powered on at all times. I live in a rural area where intermittent short power outages are common. I have two long-haired Norwegian Forest cats that like to walk all over keyboards, pressing random keys (including power button) and clogging my keyboard with fur.

To prevent the cats strutting/sleeping on the keyboard when it's stationary, I close the lid when I'm not using it. I have the 'lid closed' event set to suspend the machine, with the common use-case where I'm sometimes moving the computer around and want to rely on fast suspend-resume to save battery.

When a power blackout strikes and the device is...
1. connected to a (suddenly powerless) wall socket
2. not currently being used (lid closed to ward it from cats)
...it suspends.

An alternative use-case is having a glitchy AC adapter.

Reproducible: Always

Steps to Reproduce:
1. Set 'lid closed' event to suspend machine on the On Battery profile
2. Set 'lid closed' event to Do Nothing or Turn Off Screen in the On AC Power profile
2. Connect AC adapter
3. Close lid, simulate as not being in use
4. Disconnect AC adapter to simulate power blackout or glitchy adapter connector

Actual Results:  
5. Machine suspends!

Expected Results:  
6. Machine does not suspend as the lid was not purposedly closed when on battery

I see this snippet in kde-workspace/powerdevil/daemon/powerdevilcore.cpp:421 (or thereabouts) at the end of Core::loadProfile(bool force);

>    // If the lid is closed, retrigger the lid close signal
>    if (m_backend->isLidClosed()) {
>        emit m_backend->buttonPressed(PowerDevil::BackendInterface::LidClose);

May the behavior be changed to not retrigger the lid closed event upon profile change? (Add an option?) Is there a conflicting use-case?
Comment 1 Carlos Alberto Espinal 2012-02-21 05:42:32 UTC
Confirmed here as well...
Comment 2 Alex Fiestas 2013-03-03 16:18:37 UTC
Is this happening with 4.10?
Comment 3 Alex Fiestas 2013-04-25 16:24:27 UTC
Going to close the bug for lack of feedback.

Lot has changed since the bug was reported, tried to reproduce (when I first asked for feedabck and now) and can't reproduce.

Please, if you are still able to reproduce this bug with KDE 4.10 reopen the bug.

Thanks !