Thursday, January 22, 2004

More USB stuff

In theory, at least, it should be possible to set up a USB hotplug, so that when I plug my camera into the computer and turn it on its memory is automatically mounted to /mnt/camera. Windows, of course, does this, and so according to this Linux Gazette (.net) tip it can be done with Linux. Reading some of the gphoto2 documentation indicates the same thing. Unfortunately, I couldn't figure out how to work it with my camera.

Searching Google for "linux hotplug olympus digital", I found the article Olympus C-5050Zoom Digital Camera with Linux. OK, I have a C-5000, but what the heck. The article tells how to look in /proc and /var/log/messages to find out if the computer knows about the camera once it's plugged in. As we previously established, that works. Then I found the section called "Mounting the Camera by non-root users". That says all I have to do is edit /etc/fstab, adding the line: /dev/sda1 /mnt/camera vfat rw,noauto,user 1 0 I'd tried something like this before, but now I can do mount /mnt/camera

and umount /mnt/camera

and things work as the should.

Note: As noted in the above article, Never power off or disconnect the camera before unmounting the device. If you do you risk corrupting the camera file system and trashing your pictures.

The next section of the article is "Auto Mounting the Camera", which is what I wanted in the first place. It uses the autofs package, which is already installed on my computer. Of course, the first thing I'm supposed to do is delete all of the /mnt mount points, which sounds vaguely scary. I'll think about it.