This page has moved...

You will be redirected automatically there in 5 seconds.

If not, then please click on the following link: http://users.bigpond.net.au/blmiller/linux/c5050.html

Please update any links to this page you may have had.


Olympus C-5050Zoom Digital Camera with Linux

Introduction

This page is my experiences with an Olympus Camedia 5050Zoom camera and using it with Linux. I don't claim to be an expert, just a happy user.

USB Mass Storage Device

When the camera is plugged into the computer via its USB cable it appears as a SCSI disk drive. You mount it, read files, write files and delete files just like a normal disk. But more if this information later.

Some useful links:

No Kernel Modules for me

I compile my own kernels. Currently I am running version 2.4.20.

Most distributions come with a kernel with just about all options and drivers compiled as modules. You may find that you don't need to compile your kernel to get things going; just loading the necessary modules.

As I compile my kernels for just the hardware I have, I see no need to use modules. So all drivers are part of the kernel. It's a personal choice, so go with what ever you feel is right.

USB in the Kernel

It's was pretty obvious that I needed USB compiled into the kernel. I already had this in to support a HP PhotoSmart 7150 printer and Epson Perfection 2400 Photo scanner. So all I needed to was to add the USB Mass Storage support. The relavent make menuconfig USB Support options I use have been highlighted in bold. You should select EHCI, UHCI and/or OHCI based on your particular USB hardware. It's probably best to read the Linux USB-HOWTO before you go heading off into the unknown if this is your first USB device.
<*> Support for USB
[ ]   USB verbose debug messages
--- Miscellaneous USB options
[*]   Preliminary USB device filesystem
[ ]   Enforce USB bandwidth allocation (EXPERIMENTAL)
[ ]   Long timeout for slow-responding devices (some MGE Ellipse UPSe
--- USB Host Controller Drivers
<*>   EHCI HCD (USB 2.0) support (EXPERIMENTAL)
<*>   UHCI (Intel PIIX4, VIA, ...) support
< >   OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
--- USB Device Class drivers
< >   USB Audio support
< >   USB Bluetooth support (EXPERIMENTAL)
< >   USB MIDI support
<*>   USB Mass Storage support
[ ]     USB Mass Storage verbose debug
[ ]     Datafab MDCFE-B Compact Flash Reader support
[ ]     Freecom USB/ATAPI Bridge support
[ ]     ISD-200 USB/ATA Bridge support
[ ]     Microtech CompactFlash/SmartMedia support
[ ]     HP CD-Writer 82xx support
[ ]     SanDisk SDDR-09 (and other SmartMedia) support
[ ]     SanDisk SDDR-55 SmartMedia support
[ ]     Lexar Jumpshot Compact Flash Reader
< >   USB Modem (CDC ACM) support

    [Rest of config lines not shown...]

SCSI in the Kernel

Also, you need to have SCSI and SCSI Disk support compiled into your kernel. I also had this because I have a SCSI DAT tape drive. The relavent make menuconfig SCSI support options I used are in bold:
<*> SCSI support
--- SCSI support type (disk, tape, CD-ROM)
<*>   SCSI disk support
(40) Maximum number of SCSI disks that can be loaded as modules
<*>   SCSI tape support
< >   SCSI OnStream SC-x0 tape support
< >   SCSI CD-ROM support
<*>   SCSI generic support
--- Some SCSI devices (e.g. CD jukebox) support multiple LUNs
[*]   Enable extra checks in new queueing code
[*]   Probe all LUNs on each SCSI device
[*]   Verbose SCSI error reporting (kernel size +=12K)
[ ]   SCSI logging facility
SCSI low-level drivers  --->

File Systems in the Kernel

The file system type used on the camera is Microsoft VFAT. So this needs to be also in the kernel. While at it, I also compiled in automount which comes in handy with the camera (more on this later).
[ ] Quota support
< > Kernel automounter support
<*> Kernel automounter version 4 support (also supports v3)
< > Reiserfs support
< > ADFS file system support (EXPERIMENTAL)
< > Amiga FFS file system support (EXPERIMENTAL)
< > Apple Macintosh file system support (EXPERIMENTAL)
< > BeOS file systemv(BeFS) support (read only) (EXPERIMENTAL)
< > BFS file system support (EXPERIMENTAL)
<*> Ext3 journalling file system support
[ ]   JBD (ext3) debugging support
<*> DOS FAT fs support
<*>   MSDOS fs support
< >     UMSDOS: Unix-like file system on top of standard MSDOS fs
<*>   VFAT (Windows-95) fs support

Compile your kernel

That's about anough to get the camera going. So compile your kernel and boot with it.

Preliminary USB device filesystem

The first thing to do is to make sure that the Preliminary USB device filesystem is mounted. Do an
$ ls -l /proc/bus/usb
and you should get output that looks somethg like
dr-xr-xr-x    1 root     root            0 Feb  2  2003 .
dr-xr-xr-x    4 root     root            0 Feb  2  2003 ..
dr-xr-xr-x    1 root     root            0 Feb  2  2003 001
dr-xr-xr-x    1 root     root            0 Feb  2  2003 002
dr-xr-xr-x    1 root     root            0 Feb  2  2003 003
dr-xr-xr-x    1 root     root            0 Feb  2  2003 004
-r--r--r--    1 root     root            0 Feb  2  2003 devices
-r--r--r--    1 root     root            0 Feb  2  2003 drivers
If you don't get this, then check that the Preliminary USB device filesystem has been mounted. There should be the following line in your /etc/fstab:
none  /proc/bus/usb  usbdevfs  defaults  0  0
and mount it as root with:
$ mount  /proc/bus/usb

First Signs of the Camera

Turn the top selection dial on the camera to the green triangle in the rectangle, plug the USB cable into your PC and the camera and turn the camera on.

Take a look in /proc/bus/usb/devices. There is lots of information, but look closer and you should see your camera.

T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=b400
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=07b4 ProdID=0105 Rev= 1.00
S:  Manufacturer=OLYMPUS
S:  Product=C5050Z
S:  SerialNumber=000244703998
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=b000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=b800
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 6
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.04
S:  Manufacturer=Linux 2.4.20 ehci-hcd
S:  Product=Intel Corp. 82801DB USB EHCI Controller
S:  SerialNumber=00:1d.7
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms
Also check that it shows up with a Driver type being usb-storage. Now we have contact!

Another nice thing to check is the /var/log/messages or /var/adm/messages file. Do a tail on this and you should see the following:

Feb  1 23:20:43 maverick kernel: hub.c: new USB device 00:1d.2-2, assigned address 2
Feb  1 23:20:43 maverick kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Feb  1 23:20:43 maverick kernel:  sda:<7>usb-storage: queuecommand() called
This tells you which SCSI disk that your camera is going to be. In this case it will be /dev/sda.

If that's not enough looking around you can always have a look in /proc/scsi/scsi. I have a real Advansys SCSI card with a DAT tape drive on it, so I get the following:

Host: scsi0 Channel: 00 Id: 06 Lun: 00
  Vendor: ARCHIVE  Model: 4326XX 27871-XXX Rev: 0322
  Type:   Sequential-Access                ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: OLYMPUS  Model: C5050Z           Rev: 1.00
  Type:   Direct-Access                    ANSI SCSI revision: 02
You can also take a look in /proc/scsi/usb-storage-0/1 which will show you:
   Host scsi1: usb-storage
       Vendor: OLYMPUS
      Product: C5050Z
Serial Number: 000244703998
     Protocol: Transparent SCSI
    Transport: Bulk
         GUID: 07b401050000000244703998
     Attached: Yes

Mounting the Camera for the first time

Create a directory that you are going to mount the camera as. I used /mnt/camera.

As root, mount the camera with the following command:

$ mount -t vfat /dev/sda1 /mnt/camera
If all works, the red LED on the rear right of the camera should flicker for a second and you're in. To see what you have on the camera, you can use any of the standard command line commands like cd, ls, cp, rm, etc. To see what is available on the camera, you can do the following command:
$ find /mnt/camera
and get something like the following:
/mnt/camera
/mnt/camera/dcim
/mnt/camera/dcim/100olymp
/mnt/camera/dcim/100olymp/p2010001.jpg
/mnt/camera/dcim/100olymp/p2010002.jpg
In this case, I have only 2 JPEG images stored in the camera.

Umount the camera with the following command:

$ umount /mnt/camera
WARNING! 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.

Mounting the Camera by non-root users

Add the following line to your /etc/fstab:
/dev/sda1  /mnt/camera  vfat  rw,noauto,user  1 0
Now any non-root user can mount and umount the camera with the following commands:
$ mount /mnt/camera
$ umount /mnt/camera
This might be as far as you are interested in going as it's a working solution.

Auto Mounting the Camera

I have set it up so that the camera is automatically mounted when I do any activity in the /mnt/camera directory. This is done by using the autofs tools.

The autofs tools are available from:

ftp://ftp.kernel.org/pub/linux/daemons/autofs/testing-v4/
Compile and install them according the their documentation.

I deleted the /mnt directory and everything below it and recreated an empty /mnt directory.

$ rm -rf /mnt
$ mkdir /mnt
My /etc/auto.master looks like:
/mnt   /etc/auto.mnt
and my /etc/auto.mnt looks like:
cdrom   -fstype=iso9660,ro              :/dev/hdc
camera  -fstype=vfat,rw,umask=000       :/dev/sda1
floppy  -fstype=auto,rw                 :/dev/fd0
which not only covers the camera, but the CD-ROM and floppy disk too.

I use Slackware Linux, so I started automount in the /etc/rc.d/rc.M script. On other systems this may go somewhere like the rc.local file or in a new init script if you use a System V style startup. The actual script code I added in is:

# Start the automounter...
if [ -f /etc/auto.master ]; then
   /usr/sbin/automount --timeout 5 /mnt file /etc/auto.mnt
fi
This starts the automount daemon so that it will automatically unmount /mnt/camera after it has not been used for 5 seconds.

NOTE: If you change into the /mnt/camera directory or any of its subdirectories then it will not be unmounted after 5 seconds of inactivity because your presence there is enough to keep it mounted.

Script To Read Pictures From The Camera

I have a script that reads the images from the camera into the current working directory. It has an option to delete the images from the camera as they are copied. The only pre-requesite is the jhead command. This can be downloaded from:
http://www.sentex.net/~mwandel/jhead/
This is a very useful utility that can read information from the JPEG Header on each picture. In this header there is a lot of information about the picture and the camera settings used in taking it. It also lets you access the thumbnail image that's also in the header.
bash-2.05$ jhead 2003-01-30_18:24:05.jpg
File name    : 2003-01-30_18:24:05.jpg
File size    : 3523123 bytes
File date    : 2003:02:04 23:09:01
Camera make  : OLYMPUS OPTICAL CO.,LTD
Camera model : C5050Z
Date/Time    : 2003:01:30 18:24:05
Resolution   : 3200 x 2400
Flash used   : No
Focal length : 21.3mm
Exposure time: 0.0025 s  (1/400)
Aperture     : f/2.6
ISO equiv.   : 64
Metering Mode: matrix
Jpeg Quality : fine
Jpeg process : Baseline
The actual script is called /usr/local/bin/c5050 and is as follows:
#!/bin/sh
#
# Shell script to copy JPEG files from the Olympus C-5050Zoom
# camera to the local directory. In the process it renames them
# to their date and time that they were taken.
#

##########################################################################
# c5050_get() - get images from camera directory
##########################################################################
c5050_get() {
photonum=1
echo "Copying `ls -1 $IMAGEDIR/*.jpg | grep -c .` files..."

for f in $IMAGEDIR/*.jpg
do

        # temp name of photo being copied
        tempname=`basename $f`

        # copy the image from the camera...
        cp $f $tempname

        # print the photo number
        printf "%3d - " $photonum
        photonum=`echo "$photonum + 1" | bc`

        # rename it to it's date & time
        /usr/local/bin/jhead -n%Y%m%d_%H%M%S $tempname
        sync
done
sync
}

##########################################################################
# c5050_delete() - delete all images from camera directory
##########################################################################
c5050_delete() {
photonum=1
echo "Deleting `ls -1 $IMAGEDIR/*.jpg | grep -c .` files..."

for f in $IMAGEDIR/*.jpg
do

        # temp name of photo being deleted
        tempname=`basename $f`

        # print the photo number
        printf "%3d - deleting %s..." $photonum $tempname
        photonum=`echo "$photonum + 1" | bc`

        # rename it to it's date & time
        rm $f
        echo "done"

done
printf "Syncing filesystem..."
sync
printf "done\n"
}

##########################################################################
# c5050_rotate() - rotate images in current directory
##########################################################################
c5050_rotate() {
degrees=$2
shift 2
case $degrees in
        90|180|270) break
                ;;
        *)      echo "Invalid degrees for rotation, should be 90, 180 or 270."
                exit
                ;;
esac

for f in $*
do
        if [ -f $f ]
        then
                printf "Rotating file $f $degrees degrees..."
                jpegtran -rotate $degrees -copy all $f > rotated.$f
                mv rotated.$f $f
                echo "done"
        fi
done
}

##########################################################################
# c5050_help() - basic help
##########################################################################
c5050_help() {
echo "Usage:"
echo "      c5050 -delete"
echo "      c5050 -get"
echo "      c5050 -help"
echo "      c5050 -rotate 90|180|270 [filenames...]"
echo ""
echo "   -delete     delete ALL JPEG files in the camera."
echo "   -get        copy all JPEG files in the camera to the current"
echo "               working directory and naming them based upon the"
echo "               date & time they were taken."
echo "   -help       You are looking at it."
echo "   -rotate     rotate the JPEG files given on the command line"
echo "               by 90|180|270 degrees."
}

##########################################################################
# main() - main start of script...
##########################################################################
IMAGEDIR=/mnt/camera/dcim/100olymp
case $1 in
        -g*) c5050_get ;;
        -d*) c5050_delete ;;
        -r*) c5050_rotate $* ;;
        *)   c5050_help
esac

Problems with changing the card in the camera

I have two memory cards in my camera. The original 32M xD that came with the camera, and a 128M Compact Flash. I found that if I read the images off one card; disconnected the camera from the USB, change to the other card and reconnected the USB I couldn't mount the camera. I tried reformatting, playing around with fdisk and a few other things. Eventually I found that rebooting Linux allowed me to mount the other card.

The error looks like:

bash-2.05$ mount /camera mount: wrong fs type, bad option, bad superblock on /dev/sda1, or too many mounted file systems bash-2.05$
The problem is that Linux only looks at the disk geometry the first time the camera is plugged in. So when you unplug the camera and change the memory card Linux does not check to see if the geometry has changed. I saw this by looking in /var/log/syslog and connecting/disconnecting the camera while changing the card. Only on the first conection does a message on the geometry come up. It looks something like:
Mar 26 22:41:21 maverick kernel: Vendor: OLYMPUS Model: C5050Z Rev: 1.00 Mar 26 22:41:21 maverick kernel: Type: Direct-Access ANSI SCSI revision: 02 Mar 26 22:41:21 maverick kernel: Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0 Mar 26 22:41:21 maverick kernel: SCSI device sda: 64000 512-byte hdwr sectors (33 MB) Mar 26 22:41:21 maverick kernel: sda: Write Protect is off
In this case it shows that it (first) detected my 32M xD card. If I then switched the card to being my Compact Flash and tried to mount it I'd get messages like:
Mar 26 22:42:01 maverick kernel: FAT: bogus logical sector size 0 Mar 26 22:42:01 maverick kernel: VFS: Can't find a valid FAT filesystem on dev 08:01.
To get around this problem I found that there is a way to dynamically remove and add SCSI devices. It's really made for SCSI hot swappable devices and is found in the SCSI-2.4-HOWTO. So once you have changed the card and reconnected it to your PC, you have to dynamically remove it, then dynamically add it. The commands to do this are:
echo "scsi remove-single-device host bus target lun" > /proc/scsi/scsi echo "scsi add-single-device host channel id lun" > /proc/scsi/scsi
The values for host, bus, id and lun can all be obtained from the message shown above in the syslog file:
Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0 ^ ^ ^ ^ | | | | host ------------ | | | bus ----------------------- | | id ----------------------------- | lun ------------------------------------
So fo my camera, the commands look like:
echo "scsi remove-single-device 1 0 0 0" > /proc/scsi/scsi echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
If you don't already have a SCSI card in your PC, then the value for host will most likely be '0'.

If I now change my camera to use the Compact Flash and connect it to my PC, then (as root) run the two commands above, I get the following in my syslog:

Mar 26 23:17:11 maverick kernel: Vendor: OLYMPUS Model: C5050Z Rev: 1.00 Mar 26 23:17:11 maverick kernel: Type: Direct-Access ANSI SCSI revision: 02 Mar 26 23:17:11 maverick kernel: Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0 Mar 26 23:17:11 maverick kernel: SCSI device sda: 250880 512-byte hdwr sectors (128 MB) Mar 26 23:17:11 maverick kernel: sda: Write Protect is off
So now it's got the right geometry for the Compact Flash and I can go ahead and mount it.

But wait, there's more... This can be automated. I read in /usr/src/linux/Documentation/usb/hotplug.txt that when ever hot pluggable devices are added or removed a program called /sbin/hotplug is run if it exists. I have written a little shell script and called it /sbin/hotplug that detects whenever the camera is added and runs the two command above to remove, then add the SCSI camera device. (Remember to change the two lines in the script to reflect the actual SCSI parameters of your camera.) This looks like:

#!/bin/sh echo "------------------ `date` ------------------------" >> /var/log/hotplug.txt echo "ACTION: $ACTION" >> /var/log/hotplug.txt echo "PRODUCT: $PRODUCT" >> /var/log/hotplug.txt echo "TYPE: $TYPE" >> /var/log/hotplug.txt echo "INTERFACE: $INTERFACE" >> /var/log/hotplug.txt echo "DEVICE: $DEVICE" >> /var/log/hotplug.txt echo "DEVFS: $DEVFS" >> /var/log/hotplug.txt if [ "$ACTION" = "add" -a "$PRODUCT" = "7b4/105/100" ] then echo " Olympus C5050Z add detected..." >> /var/log/hotplug.txt echo "scsi remove-single-device 1 0 0 0" > /proc/scsi/scsi echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi fi if [ "$ACTION" = "add" -a "$PRODUCT" = "4da/2312/100" ] then echo " Panasonic NV-MX500 add detected..." >> /var/log/hotplug.txt echo "scsi remove-single-device 1 0 0 0" > /proc/scsi/scsi echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi fi
To get /sbin/hotplug to run automatically, it needs to be made executable with a "chmod 755 /sbin/hotplug" and the option compiled into the kernel. This option is found in the General setup section:
[*] Networking support [*] PCI support (Any) PCI access mode [*] ISA bus support [*] PCI device name database [ ] EISA support [ ] MCA support [*] Support for hot-pluggable devices PCMCIA/CardBus support ---> PCI Hotplug Support --->
Once you have done all of this, you should have no problems with changing the memory card in your camera (when it's disconnected of course). You can monitor this happening by looking in your /var/log/syslog and /var/log/hotplug.txt files.

How to Convert the Olympus RAW Images to JPEG files

There is a utility I have found that will do this for you. It is Raw Digital Photo Decoding in Linux by Dave Coffin.

Some useful resources

User Groups:
Digital Photography Review - Olympus Forum
MSN Group - Olympus Camedia 5050 Support Group
Yahoo Group - Olympus 4040 and 5050
User Pages:
Olympus 5050 digital camera online resource

Return to my Home page or sign my Guest Book if you found this helpfull.

Number of times page accessed since March 28, 2003:
free hit counter