[systemd-devel] How to wait for a group of devices?

Greg KH gregkh at linuxfoundation.org
Mon Aug 19 07:53:52 PDT 2013


On Mon, Aug 19, 2013 at 04:10:22PM +0200, Manuel Reimer wrote:
> Hello,
> 
> I need two service files for two daemons.
> 
> The first one expects some type of device to be accessible via USB.
> 
> So what I need for this one is something like "Wait until all currently 
> plugged in USB devices are enumerated and the relevant kernel modules 
> have been loaded".

There is no way to ever know that "all plugged in USB devices are
enumerated".  USB has no such knowledge of this, so wanting to wait for
it, would mean you just wait for forever.

So you might want to rethink your requirement, unless you like
impossible requirements :)

> The second one wants to access DVB devices.
> 
> These could be connected via PCI, PCI express or USB. So here I need 
> "Wait until all possible, currently connected, DVB devices are 
> initialized and drivers are loaded".

Same here, there is no way to ever do this (PCI devices can be
hotplugged at anytime, just like USB).

Instead, just do something based on _when_ you see a specific type of
USB device, that way everything will work properly, no need to "wait"
for anything.

thanks,

greg k-h


More information about the systemd-devel mailing list