+#!/bin/sh
+
+# discover video card's ID
+ID=`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
+
+# 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
+
+# Stopping network.
+# Sony VAIO PCG-Z505RX and PCMCIA Linksys wifi card
+/etc/rc.d/init.d/network stop
+
+echo "Entering suspend mode"
+
+# suspend
+echo -n mem > /sys/power/state
+
+echo "Resuming"
+
+# restore video card data from the temporary file
+# on resume
+cat $TMP_FILE > /proc/bus/pci/$ID
+
+/etc/rc.d/init.d/network start
+
+# remove temporary file
+rm -f $TMP_FILE