I think I have a solution.  There are a number of 'substitutions' that
are available when a udev rule is triggered ('see here'
(https://linux.die.net/man/7/udev)).  The most appropriate one for my
case seems to be $parent.

> $parent, %P
> The node name of the parent device.

These temporary substitutions can be passed to the script that runs when
the udev rule is triggered.  So my idea is to get my 'restart' script to
output the node name to a file.  It will look something like this:

Code:
--------------------
    bus/usb/001/005
--------------------


Then I can have another udev rule that is triggered on -any- USB
'remove' event, and the script can check all the node names that are
'removed' against the value that's in the file that the 'restart' script
wrote.  Like this:

Code:
--------------------
    
  SUBSYSTEM=="usb", ACTION=="bind", ATTR{idVendor}=="08bb", 
ATTR{idProduct}=="2704", RUN+="/home/tc/SQLITE-restart.sh $parent"
  SUBSYSTEM=="usb", ACTION=="remove", RUN+="/home/tc/SQLITE-stop.sh stop 
$parent"
  
--------------------


That's the theory.


------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=113661

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to