KMDF USB Driver: WDF SetConfiguration API reloads the driver for IAP2 interface descriptors
I have a USB drive which advertises vendor specific IAP2 descriptors(See Table 1). With inhouse developed driver, I want to set IAP2 Interface by invoking SetConfiguration request. When I set the configuration for IAP2 interface, the driver gets reloaded and the device advertises new capabilities which has only BOT mode interfaces(See Table 2). Note: At any point of time the drive either advertises IAP2 descriptors or MSC descriptors only.
Table 1: //Drive advertises only Vendor specific - IAP2 descriptors
Device Descriptor
Configuration Descriptor
IAP2 Interface Descriptor 0, AlternateSetting 0 (IAP2 Authentication interface - Has 2 EPs)
IAP2 Interface Descriptor 1, AlternateSetting 0 (IAP2 EA interface - Has 0 Eps)
IAP2 Interface Descriptor 1, AlternateSetting 1 (IAP2 EA interface - Has 2 Eps)
Table 2: //Drive advertises only MSC - BOT mode descriptors
Device Descriptor
Configuration Descriptor
Interface Descriptor 0, AlternateSetting 0 (MSC for BOT mode - Has 2 EPs)
I have compiled below observations for the code changes to invoke SetConfiguration request.
Observation 1:
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS configParams;
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(&configParams, 0, NULL);
status = WdfUsbTargetDeviceSelectConfig(pDeviceContext->UsbDevice, NULL, &configParams);
On invoking SetConfiguration with above settings, I notice back to back SetConfiguration Request and then SetInterface request. SetInterface packet contains request for IAP2 Interface=1, AlternateSetting=0. Both requests(SetConfiguration and SetInterface) are successful and the traces are captured in wireshark/lecory. However, immediately underlying USB stack seems to trigger a warm reset and the driver gets reloaded. Lecroy traces shows that the SetFeature was invoked for U1/U2 enable but Wireshark trace doesn't capture warm reset requests. Now, the device advertizes new capabilities which has MSC BOT mode configuration. SetConfiguration invocation for BOT mode is successful(See Table 2).
Can someone help in giving any clues for below questions.
- Any possible reasons for WarmReset getting triggered by some underlying USB stack layer and why I am unable to set IAP2 configuration via SetConfiguration request persistently.