From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sun, 28 Mar 2004 14:58:20 +0000 Subject: Re: add/remove actions for usb devices Message-Id: <20040328145820.GA5442@vrfy.org> List-Id: References: <40648838.2040703@labri.fr> In-Reply-To: <40648838.2040703@labri.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Sun, Mar 28, 2004 at 04:35:27PM +0200, jjluza wrote: > I try to do that too. > I have a script called usbst.dev in /etc/dev.d/block > it contains : > > #!/bin/bash > > case $ACTION in > > add) > ls -l /dev/usbst1 >> /tmp/udeveventlog > mount -t vfat -o sync /dev/usbst1 /mnt/usbst > echo "mount done" >> /tmp/udeveventlog > ls -l /dev/usbst1 >> /tmp/udeveventlog > esac > > > if I try to add a case "remove)", it fails on syntax error > it seems udev handles add and remove in the same case (ie "add)"), maybe it is > what it should do, but it's not easy to manage. > > More, when I plug my usb stick, /tmp/udeveventlog contains : > brw------- 1 root root 8, 1 Mar 28 16:20 /dev/usbst1 > brw------- 1 root root 8, 1 Mar 28 16:20 /dev/usbst1 > mount done > mount done > brw------- 1 root root 8, 1 Mar 28 16:20 /dev/usbst1 > brw------- 1 root root 8, 1 Mar 28 16:20 /dev/usbst1 > > This behaviour seems strange for me, isn't it ? > Anyway, my usb stick is well mounted, but I get some messages in console which > say (2 times) that my stick is already mounted (it seems that the script is > run several times), so it's not very clean. The script is called for every device node udev has created. You get one event for the main device and one for the partition. I expect, that you need to look at DEVPATH to catch the "partition call" only. Kay ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ 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