Having recently triumphed over my wirelss card (machine #1 in sig), many kudos to you helpful slackers, I decided to tackle ACPI sleep state 3.
Found an
article and followed it. I had to insert some sudo commands (quite liberally) to get it to run without exiting due to permission errors.
As it is now:
Code:
#!/bin/sh
# discover video card's ID
ID=`/sbin/lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`
# securely create a temporary file
TMP_FILE=`mktemp /var/tmp/video_state.XXXXXX`
trap 'rm -f $TMP_FILE' 0 1 15
# switch to virtual terminal 1 to avoid graphics
# corruption in X
sudo chvt 1
# write all unwritten data (just in case)
sudo sync
# dump current data from the video card to the
# temporary file
cat /proc/bus/pci/$ID > $TMP_FILE
# suspend
sudo echo -n mem > sudo /sys/power/state
# restore video card data from the temporary file
# on resume
sudo cat $TMP_FILE > sudo /proc/bus/pci/$ID
# switch back to virtual terminal 7 (running X)
sudo chvt 7
# remove temporary file
sudo rm -f $TMP_FILE
the script runs without any reported errors.
however, all it does (visibly) is switch virtual terms and come right back to where I started from. With no button pushing whatsoever. The way I understood the above article was that the script would suspend to ram, then when the power button was pushed again, the rest of the script would restore.
I'm now thinking I need to link some event to the second half of the script? (after the # suspend comment)
I did try entering these commands (sans variables) as my normal self; at the:
Code:
sudo echo -n mem > sudo /sys/power/state
nothing really happend. is this the wrong command? (syntax?) the 'double' sudo thing got me around yet another permission error.
tips/clues/suggestions/canned script/personal experiences/tidbits/torrential downpour of pity for me being so blatantly incompetent?
all of the above are welcome yet not equally so
thanks!