On Mon, May 02, 2005 at 11:13:13AM +0200, Peter Stelmachovic wrote: > I am sending the output of user.log after applying the patch.
Hi, Thank you for the quick reply. I have once again a patch for you. :-) This should fix the issue, so it is hopefully the last patch I have to ask you to try. Please let me know if it really fixes the issue. > P.S. I have noticed that the same problem occurs if the device is > plugged into USB1 port > (different pc with debian stable - no usbmount, no udev, kernel 2.4 but > a simple script to automatically mount the flashdisk when plugged in. > Again the disk cannot be mounted immediately but the script needs to > wait for some time before mounting a partition on the disk). It appears that the device reports itself ready (i.e. 'cat /sys/block/sdc/device/state' returns 'running') before it really is. My proposed fix therefore tries to read from the device and only continues if this succeeds (or gives up after 20 seconds). Cheers, Martin --- usbmount.orig 2005-05-02 12:02:25.000000000 +0200 +++ usbmount 2005-05-02 12:02:40.000000000 +0200 @@ -62,6 +62,25 @@ trap '( lockfile-remove /var/run/usbmount/.mount )' 0 log debug "acquired lock /var/run/usbmount/.mount.lock" + # Try to read from the device. Some devices need a few seconds + # initialization time before they can be accessed. Give up after + # 20 seconds. Thanks to Peter Stelmachovic for his help with + # debugging this. + log debug "testing whether $DEVNAME is readable" + read_success=no + for t in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do + if dd if="$DEVNAME" of=/dev/null bs=512 count=1; then + read_success=yes + break + fi + log debug "attempt $t to read from $DEVNAME failed" + sleep 1 + done + if test "$read_success" != yes; then + log err "cannot read from $DEVNAME" + exit 1 + fi + # Test if the device contains a filesystem. If it doesn't, no # further action is required, but calling udev_volume_id has the # side effect that the partition table is read and partition -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]