2011-03-29, 21:22
Dolence Wrote:alanww1, how do you do to implement suspend/wakeup?
I have an ASUS P7H55-M motherboard and an Philips SRM-5100 RC-6 remote. I cant wakeup after suspending.
Please, can you share your solution with us? Thanks in advance!
I use these startup scripts:
Code:
sudo nano -w /etc/init/xbmc.conf
sudo ln -s /lib/init/upstart-job /etc/init.d/xbmc
Code:
# xbmc-minimal
#
# init XBMC environment and starts XBMC in fullscreen (if asked to do so)
description "XBMC-minimal"
author "Luigi Capriotti - Modified by alanw"
start on (filesystem and stopped udevtrigger)
stop on runlevel [06]
pre-start script
if [ -f /home/xbmc/.xsession ] ; then
rm /home/xbmc/.xsession
fi
if [ -f /tmp/noRestartXBMC ] ; then
rm /tmp/noRestartXBMC
fi
end script
script
exec /usr/bin/runXBMC
end script
post-start script
status=`cat /proc/acpi/wakeup | grep "USB0" | awk {'print $3}'`
if [ "$status" = "*disabled" ]; then
echo USB0 > /proc/acpi/wakeup
fi
status=`cat /proc/acpi/wakeup | grep "USB1" | awk {'print $3}'`
if [ "$status" = "*disabled" ]; then
echo USB1 > /proc/acpi/wakeup
fi
status=`cat /proc/acpi/wakeup | grep "USB2" | awk {'print $3}'`
if [ "$status" = "*disabled" ]; then
echo USB2 > /proc/acpi/wakeup
fi
end script
pre-stop script
touch /tmp/noRestartXBMC
end script
sudo nano /usr/bin/runXBMC # check file runXBMC
sudo chmod a+x /usr/bin/runXBMC
Code:
#!/bin/bash
#/usr/bin/runXBMC
if [ "$(pidof X)" ] ; then
/usr/share/xbmc/xbmc.bin --standalone
exit
fi
while true
do
echo "#!/bin/bash" > /home/xbmc/.xsession
echo "/usr/bin/xbmc --standalone" >> /home/xbmc/.xsession
echo "case \"\$?\" in" >> /home/xbmc/.xsession
echo " 0 ) # Quit" >> /home/xbmc/.xsession
echo " touch /tmp/noRestartXBMC" >> /home/xbmc/.xsession
echo " break ;;" >> /home/xbmc/.xsession
echo " 64 ) # Shutdown System" >> /home/xbmc/.xsession
echo " sleep 10 ;;" >> /home/xbmc/.xsession
echo " 65 ) # Warm Reboot" >> /home/xbmc/.xsession
echo " echo "Restarting XBMC ..." ;;" >> /home/xbmc/.xsession
echo " 66 ) # Reboot System" >> /home/xbmc/.xsession
echo " sleep 10 ;;" >> /home/xbmc/.xsession
echo " * ) ;;" >> /home/xbmc/.xsession
echo "esac" >> /home/xbmc/.xsession
chown xbmc:xbmc /home/xbmc/.xsession
initctl emit starting-x
if [ "$(whoami)" == "root" ] ; then
su xbmc -c "startx -- -br > /dev/null 2>&1" -l
else
startx -- -br > /dev/null 2>&1
fi
if [ -e /tmp/noRestartXBMC ] ; then
rm /tmp/noRestartXBMC
rm /home/xbmc/.xsession
break
fi
done
And the key. To create an udev rule for enabling your usb device to wakeup the machine. Yo have to modify the vendor and device id with yours. You can check it with lsusb.
Code:
sudo nano /etc/udev/rules.d/90-mcewakeup.rules
Code:
# enable wake from S3 for MCE USB device 0471:0815
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", ATTRS{idProduct}=="0815" RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../power/wakeup'"