All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: device properties and change events
Date: Thu, 28 Mar 2013 22:58:45 +0000	[thread overview]
Message-ID: <20130328225845.GC24344@kroah.com> (raw)
In-Reply-To: <F391FB4F21BEC943926789308B8035905C5C8FD8@LAX-EX-MB3.datadirect.datadirectnet.com>

On Wed, Mar 27, 2013 at 04:47:39AM +0000, Keith Pine wrote:
> I'm using udev-147 in CentOS 6.3.

My sympathies :)

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

What is triggering a change event?  What type of device?  What driver?

> 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?

I think that is correct.  When a device "changes", all of it's
attributes are thrown away as they obviously changed (the kernel told us
so.)

> Also, is it possible to determine *what* causes a change event to occur?

What type of device is this?

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

Your kernel driver should tell you why, what driver is it?

thanks,

greg k-h

  reply	other threads:[~2013-03-28 22:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27  4:47 device properties and change events Keith Pine
2013-03-28 22:58 ` Greg KH [this message]
2013-03-29  1:26 ` Keith Pine

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=20130328225845.GC24344@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --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 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.