From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Tue, 16 Jan 2007 17:45:24 +0000 Subject: Re: Writing General Rules for USB devices. Message-Id: <20070116174524.GA1498@kroah.com> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On Tue, Jan 16, 2007 at 02:06:14PM +0530, Krishna Prasad G. wrote: >=20 > Hi Hotplug Development, >=20 > This is regarding writing general rules for any USB devices. >=20 > I am G.Krishna Prasad. I am working on Linux 2.6.15 kernel.=20 >=20 > I need to identify USB devices connection and removal automatically.=20 >=20 > I have written following udev rules in 10-local.rules in /etc/udev/rules.= d: >=20 > ACTION=3D"add", SUBSYSTEM=3D"usb_device", RUN+=3D"/sbin/myusbmonitor 0" > ACTION=3D"remove", SUBSYSTEM=3D"usb_device", RUN+=3D"/sbin/myusbmonitor 1" >=20 > and the script "myusbmonitor" is as follows: >=20 > #!/bin/sh > #Description: A prototype script to demonstrate insertion/removal any usb= device using udev frame work of linux > # > #Note: Use this script when you have following lines to /etc/udev/rules.d= /50-udev.rules > # > # ##Added by Manjunathan Padua > # ACTION=3D"add", SUBSYSTEM=3D"usb_device", RUN+=3D"/sbin/myusbmonitor 0" > # ACTION=3D"remove", SUBSYSTEM=3D"usb_device", RUN+=3D"/sbin/myusbmonitor= 1" > # > # >=20 > if [ $1 -eq "0" ]; then > echo "usb was inserted into the PC " >> /tmp/usb ; #log the usb found ev= ent > else > echo "usb was removed from the PC" >> /tmp/usb ; #log the usb removal e= vent > fi >=20 >=20 > Issues/Concerns: > ----------------- >=20 > Only "Add" event is recognized by my script. >=20 > No "Remove" events are captured. >=20 > Please help me in this regard. Have you run 'udevmonitor' and watched the events happen? Perhaps you are just missing the remove event somehow. Also, please try a newer kernel version, 2.6.15 is quite old now, especially in the usb_device area. good luck, greg k-h ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ 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