bssteph l33t


Joined: 26 Feb 2003 Posts: 652 Location: Wisconsin
|
Posted: Sun Dec 12, 2010 5:17 pm Post subject: Have HAL treat suspend as suspend-hybrid |
|
|
For putting my laptop to sleep, I like the idea of suspend to both --- Linux's suspend to RAM has never been bulletproof for me, and if I ever have a prolonged power outage (or I just forget that a laptop was suspended and I accidentally keep it off battery), I'd like to know that I haven't horked everything. Suspend to disk is much more reliable, and works as a great fallback.
Unfortunately, KDE doesn't have a "suspend to both" option in PowerDevil, so I decided to hack it in via HAL. It was fairly simple, I just had to override the default configuration with one that calls suspend-hybrid for the suspend option:
I created the following:
/etc/hal/fdi/policy/09-power-mgmt-policy.fdi
Code: | <?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.udi" string="/org/freedesktop/Hal/devices/computer">
<!-- replace hal-system-power-suspend position with hal-system-power-suspend-hybrid -->
<merge key="org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths" type="strlist">hal-system-power-suspend-hybrid</merge>
<append key="org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths" type="strlist">hal-system-power-suspend-hybrid</append>
<append key="org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths" type="strlist">hal-system-power-hibernate</append>
<append key="org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths" type="strlist">hal-system-power-shutdown</append>
<append key="org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths" type="strlist">hal-system-power-reboot</append>
<append key="org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths" type="strlist">hal-system-power-set-power-save</append>
</match>
</device>
</deviceinfo>
|
... which is a copy of the keys, in order, from /usr/share/hal/fdi/policy/10osvendor/10-power-mgmt-policy.fdi, aside from the entry of "hal-system-power-suspend" which I replaced with "hal-system-power-suspend-hybrid". (If there is a better way to manipulate this in HAL-speak than what I did, let me know.)
Now, when I click the "Sleep" button in KDE, I can see it write the memory to disk (calling s2both, in my case) before going into sleep state. |
|