# Olympus and Hotplug get Married

## southerngentooman

Setting up Olympus C-5000Z Digital Camera with gentoo-dev-sources 2.6.10r6 and Hotplug.

This setup could well work on other cameras using xD-Picture Card memory.

In a previous post https://forums.gentoo.org/viewtopic-t-293533-highlight-olympus.html I  indicated that Olympus and Hotplug kept breaking up.  Well, that problem is now solved and the wedding is on. 

I'm not sure what fixed this.  I had done a rebuild while working on a cdrw issue, but it was bugging me, so I decided to revisit the digcam.  I stripped everything I had done before and re-emerged hotplug and udev, this time it worked first time through.  So, thought I'd pass along the setup. .

- Assumptions:  you have gentoo linux 2.6.10, udev, and hotplug installed or you are willing to install them; and you own a Olympus digital camera or other similar camera with an xD-Picture card. Also, you will be connecting your camera directly to a usb port and not using a thumb/flash type mem dock. Lastly, You don't mind mounting and unmounting your camera when using it.

Let's plan a wedding:

Olympus needs to get a fresh charge while Hotplug and thier friend udev make the wedding perparations

- connect Olympus to his battery charger 

Hotplug and udev like the subway they grab a root terminal

```
$ su

# mount

*** IMPORTANT *** make sure /boot partition is mounted, if not mount it before proceeding.

# mount /dev/hda2
```

Let's get the wedding organized:

```
# env-update && source /etc/profile

# cd /usr/src

# ls -l linux

*** IMPORTANT *** make sure the correct kernel is linked

# cd linux

# make menuconfig  

   General setup -->

      [*] Support for hot-pluggable devices

   File Systems -->  Pseudo Filesystems -->

      [*] /proc file system support

      [ ] /dev file system ....

         [ ] automatically mount at boot,  *** THIS is a NO NO!

      [*] Virtual memory file system support ....

   Device Drivers --> USB Support -->

      <*> Support for Host-side USB

      [*] USB device filesystem

      <*> EHCI HCD (USB 2.0) support

      either: OHCI or UHCI depending on your motherboard (select both if you can't figure this out)

      <*> UHCI HCD (most Intel and VIA) support

      <*> USB Mass Storage support

      <*> USB Human Interface Device (full HID) support

      Check the listing of usb hardware that follows.  If yours is listed, then enable that driver,

                if your hardware is not specifically listed then you dont need anything else in this menu.

   Device Drivers --> SCSI device support -->

      [*] legacy /proc/scsi/ support

      <M> SCSI disk support

      <*> SCSI generic support

      <*> Probe all LUNs on each SCSI device

   Device Drivers --> ATA/ATAPI/MFM/RLL support -->

      you probably already have lots of options here, we are only interested in:

      <M> SCSI emulation support
```

- If you didn't change anything skip down to Adding scsi modules.

Rebuild Kernel:

```
# make && make modules_install
```

- copy the arch/i386/boot/bzImage to your boot directory, matching the filename to whatever name you used for the kernel parameter in grub.conf, if your not sure, use # cat /boot/grub/grub.conf  Mine goes like so:

```
# cp arch/i386/boot/bzImage /boot/mykernel-2.6.10

# cp System.map /boot/mySystem.map-2.6.10

# cp .config /boot/config-2.6.10-gentoo-r6

```

Add scsi modules:

check that the scsi modules are available

```
# find /lib/modules/2.6.10-gentoo-r6/ -type f -iname '*.ko'
```

....

/lib/modules/2.6.10-gentoo-r6/kernel/drivers/scsi/ide-scsi.ko

/lib/modules/2.6.10-gentoo-r6/kernel/drivers/scsi/sd_mod.ko

...

if they are, then you did good, now add them to your system:

```
# nano -w /etc/modules.autoload.d/kernel-2.6

add both to the list

ide-scsi

sd_mod

<ctrl-o> <return> <ctrl-x>
```

Installing support files:

```
$ su

# env-update && source /etc/profile

# emerge -a udev

# emerge -a baselayout

# emerge -a module-init-tools
```

Hotplug wants to chill out at the salon, hair done, manicure, etc.  A trip to the salon last week don't count.   (btw, don't invite coldplug to the wedding, Olympus is not interested.  Coldplug can find some other device to hook up to)

```
# emerge -a hotplug
```

and add hotplug to default runlevel

```
# rc-update add hotplug default
```

and linkup modules

```
# modules-update
```

- Even if you previously installed hotplug, let's check to see if there is a nasty file present. It was replaced by pnp.rc.  

```
$ ls /etc/hotplug/isapnp.rc
```

If it's there, delete it.

```
su

# rm /etc/hotplug/isapnp.rc
```

Edit these settings as shown below:

```
# nano -w /etc/conf.d/rc

RC_DEVICES="udev"

RC_DEVICE_TARBALL="yes"

RC_DEVFSD_STARTUP="no"
```

Olympus has to get permissions to get married, so edit these two groups as shown below:

```

# nano -w /etc/group

usb:x:85:danny

users:x:100:games,danny
```

Rebooting into your new kernel:

Check that the kernel file name in /boot/grub/grub.conf matches your new kernel name.  

```

# cat /boot/grub/grub.conf

# ls /boot

# umount /boot

# exit

$ exit

shutdown X11
```

Before Olympus and Hotplug can get married, they need to be seperated for the bachelor's party.

*** important *** Unplug camera.

$ reboot

Wow, udev came through. Olympus and Hotplug have agreed on the type of Modular Home they will live in, just a few more preparations before they tie the knot.

Let's work out the details for the prenup:

open a console and su to root then use dmesg to find our device type

```
# dmesg | tail
```

Now, plug in the camera and repeat dmesg 2 or 3 times checking for the device.

look for sda2 or something similar.  My example uses sda1, change the following commands accordingly for what dmesg reports.

```
# udevinfo -p /sys/block/sda/sda1 -a
```

If you just get 2 lines and no indication that something was plugged in, then you are probably missing a driver, or the minister got on the wrong buss.

Let's start the wedding:

First. examine the marriage documents we got from udevinfo.

It is divided into sections, groom's friends here, bride's family there etc.  What you need is the section with the most information about the couple.  That section is the marriage license. You can only have one license.  Here is mine as an example:

looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.2/usb4/4-1':

    BUS="usb"

    ID="4-1"

    SYSFS{bConfigurationValue}="1"

    SYSFS{bDeviceClass}="00"

    SYSFS{bDeviceProtocol}="00"

    SYSFS{bDeviceSubClass}="00"

    SYSFS{bMaxPower}="100mA"

    SYSFS{bNumConfigurations}="1"

    SYSFS{bNumInterfaces}=" 1"

    SYSFS{bcdDevice}="1004"

    SYSFS{bmAttributes}="c0"

    SYSFS{detach_state}="0"

    SYSFS{devnum}="2"

    SYSFS{idProduct}="0102"

    SYSFS{idVendor}="07b4"

    SYSFS{manufacturer}="OLYMPUS"

    SYSFS{maxchild}="0"

    SYSFS{product}="C-5000Z"

    SYSFS{serial}="152086671"

    SYSFS{speed}="12"

    SYSFS{version}=" 1.10"

Dearly beloved, if there is anyone present who objects to this wedding, let them speak now or forever hold thier parameters

*** IMPORTANT *** once you have picked your section, you must ignore all the rest.  Do not mix info between the in-laws.

We need two udev keys, one that identifies the connection and another to identify the device:  If you look at mine you can see that BUS and SYSFS{product} will work fine.  Then for the name field we will use a symbolic link to our file system via fstab.

If a bus key is not indicated, then use ID.

If SYSFS[product} is not indicated, then use serial, or manufacturer.  

```
# nano -w /etc/udev/rules.d/10-udev.rules  
```

- now, gather up the pieces that together will make up the wedding vows;

Do you Hotplug promise to forever be, BUS="usb",

Do you Olympus promise to forever be, SYSFS{product}="C-5000Z",

'while placing the ring on Hotplug's finger' 

With this NAME='%k" 

I thee SYMLINK="digcam/cam%n"

- now just put all the vows together like so, and you've got the udev rule:

```
BUS="usb", SYSFS[product}="C-5000Z", KERNEL="sd*[0-9]", NAME="%k" SYMLINK="digcam/cam%n"
```

'the bashful minister will gracefully save and open fstab:

```
# nano -w /etc/fstab
```

By the power invested in me by the superuser, I declare Olympus and Hotplug to be device and mount point:

```
/dev/digcam/cam1        /mnt/camera     vfat     umask=000,noauto,noatime,users 0 0
```

You may kiss the OS:

```
# mkdir /mnt/camera
```

... music ... fanfare ... tears...

```
# exit

$ exit

 shutdown X11

# reboot
```

The happy couple escapes under a shower of scripts.

* Option, they throw out the kde bouquet and drive away in a fluxbox.

startx the reception: emerge gimp and other programs for entertainment, but lay off the wine.

Honeymoon: 

Go on a krusader. Hotplug and Olympus, just married, slip away and navigate over to their private room, /mnt/camera; right-click on the occupied icon; then click mount.  

I'll leave the rest for you to figure out.Last edited by southerngentooman on Wed Feb 16, 2005 7:54 pm; edited 1 time in total

----------

## Bojan

I might just try this. So far I've used an USB picture card reader. It would be nice if I could manage without ... Thanks

----------

## GungHo

well done and written, master southerngentooman  :Very Happy: 

----------

## southerngentooman

 *Bojan wrote:*   

> I might just try this. So far I've used an USB picture card reader. It would be nice if I could manage without ... Thanks

 

Thanks for the reply.  I took another look and found a goof!

I had   nano -w etc/fstab instead of nano -w /etc/fstab

daaahhhhh    :Wink: 

anyhow, tis fixed now.    If you do try it let me know the results.  Thanks

Danny

----------

## codergeek42

Shouldn't this be in DT&T?

[/completely-useless-comment]

----------

## mslinn

I've got a Sony HandyCam DCR-DVD403 and I had hoped to slightly modify the above instructions so as to be able to read the DVD in it before it is finalized.  The only changes I made to the instructions were:

1)  Compiled sd_mod.ko into the kernel instead of making it loadable (because .config was already set that way)

2) Changed the entry in /etc/udev/rules.d/10-udev.rules to:

```
BUS="usb", SYSFS[product}="DDX-C1000", KERNEL="sd*[0-9]", NAME="%k" SYMLINK="digcam/cam%n"
```

3) renamed /etc/hotplug/isapnp.rc to isapnp.rc- in case I wanted it back for some reason

After turning the unit on, plugging it into the USB cable and setting it to USB mode, I get:

```
$  dmesg | tail -f

usb 1-1: new high speed USB device using ehci_hcd and address 3

scsi1 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 3

usb-storage: waiting for device to settle before scanning

  Vendor: SONY      Model: DDX-C1000         Rev: R1.0

  Type:   CD-ROM                             ANSI SCSI revision: 00

Attached scsi generic sg1 at scsi1, channel 0, id 0, lun 0,  type 5

usb-storage: device scan complete

FAT: bogus number of reserved sectors

VFS: Can't find a valid FAT filesystem on dev sda1.

```

I changed the mount filesystem type to iso9660 and dmesg didn't emit anything next time I mounted the device:

```
/dev/digcam/cam1        /mnt/camera     iso9660     umask=000,noauto,noatime,users 0 0
```

Each time I try to get it started the USB device increments:

```

usb 1-1: new high speed USB device using ehci_hcd and address 5

scsi3 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 5

usb-storage: waiting for device to settle before scanning

  Vendor: SONY      Model: DDX-C1000         Rev: R1.0

  Type:   CD-ROM                             ANSI SCSI revision: 00

Attached scsi generic sg1 at scsi3, channel 0, id 0, lun 0,  type 5

usb-storage: device scan complete

```

Still can't seem to mount the device, however.  What am I missing?

----------

