On Tue, 08 Oct 2002 04:29, Cam wrote:
> Randy
>
> > Interesting.
>
> I have the same device according to the identifier, but it's a PQI
> travel flash 6-in-1 reader. The serial number exhibits the same behaviour.
>
> I had got as far as using updfstab to automatically make a mount point
> and /etc/fstab entry for the drives, but I found that it wasn't cleaned
> up when the device is removed. Also it wasn't clear how best to let a
> non privileged user mount and unmount the drive. Finally, there doesn't
> seem to be any event for inserting or removing cards from the reader,
> which is a shame as it would allow for automating the entire process.
>
> As it stands, maybe I need a daemon or something that continually polls
> the reader when it is present, to determine if a card is there.
>
> -Cam

This chipset seems to be included in many different devices all with
the same product id's.  This is bound to cause some confusion.

I took a different approach to getting the mount done to avoid
problems when the device resurfaces on a different scsi hosts - eg if I
unplug and replug my device its serial-number changes so it winds up
on a different /dev/sd[abd...].  I added a /etc/hotplug/usb/usb-storage
script that starts a background task that will do the mount once the
hotplug finishes - actually I just sleep 2 at the start of the
backgrounded task:

   (sleep 2; /usr/local/bin/usb-mount) < /dev/null 1> /dev/null 2>&1 &

I am trying to generalize this solution for release. But as you can
see from my postings, there are a few snags.  I've just now
implemented a script that rescans the whole scsi-usb bus when hotplug
detects an add or removal.  Any new devices are just assigned a
generic name: /mnt/usb-storage/device-1, device-2, etc. I unmount 
at removal by setting up hotplug usb.agent to call my script
to rescan the bus.  My device-n naming scheme is independent of what
scsi /dev/sd* device is actually used - so if you only have one device
it will always be device-1, no matter what it's scsi-host is. 

This new script also creates KDE desktop files in the Desktop
directory of the console owner.  The .desktop file includes an option
to do an unmount.  The .desktop file will only be created if doesn't
already exist. Here's a sample file:

  [root@viking2 bin]# cat /home/michael/Desktop/usb-storage-device-1.desktop
  [Desktop Action Unmount]
  Exec=/usr/local/bin/usb-umount /mnt/usb-storage/device-1
  Name=Unmount

  [Desktop Action MountAll]
  Exec=/usr/local/bin/usb-mount all
  Name=Mount all

  [Desktop Entry]
  Name=storage device-1
  Actions=Unmount;MountAll
  Encoding=UTF-8
  Icon=usb
  Type=Link
  URL=file:/mnt/usb-storage/device-1

The usb-umount script re-executes itself using sudo with a
passwordless sudoers entry to allow non-root uses to perform unmount
requests.  The desktop files are left after an unmount because they
are generic - just like the floppy device.

I only just got it working and I need to add more error detection and
feedback. Seems solid for me. If anyone feels like previewing it, just
let me know.  You should feel comfortable around shell scripts.  I
only have one device, so those with more than one might find some bugs.
And of course this thing runs as root - so there's some potential for
damage if I've got things wrong.

Known bugs: when a new divice is plugged in all attached devices are
mounted - including any you've umounted but not unplugged.  I'm trying
to figure out why the GUID reported in the /proc/scsi/ is
0aec5010aec501000001a005 and the Serialnumber field in
/proc/usb/devices is 0AEC501000001A00<.  If I solve this, then I just
mount the device most recently plugged in.  But that only works
for devices with serial numbers.

Michael


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to