Hardcore Food

I was looking through my cookery books for meatball recipes, and this was one of them.

It just seems too hardcore for me.  It starts with “half a kilo of meat from ox, calf, sheep, horse, moose, whale”.  And then you add blubber or lard or whatever “spekk” is.  And half a liter of milk.

Yum?

Quimby Upgrade

The old Quimby

Quimby (the machine doing everything at *.gnus.org) has been unstable lately.  (It’s died mysteriously two times.)  So instead of investigating what’s going on, I just installed Debian Squeeze on a new machine and rsynced over all the pertinent parts.  The old Debian installation was too stale, anyway, and 32-bit, so it was probably time.

The old machine (pictured at the top) was a self-built 2U machine with a couple of disks.  The new one is a 1U machine with dual dual-core 2.4GHz Opteron CPUs.  It’s ridiculously over-powered, but what are you going to do?  It was a six year old machine ready for the scrap heap.

The new Quimby

It is bemusing that a machine that old is that over-powered these days.  However, going further back in time is usually not very rewarding.  You get into serious problems with what kind of disks they’ll accept, for instance. Even this one was problematic.  It refused to boot up if there was a SATA disk larger than 500GB installed.  So I’d either have to use an external USB2 disk (which is not a very attractive solution) or use smaller disks and RAID5 them together.  I went for the latter option, but it’s still slightly exasperating that something as stupid as that should be a problem.  The last BIOS upgrade was from 2006, and didn’t help.

Oh, well.  The travails of a free software programmer.

Alarm Clock

The alarm clock before I started writing this article

Most alarm clocks have somewhat awkward interfaces, which may be why so many people have switched to using their mobile phones instead.  Most mophos have alarm clocks that are easy to use — just open the clock app, choose a menu item and type in the time.  Especially for people like me, who doesn’t get up at the same time each day, using a traditional alarm clock is annoying beyond endurance.  It’s an outrage!  I’ll write my congresscritter!

Anyway, where was I?  Yes.  An alarm clock needs a numeric input pad. But, of course, I find using a mopho to be annoying, too, since I wake up all the time and need to be able to see what time it is before continuing to sleep.

I’m easily annoyed and sleep unsoundly.  There’s probably no connection between the two things.

Alarm clock control device

Anyway, I wrote an Emacs-based alarm clock, which, as a bonus, shows just how cold it is outside, too.  If it’s too cold, I just ignore the alarm and keep on sleeping. And it displays the time using the Futura type face.  How could you use an alarm clock with an inferior font?

To control the thing, I thought it’d be perfect to use a wireless keypad.  It allows me to set the alarm very easily (just type 8 RET of 730 RET). However, finding a keypad that had the required range turned out to be pretty difficult.  I went through five different ones before I ended up with this one, a Logitech N305.  All the other ones either only had a two meter range, tops, or were totally unreliable.  The N305 only has a single unusable key, the “Excel” key, so I use the rest of the keys to control the volume of the music and the lights in the bedroom.

MiniGoose temperature sensor
The new alarm clock. See? Much nicer. And warmer

Writing this it occurred to me that I had a spare tiny FitPC2 computer, and a 10″ USB-powered DisplayLink monitor that I had never used.  Instead of using the (really too big) eMachines all-in-one (seen at the top there) as the alarm clock, I could perhaps use the FitPC2 instead?

And I could!

DisplayLink technology is pretty new, and there are some quirks, so in case you have a similar setup and is Googling for how to get it to work under Linux (Debian Squeeze, Linux kernel 2.6.38), the rest of this blog entry is for you.

# lsusb -v
Bus 001 Device 005: ID 17e9:0288 Newnham Research
[…]

  idVendor           0x17e9 Newnham Research
  idProduct          0x0288
  bcdDevice           f0.02
  iManufacturer           1 DisplayLink
  iProduct                2 Monztor S10
  iSerial                 3 10270020

The iMo 10″ screen comes up as a cdrom device:

[    3.408147] sr0: scsi3-mmc drive: 8x/40x writer xa/form2 cdda tray
[    3.408372] cdrom: Uniform CD-ROM driver Revision: 3.20
[    3.409760] sr 2:0:0:0: Attached scsi CD-ROM sr0

So you have to use usb_modeswitch to switch it to DisplayLink mode:

usb_modeswitch -v 0x17e9 -p 0x0288 -u 1

After doing that, the screen should go green, but X won’t work on it.  Say the following:

rmmod udlfb
modprobe udlfb fb_defio=1

and you should now be able to start Xorg on the device.

Section “Device”                                                 
   Identifier  “MimoDevice”
   Driver      “fbdev”               
   Option      “fbdev” “/dev/fb0”
EndSection

Section “Screen”                                                 
   Identifier  “MimoScreen”              
   Device      “MimoDisplay”   
   Monitor     “MimoMonitor”   
   SubSection “Display”                         
     Depth       16                      
     Modes       “1024×600”
   EndSubSection                                    
EndSection

See?  It couldn’t be simpler.

The Mimo USB monitor is quite nice, by the way.  It’s also a touch screen and a USB hub, but it’s not a floor wax.   However, the contrast leaves something to be desired, and the viewing angle isn’t very good. But it’s good enough to use as an alarm clock.

Adding Commands to mplayer

The computer I use to watch DVDs (and other stuff) with has three sound outputs: via HDMI to the TV, via the built-in analogue sound port to my wireless headphones, and via a USB sound card to external stereo speakers.  Which one I use depends on what I’m watching and what time of day it is.

So it would be nice to be able to change where the sound goes to on the fly. mplayer doesn’t have built-in support for it, but you could do this externally via a PulseAudio or the like, but since mplayer is occupying the screen and getting the commands, it seemed easier to just hack mplayer.

And, besides, each audio sink needs a different video/audio delay. The TV, for instance, delays the picture a bit, so if I’m listening over the headphones, I need to subtract a tenth of a second for the audio delay.  Or something.  I just experimented until I got something where Jon Stewart looked marginally less unhinged.

It turned out that adding commands to mplayer is really easy, but digging into the code this big can be pretty bewildering.  So if you ever want to add commands and keystrokes to mplayer, I’ve put the patch on the interwebs. It probably won’t apply cleanly to your specific mplayer version (and you wouldn’t want to, since it hard-codes my specific commands), but it should give you a rough idea of where to poke around.

An Emacs-based PVR

In the continuing story of me trying to push a few of the odds and ends of the code I’ve written for my own use, we’ve now come to the Emacs-based PVR. As usual, it may not actually be very useful code for, like, normal human beans, but why not push it out there?  Perhaps somebody will be inspired to do…  something.

So the story behind this piece of code is that I’ve never really been very fond of watching TV live.  I know, these days nobody does that any more, and everybody uses their cable company supplied (and crappy) PVRs, but back at the start of the millennium, it was a not un-novel idea.

USB TV card

And my implementation of it, based on Emacs, is probably noveller (that should be a word) than most.

So the idea is basically that we pull down the TV programme (thoughtfully provided by the XMLTV project), see what programs we want to record, and then record them.  It’s simple.  Since it’s Emacs-based, I can just ssh in to my machine from anywhere and add new programs to the list of stuff to be recorded from anywhere.  Take that, User Experience people.

The computer is hooked up to an external USB tv card that provides an MPEG stream.  So the actual recording is just “cat /dev/video0 > /tv/file”.

The nice little box running Linux

The cable company calls me sometimes and asks me if I kindly could consider switching over to digital cable, but then my PVR thingie would stop working, so that’s out of the question.  If analogue cable goes, I stop watching TV.

The only problem (for some values of “problem”) with this setup is that I can’t watch TV live easily even if I wanted to.  But I’ve been running stuff this way for a decade, and that hasn’t really tempted me more than a couple of times, so, eh, whatev.