Discussion:
kmdf usbsamp
(too old to reply)
abaljry
2008-09-11 11:20:01 UTC
Permalink
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(&params);

}

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(

&params,

numInterfaces,

settingPairs

);

}

status = WdfUsbTargetDeviceSelectConfig(

UsbDevice,

NULL,

&params

);

But I don't know what InitSettingPairs should do?
Doron Holan [MSFT]
2008-09-11 21:19:45 UTC
Permalink
What does InitSettingPairs() do? each entry in the settingPairs array
should set a WDFUSBINTERFACE and the setting index you want to use during
select config

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by abaljry
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
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);
}
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(
&params,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
&params
);
But I don't know what InitSettingPairs should do?
abaljry
2008-09-11 22:36:01 UTC
Permalink
Dear Doron,
Thanks for your reply, the code was taken from this link
http://msdn.microsoft.com/en-us/library/aa492481.aspx

so I don't know what InitSettingPairs do :(

can you please give me some more details how to impliment InitSettingPairs ?
Post by Doron Holan [MSFT]
What does InitSettingPairs() do? each entry in the settingPairs array
should set a WDFUSBINTERFACE and the setting index you want to use during
select config
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by abaljry
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
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);
}
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(
&params,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
&params
);
But I don't know what InitSettingPairs should do?
Doron Holan [MSFT]
2008-09-12 17:45:21 UTC
Permalink
InitSettings would look something like this
InitSettings(WDFUSBDEVICE UsbDevice, PWDF_USB_INTERFACE_SETTING_PAIR Pairs,
ULONG NumSettings)
{
for(UCHAR i = 0; i < NumSettings; i++) {
Pairs[i].UsbInterface = WdfUsbDeviceGetInterface(UsbDevice, i);
Pairs[i].SettingIndex = 0;
}
}

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by abaljry
Dear Doron,
Thanks for your reply, the code was taken from this link
http://msdn.microsoft.com/en-us/library/aa492481.aspx
so I don't know what InitSettingPairs do :(
can you please give me some more details how to impliment InitSettingPairs ?
Post by Doron Holan [MSFT]
What does InitSettingPairs() do? each entry in the settingPairs array
should set a WDFUSBINTERFACE and the setting index you want to use during
select config
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by abaljry
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
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);
}
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(
&params,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
&params
);
But I don't know what InitSettingPairs should do?
shrutika
2014-03-06 09:21:29 UTC
Permalink
Post by abaljry
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
if (numInterfaces == 1){
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);
}
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(
&params,
numInterfaces,
settingPairs
);
}
status = WdfUsbTargetDeviceSelectConfig(
UsbDevice,
NULL,
&params
);
But I don't know what InitSettingPairs should do?
Hi,

Can anyone tell me what WdfUsbDeviceGetInterface() function does?
This function is used in InitSettingPairs().


Thanks,
shrutika

Loading...