crshman's Profile Page

Tag-Archive for » HTPC «

Saturday, September 11th, 2010 | Author:

Hey All,

I apologize for not having any updates. I’ve been busy with work and haven’t really done any personal projects or coding =(

However, I finally got some free time and I’ve been wanting to fix something that has bugged me for a while now. I have my wonderful HTPC and it’s setup up to useĀ XBMC to play all the media that stored on my fileserver. In the past I’ve always had to press the button on my case to turn the darn thing on. Well I got tired of that and I figured there had to be a way to turn on my computer with the remote. It’s got a USB dongle that stays lit up, so that means it’s powered and the OS is waiting for commands. (BTW I made sure to enable wake on USB in my bios for this to work!)

As the old saying goes, necessity is the mother of all invention, well I needed to become more lazy so I wrote this little script that finds a gyration remote dongle on your USB subsystem and allows for it to be used as a device to wake the system from the S3 (suspend) state. This init script runs on boot to keep the settings persistent after a reboot.

#!/bin/bash
# gyrationWakeFromS3.sh

#
# Author: Robert Navarro 9/11/10
# Contact: crshman[at]gmail.com
#
# This init script finds a usb device by 'device' and makes it so it can be used to wake up a system from the S3 state

# Set /proc/acpi/wakeup to allow USB devices to wake the system
# sudo sh -c "echo USB3 > /proc/acpi/wakeup"

device='Gyration'

# Grab the pci ID for our device
pciID=$(cat /proc/bus/input/devices |grep -A2 -m1 $device |grep S\: |awk -F'/' '{ print $4 }')
#echo $pciID

usbID=$(cat /proc/acpi/wakeup |grep $pciID |awk -F' ' '{ print $1 }')
#echo $usbID

echo $usbID > /proc/acpi/wakeup

Just drop that script into your /etc/init.d/ folder and run the following:

#sudo update-rc.d gyrationWakeFromS3.sh defaults

Whala! You should now have resume support from your Gyration device. A little note here, in the init.d file you can certainly change which device wakes your system by changing the value of the ‘device’ variable.

Drop me a line if you have any questions about this!

Category: Development  | Tags: ,  | Comments off