I have 2 similar USB devices which are being plugged into 2 USB Ports on the same PC simultaneously. I want to use a single driver for both the instances.
I have a scenario wherein on a fresh system (registry and service cleaned up) the installation of the first device happens successfully and when we hook up the second device, the driver gets removed and unloaded and both of them are loaded again.
List of IRP’s when the first device is hooked.
After AddDevice
IRP_MN_QUERY_LEGACY_BUS_INFORMATION
IRP_MN_QUERY_RESOURCE_REQUIREMENTS
IRP_MN_FILTER_RESOURCE_REQUIREMENTS
IRP_MN_START_DEVICE
IRP_MN_QUERY_CAPABILITIES
IRP_MN_QUERY_PNP_DEVICE_STATE
IRP_MN_QUERY_DEVICE_RELATIONS
IRP_MN_QUERY_DEVICE_TEXT
IRP_MN_QUERY_ID
IRP_MN_QUERY_INTERFACE
IRP_MN_QUERY_DEVICE_RELATIONS
When i hook up the second device, the IRP IRP_MN_QUERY_CAPABILITIES is sent 4 times followed by IRP_MN_QUERY_DEVICE_RELATIONS
Then i get the Found New Hardware Popup and when i go ahead and start the installation of the second device, i get the following IRP’s
IRP_MN_QUERY_DEVICE_RELATIONS which returns with a failure STATUS_NOT_SUPPORTED
After this, we get the IRP_MN_QUERY_REMOVE_DEVICE and IRP_MN_REMOVE_DEVICE and the driver is Unloaded.
Now, the driver is loaded again i.e. DriverEntry is called and AddDevice is called twice. The devices get installed successfully, as seen in the Device Manager.
Now if i remove both the devices and then if i insert them back, this behavior is not seen.
Any help in this regard is highly appreciated.