Automatic download from camera.



I've been trying to figure out how to have my photos downloaded
automatically when I plug in my camera/memory chip. After looking
through the hotplug scripts for a week, I am still no closer to a
solution. The most irritating thing is that when connecting the
camera in gnome, gnome-volume-manager takes care of it. So it would
seem that I just need to have the system run my script instead of
gnome-volume-manager. Apparently its not that easy.

Here are the questions I have. First, how do I go about ensuring that
I have a consistent link to the device in /dev when it is plugged in?
On a fresh boot it seems that when I use the card reader it is at
/dev/sdd1 but if I use the camera and cable, its at sda1. Just before
I rebooted though all kinds of sd?? devices were being created and I
couldn't mount any of them for various reasons. Then the system
froze. Hopefully that was a fluke.

Second question is how do I go about having a script called when the
kernel sees the device? I'm running on sarge so i believe hotplug is
the appropriate place.

`lsusb` gives:
Bus 001 Device 005: ID 05e3:0710 Genesys Logic, Inc.

for my card reader

in /etc/hotplug/usb.usermap I have:

photodl 0x0003 0x05e3 0x0710 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000

/etc/hotplug/photodl:

#!/bin/bash

if [ "$ACTION" == "add" ]; then
/bin/mount /media/camera

elif [ "$ACTION" == "remove" ]; then
umount /media/camera
fi


after plugging in the card I see this data in my syslog:
Feb 27 18:37:10 localhost kernel: SCSI device sdb: 253888 512-byte
hdwr sectors (130 MB)
Feb 27 18:37:10 localhost kernel: sdb: assuming Write Enabled
Feb 27 18:37:10 localhost kernel: sdb: assuming drive cache: write through
Feb 27 18:37:10 localhost kernel: /dev/scsi/host4/bus0/target0/lun0: p1
Feb 27 18:37:10 localhost kernel: Attached scsi removable disk sdb at
scsi4, channel 0, id 0, lun 0
Feb 27 18:37:10 localhost kernel: Vendor: Generic Model: STORAGE
DEVICE Rev: 9144
Feb 27 18:37:10 localhost kernel: Type: Direct-Access
ANSI SCSI revision: 02
Feb 27 18:37:10 localhost kernel: Attached scsi removable disk sdc at
scsi4, channel 0, id 0, lun 1
Feb 27 18:37:10 localhost kernel: Vendor: Generic Model: STORAGE
DEVICE Rev: 9144
Feb 27 18:37:10 localhost kernel: Type: Direct-Access
ANSI SCSI revision: 02
Feb 27 18:37:10 localhost kernel: Attached scsi removable disk sdd at
scsi4, channel 0, id 0, lun 2
Feb 27 18:37:10 localhost kernel: Vendor: Generic Model: STORAGE
DEVICE Rev: 9144
Feb 27 18:37:10 localhost kernel: Type: Direct-Access
ANSI SCSI revision: 02
Feb 27 18:37:10 localhost kernel: SCSI device sde: 253888 512-byte
hdwr sectors (130 MB)
Feb 27 18:37:10 localhost kernel: sde: assuming Write Enabled
Feb 27 18:37:10 localhost kernel: sde: assuming drive cache: write through
Feb 27 18:37:10 localhost kernel: /dev/scsi/host4/bus0/target0/lun3: p1
Feb 27 18:37:10 localhost kernel: Attached scsi removable disk sde at
scsi4, channel 0, id 0, lun 3
Feb 27 18:37:10 localhost kernel: USB Mass Storage device found at 6
Feb 27 18:38:05 localhost udev[5777]: configured rule in
'/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sdc' becomes '%k'
Feb 27 18:38:05 localhost udev[5777]: creating device node '/dev/sdc'
Feb 27 18:38:05 localhost udev[5783]: configured rule in
'/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sdd' becomes '%k'
Feb 27 18:38:05 localhost udev[5783]: creating device node '/dev/sdd'
Feb 27 18:38:16 localhost udev[5790]: removing device node '/dev/sdb'
Feb 27 18:38:17 localhost udev[5796]: removing device node '/dev/sde'
Feb 27 18:40:16 localhost udev[5806]: configured rule in
'/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sdb' becomes '%k'
Feb 27 18:40:16 localhost udev[5806]: creating device node '/dev/sdb'
Feb 27 18:40:17 localhost udev[5812]: configured rule in
'/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sde' becomes '%k'
Feb 27 18:40:17 localhost udev[5812]: creating device node '/dev/sde'
Feb 27 18:42:16 localhost udev[5820]: configured rule in
'/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sdb1' becomes
'%k'
Feb 27 18:42:16 localhost udev[5820]: creating device node '/dev/sdb1'
Feb 27 18:42:17 localhost udev[5826]: configured rule in
'/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sde1' becomes
'%k'
Feb 27 18:42:17 localhost udev[5826]: creating device node '/dev/sde1'

/etc/fstab has the correct entry for mounting /dev/sdd1 but the mount
point is still empty. New log entries show up every two minutes in
syslog. You can see some of them at the tail of what I pasted.

I'd really appreciate some help getting this to work. Its getting to
the point where I want to just run the script myself. Problem is I
want something more seamless for the wife, and mother when I build her
a box.

Thanks in advance.

--Dave


Relevant Pages

  • USB Card Reader.
    ... As I have my modem in there, it's a major pain to get the camera connected. ... So I decided to get a USB card reader to solve the problem. ... Mar 18 21:25:27 localhost kernel: usb 3-2: new high speed USB device using address 5 ... Mar 18 21:25:27 localhost kernel: Attached scsi removable disk sda at ...
    (Debian-User)
  • Re: Flash card reader
    ... >> I have de following flash card reader, does anybody know how to make ... > drive-like devices) appear when you plug the card reader in? ... Sep 29 19:24:37 localhost kernel: Attached scsi removable disk sdc at ...
    (Debian-User)
  • Re: USB Card Reader.
    ... So I decided to get a USB card reader to solve the problem. ... Mar 18 21:25:27 localhost kernel: Attached scsi removable disk sda at ...
    (Debian-User)
  • Not automounting a USB Cardreader??
    ... Jan 29 22:12:28 localhost kernel: Attached scsi removable disk sdb at ... ANSI SCSI revision: 02 ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)