abaljry
2008-09-11 11:20:01 UTC
I have usb dongle that has 4 interfaces.
so I think I need to modify the SelectInterfaces function in the usbsamp
sample to support multiple interfaces.
the problem that I found is the limited resources talk about that, and the
only way I found is:
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(¶ms);
}
else {
settingPairs = ExAllocatePoolWithTag(
PagedPool,
sizeof(WDF_USB_INTERFACE_SETTING_PAIR) * numInterfaces,
MEM_TAG
);
if (settingPairs == NULL){
return STATUS_INSUFFICIENT_RESOURCES;
}
InitSettingPairs(
UsbDevice,
settingPairs,
numInterfaces
);
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(
¶ms,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
¶ms
);
But I don't know what InitSettingPairs should do?
so I think I need to modify the SelectInterfaces function in the usbsamp
sample to support multiple interfaces.
the problem that I found is the limited resources talk about that, and the
only way I found is:
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(¶ms);
}
else {
settingPairs = ExAllocatePoolWithTag(
PagedPool,
sizeof(WDF_USB_INTERFACE_SETTING_PAIR) * numInterfaces,
MEM_TAG
);
if (settingPairs == NULL){
return STATUS_INSUFFICIENT_RESOURCES;
}
InitSettingPairs(
UsbDevice,
settingPairs,
numInterfaces
);
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(
¶ms,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
¶ms
);
But I don't know what InitSettingPairs should do?