All of lore.kernel.org
 help / color / mirror / Atom feed
* Writing General Rules for USB devices.
@ 2007-01-16  8:48 Krishna Prasad G.
  2007-01-16 17:45 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Krishna Prasad G. @ 2007-01-16  8:48 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 1298 bytes --]


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.

Thanks and regards,
G.Krishna Prasad.

[-- Attachment #1.2: Type: text/html, Size: 2068 bytes --]

[-- Attachment #2: Type: text/plain, Size: 543 bytes --]

The information contained in this e-mail message and in any annexure is confidential to the  recipient and may contain privileged information. If you are not the intended recipient, please notify the sender and delete the message along with any annexure. You should not disclose, copy or otherwise use the information contained
in the message or any annexure. Any views expressed in this e-mail are those of the individual sender except where the sender specifically states them to be the views of SoCrates Software India Pvt Ltd., Bangalore.

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
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=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 226 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Writing General Rules for USB devices.
  2007-01-16  8:48 Writing General Rules for USB devices Krishna Prasad G.
@ 2007-01-16 17:45 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2007-01-16 17:45 UTC (permalink / raw)
  To: linux-hotplug

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-16 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-16  8:48 Writing General Rules for USB devices Krishna Prasad G.
2007-01-16 17:45 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.