Strange settings-daemon power behavior

3 replies [Last post]
kpengboy
Offline
Joined: 09/08/2013

I set my power settings to suspend if my laptop is on battery power and the lid is closed, and to hibernate if it is plugged in and the lid is closed. This works fine when I boot with the AC disconnected. However, if I start the computer when it is plugged into AC power and then disconnect the AC power, the computer still hibernates when I close the lid (when it should suspend). It's as if, when the computer is booted while connected to AC, the power daemon doesn't detect when the computer is unplugged. I wonder if you guys have some pointers about this issue.

lembas
Offline
Joined: 05/13/2010

Start on AC and

*Check the value of /proc/sys/vm/laptop_mode and then yank the power cable and recheck that file. Should change from 0 to 5.

*Does upower notice AC to battery? Run the following command and then yank the cable.

upower --monitor
kpengboy
Offline
Joined: 09/08/2013

When I start on AC, /proc/sys/vm/laptop_mode remains 0 when I unplug the cable. But upower --monitor notices that the battery changed and the icon in the Panel changes too.

Everything works when I start on battery.

lembas
Offline
Joined: 05/13/2010

Interesting! Do the scripts get run in /usr/lib/pm-utils/power.d/ ? (Make a script that does something easily verified, e.g. creates a file on desktop or whatever and then switch power)

If those are run, you could make a dirty little hack by changing the lid behaviour manually using the gsettings command. The relevant keys are e.g.

org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing'

(I've set them to nothing because my buggy hardware cannot suspend since 5.5... gotta love hw bugs)