linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* device properties and change events
@ 2013-03-27  4:47 Keith Pine
  2013-03-28 22:58 ` Greg KH
  2013-03-29  1:26 ` Keith Pine
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Pine @ 2013-03-27  4:47 UTC (permalink / raw)
  To: linux-hotplug

I'm using udev-147 in CentOS 6.3.

I have two rules that import properties into the udev db. I'll use a
simplified example.

    IMPORT{program}="program1 %k"
    ACTION="add", IMPORT{program}="program2 %N"

program1 exports MY_FOO, and program2 exports MY_BAR. I've noticed that
when a change event is triggered, MY_BAR is no longer available in the
udev database. So it appears change events clear the existing environment.
The work done in program2 is relatively expensive so I'd rather only run
it when the device is first added.

It looks like I can re-import MY_BAR if I use IMPORT{db} in a separate
rule:

    IMPORT{program}="program1 %k"
    ACTION="add", IMPORT{program}="program2 %N"
    ACTION="change", IMPORT{db}="MY_BAR"


Is this the correct approach? Or is there another way to persist the
properties that were imported during add, besides re-importing program2?

Also, is it possible to determine *what* causes a change event to occur?
With 'udevadm monitor' I can see change events being triggered whenever my
application exits (for the devices it has opened), and would like to
determine why. I was hoping udev could give me a hint.

-Keith


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

end of thread, other threads:[~2013-03-29  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27  4:47 device properties and change events Keith Pine
2013-03-28 22:58 ` Greg KH
2013-03-29  1:26 ` Keith Pine

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).