Tuesday, December 29, 2009

Hardware for the Holidays

It started with my disgust of Xandros on Lisa's netbook...

Basically, I bought Lisa a netbook a while back and although it's capable, honestly the OS was a smouldering pile of crud for the most part. The touchpad stopped working properly, it was slow and likely someone else would have given it up for dead. Digging around a bit, it looked to be a no-brainer to put Ubuntu remix on the thing, so I set about making it happen. Seriously 30 minutes into the experiment it became obvious that the folks at ASUS are either asleep at the wheel, need their heads examined or are taking payola from Redmond. Why? Because Ubuntu remix on this netbook feels more polished and stable than any out of the box OS experience I've had to date.

And Lisa is happy so I'm happy with it. I've been able to throw a lot of extra hardware configuration at it with literally no issues. i-Pod nano [x] Check. Canon MP620 (network, wireless, no less ;) [x] Check. Digital camera [x], Scanning over the network [x] -- some of the configuration took place while she was using the darn thing (apt-get is so nice over ssh). Xandros was almost completely out of disk space. It's running at about 70% space right now and happy as a clam.

The old Kodak DC215

While looking for a memory card I stumbled across an old digital camera I had in a drawer from 1999 (my old LinuxToday days). Hmmmm. Will it blend? ,I thought, mischievously. The Kodak DC215 was dead thanks to it being dropped and the battery tray getting slightly damaged. It was a pretty decent camera in its day, though. And I just couldn't bear something with such sentimental value being tossed out when it might make a really sweet web-cam. Soooo...

It turns out that Graham Crawford's SDK for the DC210 series cameras is still available. It's last update was in 2005, built for Red Hat back in the day. I needed a serial cable for the camera. Googling around a bit, I found a pin-out -- and a matching cable that probably came with the camera. So I had a serial cable, the software, and a broken battery tray. I needed a power supply. I have a drawer where I toss old out-dated power supplies ... found a matching cable for the lug on the camera, and the power-supply for a Netgear hub was close (7.5 volts -- hey, that's near 7 volts, right ;). So, some electrical tape, the cable, a Dell PC running Ubuntu -- we're all set. 30 minutes later I'm taking photo's with a shell script.

The photo's are available via serial (albeit a bit slow). It would be nice if I could pull them off the SD card directly from the Canon network printer -- it's one of the few devices I own that still has a Compact Flash (CF) reader. Is it possible? Turns out that you can use:

$ smbclient -I [IP address of Printer] /foo/canon_memory/ " "
And the "foo" above could be anything, for what it's worth. I'm mainly interested in the utilitarian value here of being able to have a nice, easy spot place in the house where the photo cards can be plugged in and the data sucked down to the central photo repository (where they're backed up, cataloged, etc).

Broken Digital Picture Frame

It's over 2 years old, and as far as comparing to the latest digital picture frames, pretty lame. On the balance side of the equation, though, we're not (Lisa and I) heavy digital picture frame users ;)

The pictures from our latest camera simply would not load on the thing. -- for one, it has a brain the size of a walnut, so the 8 mega-pixel shots were only going to load, one at a time, sometime in 2011 -- for the first one. That is, if it could read the Jpeg file format, which for some strange reason, it couldn't. I located the factory PDF manual for the thing, and it was about as clear and concise as raw enigma machine data. So I did what any decent hacker would do -- I started looking at the difference between the Jpegs from the old camera (the one from 1999) and the new ones. It turns out to be something missing in the EXIF data, a part of the Jpeg file format. If this sounds like something you've never heard of, my guess is that you're not into digital media much. I know I wish I could forget what I've learned about it all, because it took some digging around to discover all of the nasty stuff you can do to Jpegs to make them behave.

The digital picture frame isn't huge and has a really lame display -- like about 6x4 inches with an over-square rez of something like 900x250 (yes, it's really that bad). Meaning that 320x240 would look just fine on thing. The down side is that this kind of resolution is really pretty pathetic and it's not likely to win over anyone who is looking at the pictures for detail. On the plus side, however are the following facts:

  1. We're not looking at the frame for the quality of the pixels -- just for sentiment.
  2. It has a brain the size of a walnut; 320x240 images load very quickly.
  3. With the rez of the frame, 320x240 looks about as good as anything else, anyway.
  4. You can cram quite a bit of 320x240-sized, compressed Jpegs on a 2Gig SD card.
  5. My eyesight isn't all that great up close anyway ;)
Sooo, off to the races -- could I find a way to?:
  1. Shrink our catalog of photos easily.
  2. Fake out the EXIF header such that the frame would read it.
  3. Not interfere with the normal operation of the SD card otherwise.
And the answer is, of course, with Linux, just about anything is possible. The key operating lines of a script (which ran for about 3 hours total on about 1/3 of our catalog of digital pictures) are:
        [ $DEBUG -gt 0 ] && echo From $J to $DIRNEW/$FILENEW
        /usr/bin/convert $J -resize x240 $DIRNEW/$FILENEW
        [ $DEBUG -gt 0 ] && /bin/ls -l $DIRNEW/$FILENEW
        /usr/bin/jpegtopnm $DIRNEW/$FILENEW > $P1
        /usr/bin/pnmtojpeg $P1 -exif=$EXIF > $DIRNEW/$FILENEW
        [ $DEBUG -gt 0 ] && /bin/ls -l $DIRNEW/$FILENEW

The EXIF header being inserted in the pnmtojpeg line above is completely bogus. It's not even the right resolution -- the digital picture frame simply doesn't care (Lisa's iPod nano is a different story, by the way -- it worked for all of the pictures taken landscape). The pictures ended up tiny -- 2500 pictures taking up a whopping 80 Megabytes -- literally pennies on the dollar, space-wise. This means that I can simply put the script in the root directory of the flash card and make it execute upon insertion on her netbook. Imake a directory called "DFRAME" next to the "DCIM" directory, and clone files into there. Works like a charm. I'm fairly certain that I can simply pull an EXIF header with the right proportions to fix the script so her iPod nano can show them properly.

Through all of this, the joy of having an operating system that behaves (and can run software from literally a decade ago) is something to behold.

Happy Hardware for the holidays!