Code: Select all
#!/bin/sh
# this script was adapted for Puppy 2.12 by EdB, from the original in
# http://www.linux.com/article.pl?sid=06/05/24/1716222
# discover video card's ID
ID=`lspci -i /usr/share/pci-usb-pcmcia.ids | 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 2 to avoid graphics
# corruption in X
chvt 2
# write all unwritten data (just in case)
sync
# dump current data from the video card to the
# temporary file
cat /proc/bus/pci/$ID > $TMP_FILE
# suspend
echo -n mem > /sys/power/state
# restore video card data from the temporary file
# on resume
cat $TMP_FILE > /proc/bus/pci/$ID
# switch back to virtual terminal 3 (running X)
chvt 3
# remove temporary file
rm -f $TMP_FILE
# needed by my wlan internal card!
iwconfig wlan0 essid any
Please test it on your laptops and let me know... I plan to include it in my next puplet