immediately suspends on startup when lid is closed

Bug #385135 reported by Martin Pitt
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
DeviceKit-Power
Fix Released
Medium
gnome-power
Unknown
High
devicekit-power (Ubuntu)
Fix Released
Medium
Martin Pitt

Bug Description

Binary package hint: gnome-power-manager

2.27.1 now enables suspend on lid close by default. This is great in principle,
but it falls over if you keep your laptop in a docking station, and thus the
lid is closed all the time. When g-p-m starts up, I guess the recent fix for
lid properties [1] triggers a change event, and the computer suspends
immediately.

So for this problem I think g-p-m should not do any suspend/hibernate action on
startup. Perhaps it is possible to fix the event generation to suppress the
initial change event for lid status?

Unfortunately I can't attach a g-p-m debug output, since suspend is broken for
me right now (complete freeze after wakeup).

http://git.gnome.org/cgit/gnome-power-manager/commit/?id=90000eb88dbc4ef404f6be0940a0b64572c588ff

ProblemType: Bug
Architecture: amd64
Date: Tue Jun 9 11:52:48 2009
DistroRelease: Ubuntu 9.10
Package: gnome-power-manager 2.27.1-0ubuntu2
ProcEnviron:
 PATH=(custom, user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.30-8.9-generic
SourcePackage: gnome-power-manager
Uname: Linux 2.6.30-8-generic x86_64

Revision history for this message
Martin Pitt (pitti) wrote :
Revision history for this message
Martin Pitt (pitti) wrote :

As for the non-default gconf keys, setting

  /apps/gnome-power-manager/buttons/lid_ac=blank

works around this issue.

Changed in gnome-power-manager (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
tags: added: regression-potential
Changed in gnome-power:
status: Unknown → New
Revision history for this message
Franco Bombi (franco.bombi) wrote :

I have just installed the 2009-06-16 daily built of Karmic on my Acer TravelMate 370.
The system goes into suspend mode at start-up with the lid open.

I can then resume operation OK.

Steve Beattie (sbeattie)
Changed in gnome-power-manager (Ubuntu):
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
Revision history for this message
In , Martin Pitt (pitti) wrote :

This was originally filed against gnome-power-manager in http://bugzilla.gnome.org/show_bug.cgi?id=585228, but I think it belongs to dk-p.

2.27.1 now enables suspend on lid close by default. This is great in principle,
but it falls over if you keep your laptop in a docking station, and thus the
lid is closed all the time. When g-p-m starts up, the recent introduction of the "lid-is-closed" property into dk-p [1] and g-p-m [2] cause this:

 1. g-p-m starts the very first time (such as in gdm)
 2. This D-BUS activates devicekit-power-daemon
 3. dk-p sends a lid event:

TI:10:18:00 TH:0x17f6050 FI:dkp-input.c FN:dkp_input_coldplug,255
 - using /sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input0/event0 for lid event
TI:10:18:00 TH:0x17f6050 FI:dkp-daemon.c FN:dkp_daemon_set_lid_is_closed,108
 - lid_is_closed=1

 4. g-p-m picks it up:

TI:10:06:35 TH:0xcb3d00 FI:gpm-button.c
FN:gpm_button_client_changed_cb,554
 - ************* gpm_button_client_changed_cb: lid: 1
TI:10:06:35 TH:0xcb3d00 FI:gpm-button.c FN:gpm_button_emit_type,101
 - emitting button-pressed : lid-down
TI:10:06:35 TH:0xcb3d00 FI:gpm-manager.c
FN:button_pressed_cb,737
 - Button press event type=lid-down
TI:10:06:35 TH:0xcb3d00 FI:gpm-manager.c
FN:lid_button_pressed,645
 - **************** lid_button_pressed 1
TI:10:06:35 TH:0xcb3d00 FI:gpm-manager.c
FN:lid_button_pressed,658
 - Performing AC policy
TI:10:06:35 TH:0xcb3d00 FI:gpm-manager.c
FN:manager_policy_do,408
 - policy: /apps/gnome-power-manager/buttons/lid_ac

IMHO dk-p should not emit a lid event on startup, since g-p-m and other clients shoulnd't special-case dk-p activation. They need to work also on second login, etc., when dk-p is already running.

[1] http://cgit.freedesktop.org/DeviceKit/DeviceKit-power/commit/?id=7bd2dfefcb88d2e40402f4e1272dd70255d34b87
[2] http://git.gnome.org/cgit/gnome-power-manager/commit/?id=90000eb88dbc4ef404f6be0940a0b64572c588ff

Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=27290)
suppress initial change event

What do you think about this patch? It works for me.

Revision history for this message
In , Richard Hughes (richard-hughes) wrote :

(In reply to comment #1)
> What do you think about this patch? It works for me.

Yup, please apply. Looks fine to me.

Revision history for this message
In , Martin Pitt (pitti) wrote :

> Yup, please apply. Looks fine to me.

Was that for me? (-EPERM)

Revision history for this message
In , Richard Hughes (richard-hughes) wrote :

(In reply to comment #3)
> Was that for me? (-EPERM)

Sure. If you want commit then open bug in fd.o, cc me, and I'll give my approval.

Are you sure that you've not got commit? -- I seem to remember that you have commit on HAL, and the group list is the same as that IIRC.

If you can't be arsed, say so and I'll commit on your behalf :-)

Revision history for this message
In , Martin Pitt (pitti) wrote :

Yes, I already tried that a while ago:

$ ls -ld /git/DeviceKit/DeviceKit-power.git/
drwxrwsr-x 7 david devicekit 4096 2008-08-01 03:12 /git/DeviceKit/DeviceKit-power.git/

$ groups
freedesktop hal

So it's a different group.

I requested upload privs in bug 22578.

Thanks!

Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=27294)
git formatted patch of the above

For your convenience. :-)

Revision history for this message
In , Richard Hughes (richard-hughes) wrote :

(In reply to comment #6)
> Created an attachment (id=27294) [details]
> git formatted patch of the above

Committed. Thanks dude.

Revision history for this message
Martin Pitt (pitti) wrote :

I debugged this some more, and I think it should be fixed in dk-p. See upstream bugs for details.

affects: gnome-power-manager (Ubuntu) → devicekit-power (Ubuntu)
Changed in devicekit-power (Ubuntu):
assignee: Canonical Desktop Team (canonical-desktop-team) → Martin Pitt (pitti)
status: Triaged → In Progress
Changed in devicekit-power:
status: Unknown → Confirmed
Martin Pitt (pitti)
Changed in devicekit-power (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package devicekit-power - 008-2~ubuntu1

---------------
devicekit-power (008-2~ubuntu1) karmic; urgency=low

  * All Ubuntu changes committed to Debian git. Upload git snapshot to get
    recent lid handling bug fix.

devicekit-power (008-2) UNRELEASED; urgency=low

  [ Martin Pitt ]
  * Add 01-pm_powersave.patch: Call pm-powersave, so that packages which ship
    /etc/pm/power.d/ scripts continue to work. Patch taken from upstream git
    head.
  * Add 02-suppress-startup-lid-event.patch: Suppress lid change event on
    startup. Otherwise, gnome-power-manager picks up a "lid is closed" change
    event when dk-p gets D-BUS activated, and thus immediately suspends the
    machine on startup. (FD #22574, LP: #385135)
  * Add quilt build dependency.

 -- Martin Pitt <email address hidden> Wed, 01 Jul 2009 11:55:26 +0200

Changed in devicekit-power (Ubuntu):
status: Fix Committed → Fix Released
Changed in devicekit-power:
status: Confirmed → Fix Released
Revision history for this message
In , Loïc Minier (lool) wrote :

Hi folks

This breaks the first suspend resume for me when I close the lid.

What happens is that:
1. on startup dkp assumes lid is closed
2. on input coldplug it detects lid as truly closed; this doesn't set initialized though
3. on the first lid event (lid close to suspend in my case) the event is swallowed because of this patch

I could offer a fix to set initialized in case 2. as well, but I don't like the general approach very much. Instead I'd like to offer a different approach which is to add a flag to set_lid_is_closed to disable notifications and use that only on input coldplug.

Revision history for this message
In , Loïc Minier (lool) wrote :

Created an attachment (id=27417)
Add a notify flag to set_lid_is_closed and use it only on input cold plug

Revision history for this message
In , Loïc Minier (lool) wrote :

Created an attachment (id=27418)
git format patch of notify flag addition

Revision history for this message
In , Loïc Minier (lool) wrote :

Created an attachment (id=27419)
log of dkp --verbose exposing the issue (before patch)

Revision history for this message
In , Loïc Minier (lool) wrote :

Created an attachment (id=27420)
log of dkp --verbose once fixed (with the patch)

Revision history for this message
In , Martin Pitt (pitti) wrote :

Thanks, Loic. I like this approach better. I tried to apply it to 009, but unfortunately I can't really test it since g-p-m bails out with

$ gnome-power-manager --debug

(gnome-power-manager:4054): devkit-power-gobject-WARNING **: unhandled property 'recall-vendor'
**
devkit-power-gobject:ERROR:dkp-device.c:193:dkp_device_collect_props_cb: code should not be reached
Aborted (core dumped)

I'll investigate this, and report back about this patch later here.

Revision history for this message
In , Richard Hughes (richard-hughes) wrote :

(In reply to comment #13)
> Thanks, Loic. I like this approach better. I tried to apply it to 009, but
> unfortunately I can't really test it since g-p-m bails out with

You need to grab a patch for gnome-power-manager:

commit 655dc92e5b2259d008021d5258e77b00e3d5bfad
Author: Richard Hughes <email address hidden>
Date: Fri Jul 3 10:11:09 2009 +0100

    Be less asserty if newer enums get added to DeviceKit-power

If you're using a new DKP with an old g-p-m.

Revision history for this message
In , Richard Hughes (richard-hughes) wrote :

(In reply to comment #10)
> Created an attachment (id=27418) [details]
> git format patch of notify flag addition

I've applied this, thanks.

Richard.

Revision history for this message
In , Martin Pitt (pitti) wrote :

Ah, apparently 009 broke ABI without bumping shlibs. A mere g-p-m rebuild was enough.

I tested the patch now and confirm that it works just fine in both cases (lid closed in docking, and lid open/first suspend).

Thanks!

Revision history for this message
Loïc Minier (lool) wrote :

Hey, the fix is breaking it in the other way around for me; I'm reopening this so that we use a different fix which I'll attach.

Changed in devicekit-power (Ubuntu):
assignee: Martin Pitt (pitti) → Loïc Minier (lool)
status: Fix Released → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package devicekit-power - 008-2~ubuntu2

---------------
devicekit-power (008-2~ubuntu2) karmic; urgency=low

  * New patch, 03-only-suppress-startup-lid-event-not-the-first-one, makes the
    signal sending in set_lid_is_closed optional and uses that instead of the
    initialized flag introduced in 02-suppress-startup-lid-event (which isn't
    working if you start with an open lid); LP: #385135. This change is not
    yet in the Debian tree though so rename Vcs fields to XS-Original-%s.

 -- Loic Minier <email address hidden> Mon, 06 Jul 2009 16:40:03 +0100

Changed in devicekit-power (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

I'm about to do a Debian upload for 009 anyway, so I'll test/apply the patch, and then sync to Karmic. Merci beacoup, Loic!

Changed in devicekit-power (Ubuntu):
assignee: Loïc Minier (lool) → Martin Pitt (pitti)
status: Fix Released → In Progress
Martin Pitt (pitti)
Changed in devicekit-power (Ubuntu):
status: In Progress → Fix Released
Changed in gnome-power:
status: New → Invalid
Changed in devicekit-power:
importance: Unknown → Medium
Changed in gnome-power:
importance: Unknown → High
status: Invalid → Unknown
Changed in devicekit-power:
importance: Medium → Unknown
Changed in devicekit-power:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.