Driver Development Kit (DDK)

Showing results for 
Search instead for 
Did you mean: 

Service dependency in driver, how to wait for dependencies before continuing

Hi all,

My company has a driver for our PXI modules (Built on the Mighty Mouse base), and we think we have an issue with some kind of service dependency. The behavior we observe is that on some computers, our driver fails to detect any modules when it initializes. If we later tell it to re-init, all modules are discovered normally. We've also tried delaying the start of the driver (so it doesn't init until ~1min after boot) and this resolves the issue: all modules are detected on the first scan.

We think maybe our driver is loading faster than some service it depends on. The problem is, we're not sure which one. We have some workarounds (re-init after a couple minutes, delay startup of the driver) but we'd really prefer a solution that actually addresses the issue. Our ideal solution would be to write in some kind of wait until [dependency service] has finished loading, as opposed to some arbitrary hard-coded time delay. Any thoughts on how we can identify the relevant service (or, if we're barking up the wrong tree: how we can find the right tree to bark up)?

The code itself looks like it's based on NISysConfig:

    NISysCfgStatus status;
	NISysCfgSessionHandle sessionHandle;
	status = NISysCfgInitializeSession(
	if (NISysCfg_Failed(status))
		return kEnumerationFailure;
	typedef std::unique_ptr<NISysCfgSessionHandle, decltype(&NISysCfgCloseHandle)> SessionCloser;
	SessionCloser sessionHandleCloser(&sessionHandle, NISysCfgCloseHandle);

	NISysCfgEnumResourceHandle resourceEnumHandle;
	status = NISysCfgFindHardware(
	if (NISysCfg_Failed(status))
		return kEnumerationFailure;
	if (resourceEnumHandle == NULL)
		//If there are no matching devices, then resourceEnumHandle may be NULL.
		return 0;
	SessionCloser resourceEnumHandleCloser(&resourceEnumHandle, NISysCfgCloseHandle);


We're not seeing errors of any kind, just nothing detected.

0 Kudos
Message 1 of 1