From: Greg KH <greg@kroah.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Writing General Rules for USB devices.
Date: Tue, 16 Jan 2007 17:45:24 +0000 [thread overview]
Message-ID: <20070116174524.GA1498@kroah.com> (raw)
In-Reply-To: <C5065F118AFB3D478B052FC1E9810D9C235F56@tec-mail.ttec.soc-soft.com>
On Tue, Jan 16, 2007 at 02:06:14PM +0530, Krishna Prasad G. wrote:
>
> Hi Hotplug Development,
>
> This is regarding writing general rules for any USB devices.
>
> I am G.Krishna Prasad. I am working on Linux 2.6.15 kernel.
>
> I need to identify USB devices connection and removal automatically.
>
> I have written following udev rules in 10-local.rules in /etc/udev/rules.d:
>
> ACTION="add", SUBSYSTEM="usb_device", RUN+="/sbin/myusbmonitor 0"
> ACTION="remove", SUBSYSTEM="usb_device", RUN+="/sbin/myusbmonitor 1"
>
> and the script "myusbmonitor" is as follows:
>
> #!/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="add", SUBSYSTEM="usb_device", RUN+="/sbin/myusbmonitor 0"
> # ACTION="remove", SUBSYSTEM="usb_device", RUN+="/sbin/myusbmonitor 1"
> #
> #
>
> if [ $1 -eq "0" ]; then
> echo "usb was inserted into the PC " >> /tmp/usb ; #log the usb found event
> else
> echo "usb was removed from the PC" >> /tmp/usb ; #log the usb removal event
> fi
>
>
> Issues/Concerns:
> -----------------
>
> Only "Add" event is recognized by my script.
>
> No "Remove" events are captured.
>
> 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=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
prev parent reply other threads:[~2007-01-16 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-16 8:48 Writing General Rules for USB devices Krishna Prasad G.
2007-01-16 17:45 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070116174524.GA1498@kroah.com \
--to=greg@kroah.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).