Hi,
I have a device in PNP_DEVICE_DISABLED state (my driver notifies PnP manager of the state change by calling IoInvalidateDeviceState when my driver detects the device hardware is disabled). When the device hardware is enabled, my driver calls IoInvalidateDeviceState to notify the Pnp manager again to update the device state but this time IoInvalidateDeviceState doesn’t work (It seems to only queue the device action if the device node is in started state (0x308)). PnP manager never sends IRP_MN_QUERY_DEVICE_STATE.
Any suggestion to bring the device back online?
Thanks,
JT
Once a device is reported as disabled, the pnp device stack is torn down and removed. If you still have the device, that means you have a PDO since that is the only remaining part of the stack after the remove is processed. To reenable the device, you must do this from user mode so I don’t think this API is doing what you want, at least from the perspective of restarting it dynamically from a kernel driver.
There is a way to get this working in a device driver if we are talking about a PDO you enumerate. Basicaly, you must report the PDO as missing and then report it as present again and the stack will be reenumerated and restarted. If you use KMDF, this is a one line call to WdfDeviceSetFailed(WdfDeviceFailedAttemptRestart).
d
Thank you, Doron. That’s helpful.