From: Aras Vaichas <arasv@magtech.com.au>
To: linux-hotplug@vger.kernel.org
Subject: Re: ENV variable scope question
Date: Fri, 22 Aug 2008 03:44:48 +0000 [thread overview]
Message-ID: <48AE3630.5000608@magtech.com.au> (raw)
In-Reply-To: <48ACC6DD.4070705@magtech.com.au>
>>> On Thu, Aug 21, 2008 at 03:37, Aras Vaichas <arasv@magtech.com.au> wrote:
>>>> Hi, I'm looking to unload a userspace driver when a particular
>>>> device is removed.
Here are my (hopefully) final rules. I have to load/unload on the
usb_device because the ttyUSB[0-9]
device doesn't get disconnected if an application still has the dev file
open.
ACTION="add", ENV{DEVTYPE}="usb_device",
ATTRS{manufacturer}="Crystalfontz", ENV{REMOVE_CMD}="/usr/bin/sv down
lcdd", RUN+="/usr/bin/sv up lcdd"
ACTION="add", KERNEL="ttyUSB[0-9]",
ATTRS{manufacturer}="Crystalfontz", SYMLINK+="lcd"
These rules will:
* load the LCDproc daemon when a supported USB LCD device is plugged in
* create a symbolic link so that the the lcdd configuration file will
always point to the correct ttyUSB*
* facilitate the shutdown of the demon which releases the ttyUSB* device
and frees it for further use
It will fail though if two of the same device are plugged in but that
would be an unusual situation for my embedded product and I can live
with that.
> It's per device, stored in the udev database. You can look at it
> with: /sbin/udevadm info --query=all --name=ttyUSB0 or watch it while
> add/remove a device: /sbin/udevadm monitor --udev --env
udevadm info --query=all --name=ttyUSB0 --attribute-walk
This is also very helpful, and would have saved me some time, but I
didn't know that this is what I really wanted all along. :P
I think my next rule set will be a lot easier and faster now that I
better understand what it is that I am supposed to be looking for.
Thanks for all the help and tips.
Aras
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
prev parent reply other threads:[~2008-08-22 3:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 1:37 ENV variable scope question Aras Vaichas
2008-08-21 5:30 ` Aras Vaichas
2008-08-21 5:33 ` FW:Re: " Sujit Karataparambil
2008-08-21 5:47 ` Aras Vaichas
2008-08-21 6:31 ` FW:Re: " Kay Sievers
2008-08-21 6:45 ` Kay Sievers
2008-08-21 7:17 ` Aras Vaichas
2008-08-21 7:57 ` Kay Sievers
2008-08-22 3:44 ` Aras Vaichas [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=48AE3630.5000608@magtech.com.au \
--to=arasv@magtech.com.au \
--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).