Bug 875415 - When closing laptop lid, a "double sleep" occurs.
Summary: When closing laptop lid, a "double sleep" occurs.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mate-power-manager
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dan Mashal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-11 04:21 UTC by William Brown
Modified: 2012-12-06 07:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-20 23:09:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description William Brown 2012-11-11 04:21:14 UTC
Description of problem:
When closing the lid of a laptop to suspend the machine. When you reopen the laptop, the system wakes briefly before suspending again. Waking the system again, after this allows you to continue work. 


How reproducible:
Always

Steps to Reproduce:
1. Install MATE on a laptop
2. Close laptop lid
3. Reopen laptop
  
Actual results:
Laptop resumes, then suspends immediately. 

Expected results:
Should resume, and display unlock screen

Additional info:
I have already removed xscreensaver, and am using mate-screensaver. The machine has been rebooted, and xscreensaver autoruns removed. The machine is set to use suspend on lid close both on AC or battery.

Comment 1 Rex Dieter 2012-11-11 13:52:53 UTC
f18+ systemd provides support for this.  Looks like mate-power-manager needs to learn to inhibit that feature.

Here's a snippet from lennarts mass-bug-filing to kde about it awhile back:


With systemd-190 (in F18) we changed the handling of the sleep key/power key/lid switch. systemd/logind will now always act on this regardless if we have a text console or a graphical session in the foreground.

I am not sure whether KDE previously currently handles these keys on its own. If so, and if it wants to continue to do so (maybe in order to present a dialog or so if the key is pressed?) it needs to take new inhibitor locks to tell systemd/logind to stop handling these keys while KDE is running and in the fg.

Ideally, KDE would take these locks as part of its session manager in native C++. If that's not desired, then there's a temporary hack, by wrapping invocation of the KDE session manager in "systemd-inhibit", which is a command line iface for taking these inhibitor locks:

systemd-inhibit --what=handle-power-key:handle-sleep-key:handle-lid-switch kde-session

For more information about all of this:

https://bugzilla.gnome.org/show_bug.cgi?id=680689
http://www.freedesktop.org/wiki/Software/systemd/inhibit
http://lists.freedesktop.org/archives/systemd-devel/2012-September/006604.html

Comment 2 William Brown 2012-11-12 00:52:57 UTC
Since I already got my hands into the mate-power-manager code, I am happy to investigate the best way to handle this. Either a runtime flag, or a build switch perhaps to disable mate-power-managers interactions with the hardware switches. Should we also wrap the systemd apis, so that we can change the systemd sleep options from the mate-power-manager gui?

Comment 3 Rex Dieter 2012-11-12 01:10:12 UTC
My suggestion would be to simply disable/inhibit the systemd functions what mate-power-manager handles via the api(s) mentioned above, and be done with it.

Comment 4 William Brown 2012-11-12 11:34:30 UTC
I have had a look, and I agree, these apis seem pretty easy to use. 

A bit of a "practical" question for writing the fix to this. My thought is that this should go into gpm-manager.c. When the manager is created, we set the inhibitor, when it's destroyed, it's removed. Does that sound reasonable?

Comment 5 Rex Dieter 2012-11-12 15:41:54 UTC
reasonable +1

Comment 6 William Brown 2012-11-20 23:09:47 UTC
Fixed upstream https://github.com/mate-desktop/mate-power-manager/pull/37

Comment 7 Fedora Update System 2012-11-23 16:27:35 UTC
mate-power-manager-1.5.1-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/mate-power-manager-1.5.1-2.fc18

Comment 8 Fedora Update System 2012-11-23 16:28:16 UTC
mate-power-manager-1.5.1-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/mate-power-manager-1.5.1-2.fc17

Comment 9 Fedora Update System 2012-11-27 05:15:33 UTC
mate-power-manager-1.5.1-2.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2012-11-27 08:23:59 UTC
mate-power-manager-1.5.1-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/mate-power-manager-1.5.1-3.fc17

Comment 11 Fedora Update System 2012-12-06 07:02:30 UTC
mate-power-manager-1.5.1-3.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.