← Back to team overview

sony-vaio-z-series team mailing list archive

Re: Suspend to ram and disk (Quick how to)

 

Contact ePaps.net schrieb:
...
However, you probably want to automatize your SR11M so that it goes to sleep when the LID is closed. Therefore, you have to do the following: first, install the acpid package; then, create the file /etc/acpi/events/lid and put the following contents:
event=button/lid.*
action=/etc/acpi/actions/lid.sh "%e"

Now we will create the file /etc/acpi/actions/lid.sh and we will give execution rights to it: sudo chmod +x /etc/acpi/actions/lid.sh. The, you may do whatever you want in your script, but this is my simple example:
#!/bin/sh

# Easy way to send the laptop to sleep
echo "mem" > /sys/power/state
> ...

Here is a complementary bash script which you can use instead of the
simple "echo mem > /sys/power/state". It restores the original display
settings after wakeup, especially the backlight, which otherwise is set
to the highest value (at least on my system). It assumes that Eva's
sony-laptop module is installed.

-------------------------------------------------------------------
#!/bin/bash

# get current video

case $(</sys/devices/platform/sony-laptop/speed_stamina) in
(stamina)   videoId=00/02.0
            ;;
(speed)     videoId=01/00.0
esac

# Save video state in tmpfile

tmpfile=/tmp/video_state
trap 'rm -f $tmpfile' 0 1 15
cat /proc/bus/pci/$videoId > $tmpfile
sync

# suspend

echo mem > /sys/power/state

# resume, reset video state

sleep 2
cat $tmpfile > /proc/bus/pci/$videoId
rm -f $tmpfile
-------------------------------------------------------------------

Greetings,
Bernd

--
Bernd Eggink
http://sudrala.de





References