2006-10-21 17:21:37

by Aaron Cohen

[permalink] [raw]
Subject: Ordering hotplug scripts vs. udev device node creation

Hope this is a reasonable list to post this to.

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?

Thanks,
Aaron


2006-10-21 18:36:15

by Andreas Jellinghaus

[permalink] [raw]
Subject: Re: Ordering hotplug scripts vs. udev device node creation

not sure, I ran into the same problem with usb device files
(both in /proc and /dev/bus/usb). and my quick hack was to simply
add a "sleep 1".

but there might be a cleaner solution:
with udevmonitor you should see what udev does, and it should
give you the name of the device it creates, so the call to udevinfo
should not be needed. and when that event with the device name
comes in - at least I hope - udev has already created it.

(at least I think it would be right if it creates a file to fire
the event associated with doing that after the mknod.)

maybe give it a try. reporting back here (or on the hotplug mailing
list which might be more appropriate) would be very welcome, as you
are not the only one running into these kind of problems.

good luck!

Andreas

2006-10-22 18:49:29

by Alistair John Strachan

[permalink] [raw]
Subject: Re: Ordering hotplug scripts vs. udev device node creation

On Saturday 21 October 2006 18:21, Aaron Cohen wrote:
> Hope this is a reasonable list to post this to.
>
> 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?

Some distros have gotten rid of hotplug altogether and now use udev entirely
for handling plugging events (udevd). It seems like what you could do here
was write a simple udev rule to symlink the device when it's created.

--
Cheers,
Alistair.

Final year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.