Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Have HAL treat suspend as suspend-hybrid
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
bssteph
l33t
l33t


Joined: 26 Feb 2003
Posts: 652
Location: Wisconsin

PostPosted: Sun Dec 12, 2010 5:17 pm    Post subject: Have HAL treat suspend as suspend-hybrid Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum