From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Thu, 28 Mar 2013 22:58:45 +0000 Subject: Re: device properties and change events Message-Id: <20130328225845.GC24344@kroah.com> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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