Sunday 27 April 2008

Stop My Asus Eee PC Going Into Standby Mode When the Lid is Closed

I'm sitting on the train happily surfing the web on my Asus Eee PC using the now free WiFi Internet, available since National Express took over from GNER a few months ago (available on the UK east cost service anyway!). I use my Eee PC as an MP3/OGG player. I decided I wanted to stop surfing the web, and read a book instead (a momentous decision), this meant closing the lid of the Eee and leaning my book on top of it for maximum comfort. However, this reminded me that when you close the lid, the Eee automatically goes in to standby mode - very annoying if you want to carry on listening to music!

So, since I'm on the train and have nothing else to do, I thought I would investigate how to stop it going in to standby mode when you close the lid, and instead do nothing except turn the screen off.

It took a few mins to find out how to do it...

First, open a terminal. In easy mode (default Linux setup) simply press the CTRL, ALT and T keys on your keyboard all at the same time. The default terminal program in Easy mode is named lxterm.
(Info from: http://wiki.eeeuser.com/howto:openaterminal)

Then, in the console type

sudo kwrite /etc/acpi/lidbtn.sh

You should see

#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`if [ $LID_STATE = "closed" ] ; then
/etc/acpi/suspend2ram.sh
fi
exit 0


Replace with the code below and save the file.

#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'


if[$LID_STATE = "closed"]; then
# /etc/acpi/suspend2ram.sh
su user -c "DISPLAY=:0 xset dpms force suspend"
elif[$LID_STATE = "open"];then
su user -c "DISPLAY=:0 xset dpms force on"
fi


Close the lid to test. That's it.,
(Info from: http://wiki.eeeuser.com/close_lid_shutdown)