From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Date: Fri, 25 Jun 2004 12:45:49 +0000 Subject: Re: ude/hotplug/usbmount Message-Id: <20040625124549.GA13456@idolize.conectiva> List-Id: References: <20040625082939.D5CE4304114@xedo.net> In-Reply-To: <20040625082939.D5CE4304114@xedo.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On Sex Jun 25, 2004 at 10:29:39 +0200, metzench@ccux.de wrote: > Hi All! >=20 > We are now using udev and hotplug for some months now, and so far > everything works fine. But now i wanted to install the usb-mount > script but it won't work when plugging in for example a usb stick, > because hotplug generates the dive nodes too late! Here is what the > logs say: >=20 > DEVPATH=3D/devices/pci0000:00/0000:00:11.3/usb2/2-2/2-2.1/2-2.1:1.0 > Jun 25 01:36:18 CCuxAMD usb-mount: > REMOVER=3D/var/run/usb/%sys%devices%pci0000:00%0000:00:11.3%usb2%2-2%2- > 2.1%2-2.1:1.0 > Jun 25 01:36:18 CCuxAMD usb-mount: PATH=3D/bin:/sbin:/usr/sbin:/usr/bin > Jun 25 01:36:18 CCuxAMD usb-mount: ACTION=ADd > Jun 25 01:36:18 CCuxAMD usb-mount: PWD=3D/etc/hotplug > Jun 25 01:36:18 CCuxAMD usb-mount: HOME=3D/ > Jun 25 01:36:18 CCuxAMD usb-mount: SHLVL=3D3 > Jun 25 01:36:18 CCuxAMD usb-mount: DEVICE=3D/proc/bus/usb/002/006 > Jun 25 01:36:18 CCuxAMD usb-mount: INTERFACE=3D8/5/80 > Jun 25 01:36:18 CCuxAMD usb-mount: PRODUCTTc/8b/1 > Jun 25 01:36:18 CCuxAMD usb-mount: TYPE=3D0/0/0 > Jun 25 01:36:18 CCuxAMD usb-mount: SEQNUM(9 > Jun 25 01:36:18 CCuxAMD usb-mount: _=3D/usr/bin/env > Jun 25 01:36:18 CCuxAMD usb-mount: ------ > Jun 25 01:36:18 CCuxAMD scsi1 : SCSI emulation for USB Mass Storage > devices > Jun 25 01:36:18 CCuxAMD usb-mount: Cleaning up mounts for detached > devices. > Jun 25 01:36:18 CCuxAMD Vendor: Sony Model: Storage Media =20 > Rev: PROL > Jun 25 01:36:18 CCuxAMD Type: Direct-Access =20 > ANSI SCSI revision: 02 > Jun 25 01:36:18 CCuxAMD usb-mount: Called to mount device > /devices/pci0000:00/0000:00:11.3/usb2/2-2/2-2.1/2-2.1:1.0 > Jun 25 01:36:18 CCuxAMD usb-mount: DEVPATH yields SCSI host number 1 > Jun 25 01:36:18 CCuxAMD usb-mount: SCSI disk device for 1 is UNKNOWN > Jun 25 01:36:18 CCuxAMD usb-mount: Disk device is UNKNOWN > Jun 25 01:36:18 CCuxAMD usb-mount: SCSI disk device is UNKNOWN > Jun 25 01:36:18 CCuxAMD usb-mount: Could not find device for > /devices/pci0000:00/0000:00:11.3/usb2/2-2/2-2.1/2-2.1:1.0 > Jun 25 01:36:18 CCuxAMD usb-mount: Checking for unused mountpoints > Jun 25 01:36:18 CCuxAMD SCSI device sda: 256000 512-byte hdwr sectors > (131 MB) > Jun 25 01:36:18 CCuxAMD sda: assuming Write Enabled > Jun 25 01:36:18 CCuxAMD sda: sda1 > Jun 25 01:36:18 CCuxAMD Attached scsi removable disk sda at scsi1, > channel 0, id 0, lun 0 > Jun 25 01:36:18 CCuxAMD Attached scsi generic sg0 at scsi1, channel > 0, id 0, lun 0, type 0 >=20 > When i call usb-mount in a console, it works fine and the desktop > icon gets created. >=20 > Has anyone any suggestions for this? ---end quoted text--- I'm not using udev yet, but I do have hotplug/usb-mount working. For that, I use a /etc/hotplug/usb/usb-module a bit different from the one provided by usb-mount. Here it is: [root@idolize root]# cat /etc/hotplug/usb/usb-storage #!/bin/bash /usr/bin/logger -t usb-storage -p user.notice "$ACTION DEVICE=3D$DEVICE DEV= PATH=3D$DEVPATH" if [ "$ACTION" =3D "add" ] then # Sleep a while, until $DEVICE exist tries=3D5 [ -n "$DEVICE" ] && file=3D"$DEVICE" || file=3D"$DEVPATH" while [ ! -e "$file" -a "$tries" -ne 0 ]; do sleep 1 tries=3D$(($tries-1)) done /usr/bin/logger -t usb-storage -p user.notice "Adding $file" /usr/sbin/usb-mount < /dev/null 1> /dev/null 2>&1 fi Note that it waits the DEVICE/DEVPATH be created before calling usb-monut, and timeout after 5 tries (1 try per second). hope it helps. --=20 Marcelo Ricardo Leitner ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 -=20 digital self defense, top technical experts, no vendor pitches,=20 unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel