We make a custom HID device, and we use the standard HID device drivers
provided by Microsoft to talk to it. Our device shows up in the Device
Manager as a USB Human Interface Device. Each of our devices reports a unique
serial number during USB enumeration.
The first time that a specific device with a given serial number is plugged
in on an XP system, there is a delay as the system finds the device drivers
for the device. If this device is unplugged and then replugged in later,
there is no noticeable delay after plugging in.
If our application is running when the device is plugged in, we process
WM_DEVICE_CHANGE messages, and look for what is plugged in by running code
that calls dynSetupDiGetClassDevs, etc. to walk the device database looking
for devices with our USB vendor and product ID's. We also check that the
SPDRP_CONFIGFLAGS property is set in an attempt to verify that installation
for the device is complete. If we find a device matching these criteria, we
open it and start communicating with it.
Sometimes, we get messages from Windows warning us that we need to reboot.
This only happens if our app is running and we have opened a device that was
just plugged in for the first time. I believe that we are opening the device
before Windows has finished with the HID device driver initialization for the
device.
How can we avoid getting the reboot warnings from Windows?