Saturday, 10 May 2008

Reason #232 for bringing an EEE into your life

For the hypothetical readers of my previous post: the operation was a success :-). I now have an EEE running the vast majority of my favorite software (storage is a problem), based on Kubuntu (but with lots of packages I don't use thrown out). Installation was by an indirect route - I bootstrapped it using the eeeXubuntu install media, which worked great, and set me up with some hot-key scripts. (Unfortunately volume up/down isn't working right now). After switching to Kubuntu, I then upgraded to Hardy, which broke suspend somewhat.

Obviously there's a lot I've left out. Suffice it to say that I'm now using the EEE as a desktop replacement. Apart from storage, which is fixable, the only regrets I can think of are

1. Flash sucks so bad it can't manage full-screen video on a 630Mhz Celeron (and no, I don't use compiz or similar effects). Mplayer can do it! Unfortunately Mplayer loses audio sync on flv files.
2. KDE4 isn't ready for prime-time, so I don't have a dashboard equivalent. It would be really handy to have a clock with the full date I could bring to the fore with a single keypress.

Though it does help that I can plug in a set of larger peripherals -

screen (xrandr goodness!)
keyboard (I bought a nice USB keyboard with this in mind to replace the battered and ancient incumbent)
speakers (quirk: the eee causes a background hum on the speakers, which is really quite loud - but it's much improved if you plug in an external monitor)

For completeness: I also built my own kernel - which has it's upsides and downsides. (The webcam driver doesn't work for some reason, and obviously I miss out on a certain amount of Ubuntu / community support). Also, I'm now an even heavier user of hibernation than before, with uswsusp for compression - useful for both space and faster resume times. Unfortunately I had to hack ubuntu to use uswsusp.

Now I can get to the point of today's post! That would be the magic of wake-on-RTC-alarm, transforming my laptop into a (internet) radio alarm clock. All low level at the moment. Though pm-utils has some support for it, and I assume HAL has been wired up to it, there's no alarm-clock GUI yet. So here's a set of commands I'm trying today:

sudo -s # gain privs for echo
echo 0 > /sys/class/rtc/rtc0/wakealarm # must clear any existing alarm first

# Test alarm - resume in next 4 minutes (hibernation takes a _long_ time. TODO, non-blocker
#t=`date +%s`; w=`expr $t + 240`; echo $w > /sys/class/rtc/rtc0/wakealarm

# Real usage - Alarm clock
w=`date -d "tomorrow 7:55" +%s`; echo $w > /sys/class/rtc/rtc0/wakealarm

pm-hibernate # Now hibernate
exit # drop privs

# Play BBC Radio 4. Yes, theres no reason why mplayer shouldn't be able to play .ram files directly
mplayer `wget -O-`

UPDATE: fixed date command so this actually works. Big caveat: this only seems to work on mains power - so unfortunately it's not a truly portable alarm clock. Probably not as eco-friendly as I was hoping for either.