Sunday, October 31, 2004

Using A Digital Camera with FreeBSD

I decided to try to get my Canon Powershot S40 digital camera working with my FreeBSD laptop. I found that plugging in the USB cable only yielded this entry in /var/log/messages:

ugen0: Canon Inc. PowerShot S40, rev 1.10/0.01, addr 2

The ugen driver provides support for all USB devices that do not have a special driver, according to its man page. Running usbdevs showed the camera connected to the laptop:

sudo usbdevs -dv
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
Intel(0x0000), rev 1.00
uhub0
port 1 addr 2: full speed, self powered, config 1,
PowerShot S40(0x3056), Canon Inc.(0x04a9), rev 0.01
ugen0
port 2 powered

Unfortunately, I did not see the dymanic creation of a device like /dev/da0 that might have let me mount the camera and read files from it. (The problem was discussed in this thread.) I turned to the ports tree and found graphics/gphoto2, which I installed as a package:

orr:/home/richard$ sudo pkg_add -vr gphoto2

When done I followed the Gphoto2 documentation. First I checked for available ports:

orr:/home/richard$ gphoto2 --list-ports
Loading camera drivers from '/usr/lo... | \ 2.0%
Devices found: 1
Path Description
--------------------------------------------------------------
usb: Universal Serial Bus

Next I searched for cameras. I found that I needed to run some of these commands as root using sudo:

orr:/home/richard$ sudo gphoto2 --auto-detect
Loading camera drivers from '/usr/lo... | \ 2.0%

Model Port
----------------------------------------------------------
Canon PowerShot S40 usb:

Once I found the camera I discovered what Gphoto2 thought of it:

orr:/home/richard$ sudo gphoto2 --summary
Loading camera drivers from '/usr/lo... | \ 2.0%

Detected a 'Canon:PowerShot S40'.
Camera summary:

Camera identification:
Model: Canon:PowerShot S40
Owner:

Power status: on battery (power OK)

Flash disk information:
Drive D:
256'352'256 bytes total
207'917'056 bytes available

Time: 2004-10-31 11:51:51 (host time -1 seconds)


Now I could find files on the camera:

orr:/home/richard$ sudo gphoto2 --list-files
Loading camera drivers from '/usr/lo... | \ 2.0%
Detected a 'Canon:PowerShot S40'.
There are no files in folder '/'.
There are no files in folder '/DCIM'.
There is one file in folder '/DCIM/106CANON':
#1 IMG_0700.JPG rd 921 KB image/jpeg
There are 43 files in folder '/DCIM/107CANON':
#2 IMG_0703.JPG rd 1019 KB image/jpeg
#3 IMG_0704.JPG rd 1278 KB image/jpeg
#4 IMG_0705.JPG rd 885 KB image/jpeg
#5 IMG_0706.JPG rd 929 KB image/jpeg
...edited...
There are no files in folder '/DCIM/CANONMSC'.

When I found a file I wanted, I retrieved it:

orr:/home/richard$ sudo gphoto2 --get-file 38-39
Loading camera drivers from '/usr/lo... | \ 2.0%
Detected a 'Canon:PowerShot S40'.
Downloading 'IMG_0741.JPG' from folder '/DCIM/107CANON'...
Receiving data... | \ 0.5%
Saving file as IMG_0741.JPG

After the files were downloaded to my laptop I was able to manipulate them using my preferred file editing programs. I removed the USB cable from the laptop and got this message from the kernel:

ugen0: at uhub0 port 1 (addr 2) disconnected
ugen0: detached

There's a graphical application for Gphoto2 called Gtkam but I got errors in the pango library when I tried to use it.

5 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.