linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Ordering hotplug scripts vs. udev device node creation
@ 2006-10-23 19:26 Aaron Cohen
  2006-10-24  2:45 ` Andrey Borzenkov
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Cohen @ 2006-10-23 19:26 UTC (permalink / raw)
  To: linux-hotplug-devel, linux-kernel

(I sent this email to the linux kernel mailing list a couple of days
ago so the first couple of paragraphs may seem familiary to someone
who reads both lists.  I just found the hotplug list though, and have
some new details added.)

I'm trying to modify the gpsd hotplug script to work better with my
udev setup.  My USB serial devices are added to /dev/tts/USBx by udev
and the default script assumes they are /dev/ttyUSBx.

In any event, my hotplug script uses udevinfo to figure out the device
file to use.  The problem seems to be though that my hotplug script is
getting run before udev has actually created the device node.  Is
there some ordering mechanism I'm missing that would help me out here?

I am now using udev rules exclusively rather than old-style hotplug
rules.  I've created a file in /etc/udev/rules.d called 51-gpsd.rules
which contains:

KERNEL="ttyUSB[0-9]*", RUN+="/lib/udev/gpsd"

/lib/udev/gpsd is my script that runs udevinfo to figure out the /dev/
file to use and communicates this to gpsd through a control socket.

Adding a USB device seems to work correctly (more or less, my script
is invoked a few too many times but I think I can figure out how to
adjust my rule) using this.  I'm having trouble now with removal
though.  By the time my script runs the device file has been removed
by udev and I can't look it up through udevinfo any longer.  I need to
know what the name of the device file was so I can tell gpsd to stop
monitoring it.

Any ideas?

Thanks,
Aaron

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Ordering hotplug scripts vs. udev device node creation
  2006-10-23 19:26 Ordering hotplug scripts vs. udev device node creation Aaron Cohen
@ 2006-10-24  2:45 ` Andrey Borzenkov
  0 siblings, 0 replies; 2+ messages in thread
From: Andrey Borzenkov @ 2006-10-24  2:45 UTC (permalink / raw)
  To: linux-hotplug-devel; +Cc: Aaron Cohen, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 23 October 2006 23:26, Aaron Cohen wrote:
> Adding a USB device seems to work correctly (more or less, my script
> is invoked a few too many times but I think I can figure out how to
> adjust my rule) using this.  I'm having trouble now with removal
> though.  By the time my script runs the device file has been removed
> by udev and I can't look it up through udevinfo any longer.  I need to
> know what the name of the device file was so I can tell gpsd to stop
> monitoring it.
>
> Any ideas?

udev sets DEVNAME and DEVLINKS environment before calling RUN program. You can 
either pass them directly like

RUN+="/your/program env{DEVNAME} env{DEVLINKS}"

or your program can get them from environment. It unfortunately seems to be 
not documented.

HTH

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFPX5YR6LMutpd94wRAsDrAJ92kOTrofNo3kg/5xW0C6bzm5TlDACg0/NG
K4R+tBQzCHJSN+XW5WBPghE=ZIet
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2006-10-24  2:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 19:26 Ordering hotplug scripts vs. udev device node creation Aaron Cohen
2006-10-24  2:45 ` Andrey Borzenkov

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