* Executing user script
@ 2001-03-26 22:56 Michael Wright
2001-03-27 5:19 ` Greg KH
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Michael Wright @ 2001-03-26 22:56 UTC (permalink / raw)
To: linux-hotplug
I have a script that I want to call everytime that hotplug gets
activated. (i.e. I want to notify my application everytime a USB device
is added or removed) Is there a way to do this without hard coding
my script name in one of the hotplug scripts?
Thanks
Michael
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Executing user script
2001-03-26 22:56 Executing user script Michael Wright
@ 2001-03-27 5:19 ` Greg KH
2001-03-27 15:58 ` David Brownell
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2001-03-27 5:19 UTC (permalink / raw)
To: linux-hotplug
On Mon, Mar 26, 2001 at 05:56:55PM -0500, Michael Wright wrote:
>
> I have a script that I want to call everytime that hotplug gets
> activated. (i.e. I want to notify my application everytime a USB device
> is added or removed) Is there a way to do this without hard coding
> my script name in one of the hotplug scripts?
A different way might be to look at usbdevfs. For usbview, I stat
/proc/bus/usb/devices and if that changes, then I know a device was
added or removed. Then you can go and scan the tree to see what
happened.
devfs can also notify your program when a device is seen or removed.
As for your original question, I don't think there is a way to add a
user helper, but not quite sure. Need to look at the scripts some
more...
Hope this helps,
greg k-h
--
greg@(kroah|wirex).com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Executing user script
2001-03-26 22:56 Executing user script Michael Wright
2001-03-27 5:19 ` Greg KH
@ 2001-03-27 15:58 ` David Brownell
2001-03-27 18:08 ` Michael Wright
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Brownell @ 2001-03-27 15:58 UTC (permalink / raw)
To: linux-hotplug
> I have a script that I want to call everytime that hotplug gets
> activated. (i.e. I want to notify my application everytime a USB device
> is added or removed) Is there a way to do this without hard coding
> my script name in one of the hotplug scripts?
Sounds exactly like when /etc/hotplug/usb.agent gets called, so
at some level you just want a enhanced hotplug agent behavior.
At this point there's no general hook to make that particular
behavioral change, so you'd have to modify or replace that
agent script. Do you think this will be a common enough task
that the scripts should accomodate it directly? You didn't say
what your "application" does.
As Greg noted, if you have usbdevfs configured there are
other ways to get such notifications. As just one example,
the Java USB library has a standard notifier interface that
calls out to report add/remove of devices and busses. I
don't think the C "libusb" does such stuff now though.
- Dave
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Executing user script
2001-03-26 22:56 Executing user script Michael Wright
2001-03-27 5:19 ` Greg KH
2001-03-27 15:58 ` David Brownell
@ 2001-03-27 18:08 ` Michael Wright
2001-03-27 18:41 ` David Brownell
2001-03-27 18:58 ` Gioele Barabucci
4 siblings, 0 replies; 6+ messages in thread
From: Michael Wright @ 2001-03-27 18:08 UTC (permalink / raw)
To: linux-hotplug
Yes, an enhanced hotplug agent behavior. I cannot be certain if this will
be a common enough task that the scripts should accomodate it
directly. I am certain that I would use the feature. Basically I do not
want my application to poll for added/removed devices. I wanted to
be told that a device was plugged in.
Also, I did not want to add my personal scripts to the agent so that it
would be easy to install new releases of hotplug. I am looking for
something generic.
-Michael
On Tue, 27 Mar 2001, David Brownell wrote:
> > I have a script that I want to call everytime that hotplug gets
> > activated. (i.e. I want to notify my application everytime a USB device
> > is added or removed) Is there a way to do this without hard coding
> > my script name in one of the hotplug scripts?
>
> Sounds exactly like when /etc/hotplug/usb.agent gets called, so
> at some level you just want a enhanced hotplug agent behavior.
>
> At this point there's no general hook to make that particular
> behavioral change, so you'd have to modify or replace that
> agent script. Do you think this will be a common enough task
> that the scripts should accomodate it directly? You didn't say
> what your "application" does.
>
> As Greg noted, if you have usbdevfs configured there are
> other ways to get such notifications. As just one example,
> the Java USB library has a standard notifier interface that
> calls out to report add/remove of devices and busses. I
> don't think the C "libusb" does such stuff now though.
>
> - Dave
>
>
>
>
> _______________________________________________
> Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
> Linux-hotplug-devel@lists.sourceforge.net
> http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
>
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Executing user script
2001-03-26 22:56 Executing user script Michael Wright
` (2 preceding siblings ...)
2001-03-27 18:08 ` Michael Wright
@ 2001-03-27 18:41 ` David Brownell
2001-03-27 18:58 ` Gioele Barabucci
4 siblings, 0 replies; 6+ messages in thread
From: David Brownell @ 2001-03-27 18:41 UTC (permalink / raw)
To: linux-hotplug
I have a hard time designing without knowing some of the
context. If this is truly an "application" rather than a system
tool (of the sort that must integrate closely with other tools
like the hotplug agents), why wouldn't it want to learn only
about certain devices or classes thereof?
If it only wants to know about certain devices, then it's
practical to just add lines to /etc/hotplug/usb.handmap to
run scripts when those devices are added. In fact, you
should be able to just add an "accepts anything" entry to
that file right now (match_flags is zero, no test fails).
Updating the hotplug data will necessarily bring out
some interesting upgrade issues, whether that data is
viewed as such (all the mapfiles) or as code (scripts).
- Dave
----- Original Message -----
From: "Michael Wright" <mwright@aol.net>
To: "David Brownell" <david-b@pacbell.net>
Cc: <Linux-hotplug-devel@lists.sourceforge.net>
Sent: Tuesday, March 27, 2001 10:08 AM
Subject: Re: Executing user script
>
> Yes, an enhanced hotplug agent behavior. I cannot be certain if this will
> be a common enough task that the scripts should accomodate it
> directly. I am certain that I would use the feature. Basically I do not
> want my application to poll for added/removed devices. I wanted to
> be told that a device was plugged in.
> Also, I did not want to add my personal scripts to the agent so that it
> would be easy to install new releases of hotplug. I am looking for
> something generic.
>
> -Michael
>
> On Tue, 27 Mar 2001, David Brownell wrote:
>
> > > I have a script that I want to call everytime that hotplug gets
> > > activated. (i.e. I want to notify my application everytime a USB device
> > > is added or removed) Is there a way to do this without hard coding
> > > my script name in one of the hotplug scripts?
> >
> > Sounds exactly like when /etc/hotplug/usb.agent gets called, so
> > at some level you just want a enhanced hotplug agent behavior.
> >
> > At this point there's no general hook to make that particular
> > behavioral change, so you'd have to modify or replace that
> > agent script. Do you think this will be a common enough task
> > that the scripts should accomodate it directly? You didn't say
> > what your "application" does.
> >
> > As Greg noted, if you have usbdevfs configured there are
> > other ways to get such notifications. As just one example,
> > the Java USB library has a standard notifier interface that
> > calls out to report add/remove of devices and busses. I
> > don't think the C "libusb" does such stuff now though.
> >
> > - Dave
> >
> >
> >
> >
> > _______________________________________________
> > Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
> > Linux-hotplug-devel@lists.sourceforge.net
> > http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
> >
>
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Executing user script
2001-03-26 22:56 Executing user script Michael Wright
` (3 preceding siblings ...)
2001-03-27 18:41 ` David Brownell
@ 2001-03-27 18:58 ` Gioele Barabucci
4 siblings, 0 replies; 6+ messages in thread
From: Gioele Barabucci @ 2001-03-27 18:58 UTC (permalink / raw)
To: linux-hotplug
On Tuesday 27 March 2001 00:56, Michael Wright wrote:
> I have a script that I want to call everytime that hotplug gets
> activated. (i.e. I want to notify my application everytime a USB device
> is added or removed) Is there a way to do this without hard coding
> my script name in one of the hotplug scripts?
>
It does not seem difficult...
1st we can create a /etc/hotplug/usb.ext_scripts (containing the names of
programs we have to call) an then execute it line by line from usb.agent.
We can also use something like this
$SCRIPT plugged
$SCRIPT nodriver
$SCRIPT unplugged
$SCRIPT ok
so $1 in your script is the exit status of the various operation done by
hotplug script.
Btw I think the devfs approach is better...
--
Gioele Barabucci (Gb])
) mailto:dev@gioelebarabucci.com
) http://www.gioelebarabucci.com
) ) I've been and now I've gone
) ) /Magic Pie^Oasis
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-03-27 18:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-26 22:56 Executing user script Michael Wright
2001-03-27 5:19 ` Greg KH
2001-03-27 15:58 ` David Brownell
2001-03-27 18:08 ` Michael Wright
2001-03-27 18:41 ` David Brownell
2001-03-27 18:58 ` Gioele Barabucci
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).