Using a Sony DSC Camera with FreeBSD

The Sony DSC cameras seem to work nicely with FreeBSD. Here are some tips on setting up your USB system to use the "mass storage" device for loading pictures from your Sony DSC camera, like the S70, F505, and F707.

First, you will need USB device support in your kernel. If you are still using the GENERIC kernel, you already have everything enabled. Otherwise make sure you have "usb" and either "uhci" or "ohci" enabled. These devices are at the bottom of your kernel config file. Also make sure you have "umass", "scbus", "da", and "pass" enabled.

In my case, I have an Athlon motherboard with VIA chipset, and the USB driver is "uhci". Here is an example of my kernel boot messages:

/kernel: uhci0:  port 0xe000-0xe01f irq 15 at device 17.2 on pci0
/kernel: usb0:  on uhci0
/kernel: usb0: USB revision 1.0
/kernel: uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
/kernel: uhub0: 2 ports with 2 removable, self powered
/kernel: uhci1:  port 0xe400-0xe41f irq 15 at device 17.3 on pci0
/kernel: usb1:  on uhci1
/kernel: usb1: USB revision 1.0
/kernel: uhub1: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
/kernel: uhub1: 2 ports with 2 removable, self powered

Now that the USB device is configured and working, be sure that to enable the USB daemon, "usbd", in /etc/rc.conf:
usbd_enable="YES" # Run the usbd daemon.

You may need to "kldload umass" manually to enable USB mass storage device. DO NOT try to unload the umass driver.

You will also need to add an entry to /etc/usbd.conf so that usbd knows how to handle your camera. For my camera, this works nicely:

device "Digital Still Camera"
        product 0x0010
        vendor  0x054c
        release 0x0401
        attach  "camcontrol rescan 2;mount /mnt/mtstick"
        detach  "umount /mnt/mtstick"

Note that your release ID may be different. You can run "usbd -d -vvvv" to see exactly what numbers your camera needs. Also note that my script is doing a rescan of bus number 2. I already have two SCSI controllers on my machine, so my USB bus will be number 2. If you do not have any SCSI cards, your USB bus will be 0. Don't forget to create the mount directory.

Here is my /etc/fstab entry for my camera filesystem:
/dev/da2s1 /mnt/mtstick msdos ro,noauto 0 0
NOTE: I believe that it is necessary to mount the camera filesystem read-only, since the device may disappear before usbd tries to unmount the filesystem. If you try to force umount, the system may crash.

That's it! :-) When you connect your camera to the USB port, the usbd script will mount /mnt/mtstick automatically, and your pictures will appear in that filesystem.


It's easy to answer questions quickly, for those people who only know one answer.


Awards furnished by The Corporation.