This is something that's been bugging me for quite some time now. I have a Canon Powershot S400 (Digital Elph), which uses Compact Flash (CF) cards as the storage medium. In addition to that, I bought a Lexar Jumpshot CF reader dongle thingy that allows me to just read images off the CF card without having to turn on the camera. But to use this under linux was a copmlete pain in the ass. I had to login as root, load some modules, yada, yada, yada.

I figured there just had to be a better way. And besides, this procedure will probably work for lots of other USB devices besides the Jumpshot Card Reader.

Before you get too far, and for the following instructions to actually work, you will have to configure/rebuild your linux kernel so that it pretty closely meets the following requirements (I chose to build nearly all of these as modules):

You will then have to do go through the usual steps of building and installing the new kernel and modules. Configure your boot loader for the new kernel version, reboot, and proceed to the next step

The next thing you'll need to do is make sure you have the Linux Hotplug utilities installed on your machine. If you're using Gentoo Linux, this would look like:

> emerge hotplug
  

Once the installation is complete, you should have a shiny new /etc/hotplug directory. Make sure that the hotplug startup script has been started (/etc/init.d/hotplug) and configured to execute the next time you restart your machine. We're going to hack one of the installed shell scripts temporarily to help us figure out what vendor and model device the kernel thinks we have. If you are configuring a Jumpshot Compact Flash card reader, make sure the card reader (without the card) is plugged into one of the USB ports on your machine before proceeding.

> cd /etc/hotplug
> vim usb.agent

Inside this file, find this passage, near line 128:

# than a float: e.g. 1.0 become 0100
PRODUCT=`echo $PRODUCT | sed -e "s+\.\([0-9]\)$+.\10+" -e "s/\.$/00/" \

And change to read as follows:

# than a float: e.g. 1.0 become 0100
echo "PROD: $PRODUCT" >> /root/hotplug
PRODUCT=`echo $PRODUCT | sed -e "s+\.\([0-9]\)$+.\10+" -e "s/\.$/00/" \
 

You should now plug-in your USB device (or put the Compact Flash card into the card reader). Blinky lights should blink for a few seconds. Once they've stopped, do the following:

> cat /root/hotplug
PROD: 5dc/1/1

The output you see here is the product identifier that the USB modules in the kernel have assigned to your device. Write that down. Oh, and you can remove the 'echo' line from the usb.agent file now too. The '5dc/1/1' means the Vendor ID is '5dc', the Product ID is '1', and the Device ID is '1'.

Next, we're going to tell the hotplug scripts that each time it sees that device being plugged in, it should run a script of our choosing. This configuration happens in the /etc/hotplug/usb.usermap file. So edit that file, and insert the following on one line:

jumpshot        0x03 0x05dc 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

Here is what all of that means:

So what does this 'jumpshot' script need to do? That is up to you. Mine does the following:

You can download a copy of my 'jumpshot' scripts (they're written in perl) if you like. Place the 'jumpshot' script into /etc/hotplug/usb directory, and make sure that the file is owned and executable by root. Make sure you open and read through the file before you use it. It needs to be customized for your environment. You might also want to modify and use my unmounter script, which I install in /usr/local/bin.

What comes next? Well, the last thing I wanted was a quick script that would copy all images off of the CF card into a directory named according to date (/home/pics/2003-03-22), then launch a graphics viewer like kuickshow. My copy images script is included in the tar archive above.

And that should be all it takes to get you up and running. Comments and improvements to jason@buberel.org.