USB Multiple Interfaces using KMDF

Hi,

I am new to USB Drivers.

I am having a Driver, which works fine with single interfaces USB Devices.

For single interface USB, i am using
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE in it followed by
a call to API WdfUsbTargetDeviceSelectConfig.

Link: download.microsoft.com/download/9/
c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/USB_WDF.doc

It is working absolutely fine for me.

Now when I try to do for a composite USB Device, I am facing certain issues.

The code looks something like:

numInterfaces =
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice);

if (numInterfaces == 1)

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);

else

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
numInterfaces, NULL);

status = WdfUsbTargetDeviceSelectConfig(
pDeviceContext->WdfUsbTargetDevice, NULL, &params);

if (NT_SUCCESS(status) &&
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice) > 0)

{

pDeviceContext->UsbInterface =
params.Types.SingleInterface.ConfiguredUsbInterface;

pDeviceContext->NumberConfiguredPipes =
params.Types.SingleInterface.NumberConfiguredPipes;

}

Though, this code is not working right now, but I do have some queries in
mind.

  1. Since in my case, there is no concept of alternate pairs (as per my
    understanding), is it fine to have WDF_USB_INTERFACE_SETTING_PAIR
    parameter in WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES
    as NULL.

  2. In case WdfUsbTargetDeviceSelectConfig runs fine, what will be the values
    of pDeviceContext->UsbInterface and pDeviceContext->NumberConfiguredPipes in
    case of Composite device (Multiple interfaces case)?

  3. In case the above things are done correctly, is there anything else as
    well which I need to take care of, for the sake of completeness.

The above code is somehow not working for me. Please help me resolve it.

Regards,

Shreshth

For composite interfaces that are correctly implemented just use the
generic parent driver. See USB Common Class Generic Parent Driver in the
WDK.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shreshth Luthra
Sent: Tuesday, July 10, 2007 7:31 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Multiple Interfaces using KMDF

Hi,

I am new to USB Drivers.

I am having a Driver, which works fine with single interfaces USB
Devices.

For single interface USB, i am using
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE in it followed
by a call to API WdfUsbTargetDeviceSelectConfig.

Link: download.microsoft.com/download/9/
c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/USB_WDF.doc

It is working absolutely fine for me.

Now when I try to do for a composite USB Device, I am facing certain
issues.

The code looks something like:

numInterfaces =
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice);

if (numInterfaces == 1)

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);

else

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
numInterfaces, NULL);

status = WdfUsbTargetDeviceSelectConfig(
pDeviceContext->WdfUsbTargetDevice, NULL, &params);

if (NT_SUCCESS(status) &&
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice) >
0)

{

pDeviceContext->UsbInterface =
params.Types.SingleInterface.ConfiguredUsbInterface;

pDeviceContext->NumberConfiguredPipes =
params.Types.SingleInterface.NumberConfiguredPipes;

}

Though, this code is not working right now, but I do have some queries
in mind.

  1. Since in my case, there is no concept of alternate pairs (as per my
    understanding), is it fine to have WDF_USB_INTERFACE_SETTING_PAIR
    parameter in
    WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES as NULL.

  2. In case WdfUsbTargetDeviceSelectConfig runs fine, what will be the
    values of pDeviceContext->UsbInterface and
    pDeviceContext->NumberConfiguredPipes in case of Composite device
    (Multiple interfaces case)?

  3. In case the above things are done correctly, is there anything else
    as well which I need to take care of, for the sake of completeness.

The above code is somehow not working for me. Please help me resolve it.

Regards,

Shreshth

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Mark Roddy wrote:

For composite interfaces that are correctly implemented just
use the generic parent driver. See USB Common Class Generic
Parent Driver in the WDK.

“Correctly implemented”? Multi-interface device != composite device.

For example CDC ACM is two USB interfaces, but only exposes one actual function, through both interfaces.

Shretsh Luthra wrote:

Though, this code is not working right now, but I do have some
queries in mind.

What exactly do you mean by “not working”? It crashes? The API returns an error?

In case WdfUsbTargetDeviceSelectConfig runs fine, what will be
the values of pDeviceContext->UsbInterface and pDeviceContext
->NumberConfiguredPipes in case of Composite device

The last argument to WdfUsbTargetDeviceSelectConfig() is a struct which contains a union – if you call the function on a multi-interface device, you will get the value MultiInterface.NumberOfConfiguredInterfaces filled out (I believe).

If you want the individual WDFUSBINTERFACE handles, you have to call WdfUsbTargetDeviceGetInterface() and pass in the index of the interface that you want. Same thing with getting pipe handles.

In short, the pattern is:

  1. WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(…)
  2. WdfUsbTargetDeviceSelectConfig(…)
  3. WdfUsbTargetDeviceGetInterface(…)
  4. WdfUsbInterfaceGetNumConfiguredPipes(…)
  5. WdfUsbInterfaceGetConfiguredPipe(…)

First, this

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
numInterfaces, NULL);

Should be this since you are not providing an array of pairs (if you
look at the header for the implementation of this INIT function, you
will see what is going on)

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
0, NULL);

  1. The array of pairs is to allow you to specify which alternate
    setting index you want to use for each interface. If you pass in NULL,
    then alt setting 0 will be used for each interface. If all of your
    interfaces only have one setting, why are you even using multiple
    interfaces? You typically use multiple interfaces when at least one of
    the interfaces can change bandwidth (i.e. isoch endpoints) or as
    specified by a usb class spec like CDC

  2. In the multiple interface case, params.Types.SingleInterface.*
    is not defined. The field name should give you a very large clue here,
    SingleInterface. Instead, in the multiple interface case you need to
    look at a different part of the structure, the docs for
    WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES
    (http://msdn2.microsoft.com/en-us/library/aa492481.aspx) tell you this,
    all you need to do is read them. Look at
    params.Types.MultipleInterface.NumberOfConfiguredInterfaces. since you
    did not provide a pairs array, the Pairs field will be NULL.

Since you did not pass a pairs array, you must now iterate over each of
the interfaces (using WdfUsbTargetDeviceGetInterface). For each
WDFUSBINTERFACE, get the number of configured endpoints
(WdfUsbInterfaceGetNumConfiguredPipes) and then process each endpoint.

Instead of going through different code paths for a single or multiple
interface device, you can always use the multiple interface path for
both. The multiple interface init will work on a single interface
device, the only difference between a multiple and single inint is that
for a single interface device we return to you the WDFUSBINTERFACE
handle in the config structure

  1. Only you can answer that. You have to know how to handle each
    interface and if you need to select alternate settings for any of them.
    Remember that when you select a different alt setting, the current set
    of endpoints (WDFUSBPIPE handles) get destroyed so you must not be
    currently performing any i/o on the (soon to be) old handles.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shreshth Luthra
Sent: Tuesday, July 10, 2007 4:31 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Multiple Interfaces using KMDF

Hi,

I am new to USB Drivers.

I am having a Driver, which works fine with single interfaces USB
Devices.

For single interface USB, i am using
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE in it followed
by a call to API WdfUsbTargetDeviceSelectConfig.

Link: download.microsoft.com/download/9/
c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/USB_WDF.doc

It is working absolutely fine for me.

Now when I try to do for a composite USB Device, I am facing certain
issues.

The code looks something like:

numInterfaces =
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice);

if (numInterfaces == 1)

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);

else

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
numInterfaces, NULL);

status = WdfUsbTargetDeviceSelectConfig(
pDeviceContext->WdfUsbTargetDevice, NULL, &params);

if (NT_SUCCESS(status) &&
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice) >
0)

{

pDeviceContext->UsbInterface =
params.Types.SingleInterface.ConfiguredUsbInterface;

pDeviceContext->NumberConfiguredPipes =
params.Types.SingleInterface.NumberConfiguredPipes;

}

Though, this code is not working right now, but I do have some queries
in mind.

  1. Since in my case, there is no concept of alternate pairs (as per my
    understanding), is it fine to have WDF_USB_INTERFACE_SETTING_PAIR
    parameter in
    WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES as NULL.

  2. In case WdfUsbTargetDeviceSelectConfig runs fine, what will be the
    values of pDeviceContext->UsbInterface and
    pDeviceContext->NumberConfiguredPipes in case of Composite device
    (Multiple interfaces case)?

  3. In case the above things are done correctly, is there anything else
    as well which I need to take care of, for the sake of completeness.

The above code is somehow not working for me. Please help me resolve it.

Regards,

Shreshth

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks a lot Doron for such an elaborated explaination.

But i do still have a few doubts in mind.

  1. As far as alternate pairs is concerned i am not sure of. I am not having
    the actual device with me. It is there at a remote location and client is
    using the term Composite Device for it. And at moment there is no one ot
    provide me the device specifications. So, is it possible that it could be
    having Alternate pairs. If so, how to populate SETTING_PAIRS array.
  2. Once done, what all value do i need to set in the Device Context. It is
    OK to obtain values using WdfUsbTargetDeviceGetInterface and
    WdfUsbInterfaceGetConfiguredPipe. How will we take care of multiple
    interfaces here.

Thanks a lot.

Regards,
Shreshth

On 7/11/07, Doron Holan wrote:
>
> First, this
>
>
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
> numInterfaces, NULL);
>
> Should be this since you are not providing an array of pairs (if you look
> at the header for the implementation of this INIT function, you will see
> what is going on)
>
>
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params, 0,
> NULL);
>
> 1) The array of pairs is to allow you to specify which alternate
> setting index you want to use for each interface. If you pass in NULL, then
> alt setting 0 will be used for each interface. If all of your interfaces
> only have one setting, why are you even using multiple interfaces? You
> typically use multiple interfaces when at least one of the interfaces can
> change bandwidth (i.e. isoch endpoints) or as specified by a usb class
> spec like CDC
>
>
>
> 2) In the multiple interface case, params.Types.SingleInterface.* is
> not defined. The field name should give you a very large clue here,
> SingleInterface. Instead, in the multiple interface case you need to look
> at a different part of the structure, the docs for
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES (
> http://msdn2.microsoft.com/en-us/library/aa492481.aspx) tell you this, all
> you need to do is read them. Look at
> params.Types.MultipleInterface.NumberOfConfiguredInterfaces. since you
> did not provide a pairs array, the Pairs field will be NULL.
>
>
>
> Since you did not pass a pairs array, you must now iterate over each of
> the interfaces (using WdfUsbTargetDeviceGetInterface). For each
> WDFUSBINTERFACE, get the number of configured endpoints
> (WdfUsbInterfaceGetNumConfiguredPipes) and then process each endpoint.
>
>
>
> Instead of going through different code paths for a single or multiple
> interface device, you can always use the multiple interface path for both.
> The multiple interface init will work on a single interface device, the only
> difference between a multiple and single inint is that for a single
> interface device we return to you the WDFUSBINTERFACE handle in the config
> structure
>
>
>
> 3) Only you can answer that. You have to know how to handle each
> interface and if you need to select alternate settings for any of them.
> Remember that when you select a different alt setting, the current set of
> endpoints (WDFUSBPIPE handles) get destroyed so you must not be currently
> performing any i/o on the (soon to be) old handles.
>
>
>
> d
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Shreshth Luthra
> Sent: Tuesday, July 10, 2007 4:31 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] USB Multiple Interfaces using KMDF
>
>
>
> Hi,
>
> I am new to USB Drivers.
>
> I am having a Driver, which works fine with single interfaces USB Devices.
>
> For single interface USB, i am using
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE in it followed by
> a call to API WdfUsbTargetDeviceSelectConfig.
>
> Link: download.microsoft.com/download/9/
> c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/USB_WDF.doc
>
> It is working absolutely fine for me.
>
> Now when I try to do for a composite USB Device, I am facing certain
> issues.
>
> The code looks something like:
>
> numInterfaces =
> WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice);
>
> if (numInterfaces == 1)
>
>
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);
>
> else
>
>
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
> numInterfaces, NULL);
>
> status = WdfUsbTargetDeviceSelectConfig(
> pDeviceContext->WdfUsbTargetDevice, NULL, &params);
>
> if (NT_SUCCESS(status) &&
> WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice) > 0)
>
> {
>
> pDeviceContext->UsbInterface =
> params.Types.SingleInterface.ConfiguredUsbInterface;
>
> pDeviceContext->NumberConfiguredPipes =
> params.Types.SingleInterface.NumberConfiguredPipes;
>
> }
>
> Though, this code is not working right now, but I do have some queries in
> mind.
>
> 1. Since in my case, there is no concept of alternate pairs (as per my understanding), is it fine to have WDF_USB_INTERFACE_SETTING_PAIR parameter in WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES as NULL.
>
> 2. In case WdfUsbTargetDeviceSelectConfig runs fine, what will be the
> values of pDeviceContext->UsbInterface and
> pDeviceContext->NumberConfiguredPipes in case of Composite device (Multiple
> interfaces case)?
>
> 3. In case the above things are done correctly, is there anything else as
> well which I need to take care of, for the sake of completeness.
>
>
>
> The above code is somehow not working for me. Please help me resolve it.
>
>
>
> Regards,
>
> Shreshth
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List
> Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Shreshth Luthra wrote:

As far as alternate pairs is concerned i am not sure of. I am
not having the actual device with me. It is there at a remote
location and client is using the term Composite Device for it.
And at moment there is no one ot provide me the device
specifications. So, is it possible that it could behaving Alternate
pairs.

Well, of course there is. Anything’s possible. In fact, based on recent posts, it is likely that the device will have some goofy configuration which you are not “authorized” to change in order to reduce your workload by 10X.

I think what you should do first is complain to your management about the futility of trying to develop a device driver without the device itself and without specifications.

  1. The only reason you will need to populate the pairs array is if
    by default when you first select a configuration you do not want to use
    alt setting #0 for each interface. This would be a corner case.
    Typically if an interface has alternate settings, alt setting #0 is the
    right choice since it, by convention, consumes no bandwidth or is the
    correct initial setting

  2. Again, this depends on your device and how generic your driver
    must be. Typically a driver knows the exact config of its usb device
    and you can hardcode storage fields for the values (WDFUSBPIPE handles)
    you will need at runtime. If you are going to be selecting alternate
    settings on an interface, you can store each WDFUSBINTERFACE handle in
    your context if you want, but it is also easily retrievable at runtime
    and can be retrieved when needed only during a select alt setting call.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shreshth Luthra
Sent: Tuesday, July 10, 2007 1:38 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] USB Multiple Interfaces using KMDF

Thanks a lot Doron for such an elaborated explaination.

But i do still have a few doubts in mind.

  1. As far as alternate pairs is concerned i am not sure of. I am not
    having the actual device with me. It is there at a remote location and
    client is using the term Composite Device for it. And at moment there is
    no one ot provide me the device specifications. So, is it possible that
    it could be having Alternate pairs. If so, how to populate SETTING_PAIRS
    array.

  2. Once done, what all value do i need to set in the Device Context. It
    is OK to obtain values using WdfUsbTargetDeviceGetInterface and
    WdfUsbInterfaceGetConfiguredPipe. How will we take care of multiple
    interfaces here.

Thanks a lot.

Regards,

Shreshth

On 7/11/07, Doron Holan wrote:

First, this

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
numInterfaces, NULL);

Should be this since you are not providing an array of pairs (if you
look at the header for the implementation of this INIT function, you
will see what is going on)

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
0, NULL);

1) The array of pairs is to allow you to specify which alternate
setting index you want to use for each interface. If you pass in NULL,
then alt setting 0 will be used for each interface. If all of your
interfaces only have one setting, why are you even using multiple
interfaces? You typically use multiple interfaces when at least one of
the interfaces can change bandwidth ( i.e. isoch endpoints) or as
specified by a usb class spec like CDC

2) In the multiple interface case, params.Types.SingleInterface.*
is not defined. The field name should give you a very large clue here,
SingleInterface. Instead, in the multiple interface case you need to
look at a different part of the structure, the docs for
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES (
http://msdn2.microsoft.com/en-us/library/aa492481.aspx) tell you this,
all you need to do is read them. Look at
params.Types.MultipleInterface.NumberOfConfiguredInterfaces. since you
did not provide a pairs array, the Pairs field will be NULL.

Since you did not pass a pairs array, you must now iterate over each of
the interfaces (using WdfUsbTargetDeviceGetInterface). For each
WDFUSBINTERFACE, get the number of configured endpoints
(WdfUsbInterfaceGetNumConfiguredPipes) and then process each endpoint.

Instead of going through different code paths for a single or multiple
interface device, you can always use the multiple interface path for
both. The multiple interface init will work on a single interface
device, the only difference between a multiple and single inint is that
for a single interface device we return to you the WDFUSBINTERFACE
handle in the config structure

3) Only you can answer that. You have to know how to handle each
interface and if you need to select alternate settings for any of them.
Remember that when you select a different alt setting, the current set
of endpoints (WDFUSBPIPE handles) get destroyed so you must not be
currently performing any i/o on the (soon to be) old handles.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shreshth Luthra
Sent: Tuesday, July 10, 2007 4:31 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Multiple Interfaces using KMDF

Hi,

I am new to USB Drivers.

I am having a Driver, which works fine with single interfaces USB
Devices.

For single interface USB, i am using
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE in it followed
by a call to API WdfUsbTargetDeviceSelectConfig.

Link: download.microsoft.com/download/9/
c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/USB_WDF.doc

It is working absolutely fine for me.

Now when I try to do for a composite USB Device, I am facing certain
issues.

The code looks something like:

numInterfaces =
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice);

if (numInterfaces == 1)

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);

else

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( &params,
numInterfaces, NULL);

status = WdfUsbTargetDeviceSelectConfig(
pDeviceContext->WdfUsbTargetDevice, NULL, &params);

if (NT_SUCCESS(status) &&
WdfUsbTargetDeviceGetNumInterfaces(pDeviceContext->WdfUsbTargetDevice) >
0)

{

pDeviceContext->UsbInterface =
params.Types.SingleInterface.ConfiguredUsbInterface;

pDeviceContext->NumberConfiguredPipes =
params.Types.SingleInterface.NumberConfiguredPipes;

}

Though, this code is not working right now, but I do have some queries
in mind.

1. Since in my case, there is no concept of alternate pairs (as per my
understanding), is it fine to have WDF_USB_INTERFACE_SETTING_PAIR
parameter in
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES as NULL.

2. In case WdfUsbTargetDeviceSelectConfig runs fine, what will be the
values of pDeviceContext->UsbInterface and
pDeviceContext->NumberConfiguredPipes in case of Composite device
(Multiple interfaces case)?

3. In case the above things are done correctly, is there anything else
as well which I need to take care of, for the sake of completeness.

The above code is somehow not working for me. Please help me resolve it.

Regards,

Shreshth

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Dude what i suggest is that you get clear with the scenario in which u require the interface and then decide upon the interface to use.

If you are having a composite device then I fully agree with Mark Roddy.
In other case if you want a multiple interface then first of all look into the code you have provided as TYPES.SINGLEINTERFACE is not what you will be needing.You need something like an array of pairs to get the result and also the arguments to the function WdfUsbTargetDeviceSelectConfig() need to be changed.

This multiple interface discussion is interesting. Wouldn’t it be nice to have a sample driver that supports multiple interfaces in the WDK. Hmmmmm…

ANYHow, to ask a simple question: Under what conditions are the generic parent driver loaded, causing the device to be handled as a composite device (as opposed to allowing my driver to handle the multiple functions itself)? Is it only when I specify device class/subclass/protocol of 0x00??

Peter
OSR

Peter Viscarola (OSR) wrote:

ANYHow, to ask a simple question: Under what conditions are the
generic parent driver loaded, causing the device to be handled as
a composite device (as opposed to allowing my driver to handle
the multiple functions itself)? Is it only when I specify device
class/subclass/protocol of 0x00??

I think this is documented on MSDN, but I believe the criteria to get the USB\COMPOSITE compatible ID are:

  1. 0x00/0x00/0x00 as you say, or EF/02/01 if you are using an IAD

  2. number of configurations == 1

  3. number of interfaces > 1

Why are there no multi interface samples? b/c most of the multi
interface drivers out there are class drivers and would not be a good
example and there is nothing like the fx2 chip like you guys created
that is MI that we can use.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Wednesday, July 11, 2007 7:39 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB Multiple Interfaces using KMDF

This multiple interface discussion is interesting. Wouldn’t it be nice
to have a sample driver that supports multiple interfaces in the WDK.
Hmmmmm…

ANYHow, to ask a simple question: Under what conditions are the generic
parent driver loaded, causing the device to be handled as a composite
device (as opposed to allowing my driver to handle the multiple
functions itself)? Is it only when I specify device
class/subclass/protocol of 0x00??

Peter
OSR


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks a lot for all the help in this regard.

There is another question i am having.
There is another USB device (Assume it as ABC), which is having 2 inputs.
One as USB (On which device our final USB Device XYZ is connected) and other
is the SD Card Reader.
Now, WdfUsbTargetDeviceGetNumInterfaces as expected returns 1as number of
USB device Interfaces.

So, how is this case different from
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACEhttp:
case i.e. how differently these two cases (XYZ connected directly on PC and
XYZ connected to PC via ABC) need to be handled.

Thanks a lot.

Regards,
Shreshth

On 7/12/07, Doron Holan wrote:
>
> Why are there no multi interface samples? b/c most of the multi
> interface drivers out there are class drivers and would not be a good
> example and there is nothing like the fx2 chip like you guys created
> that is MI that we can use.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
> Sent: Wednesday, July 11, 2007 7:39 AM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] USB Multiple Interfaces using KMDF
>
> This multiple interface discussion is interesting. Wouldn’t it be nice
> to have a sample driver that supports multiple interfaces in the WDK.
> Hmmmmm…
>
> ANYHow, to ask a simple question: Under what conditions are the generic
> parent driver loaded, causing the device to be handled as a composite
> device (as opposed to allowing my driver to handle the multiple
> functions itself)? Is it only when I specify device
> class/subclass/protocol of 0x00??
>
> Peter
> OSR
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></http:>

I can’t quite parse what you are trying to say. You are saying it can
connect over usb or over some other connectivity bus like SD? If so,
selecting a config only applies to the usb connect, the SD connect would
use SD specific APIs.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shreshth Luthra
Sent: Thursday, July 12, 2007 1:34 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] USB Multiple Interfaces using KMDF

Thanks a lot for all the help in this regard.

There is another question i am having.

There is another USB device (Assume it as ABC), which is having 2
inputs. One as USB (On which device our final USB Device XYZ is
connected) and other is the SD Card Reader.

Now, WdfUsbTargetDeviceGetNumInterfaces as expected returns 1as number
of USB device Interfaces.

So, how is this case different from
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE
http: case i.e. how
differently these two cases (XYZ connected directly on PC and XYZ
connected to PC via ABC) need to be handled.

Thanks a lot.

Regards,

Shreshth

On 7/12/07, Doron Holan wrote:

Why are there no multi interface samples? b/c most of the multi
interface drivers out there are class drivers and would not be a good
example and there is nothing like the fx2 chip like you guys created
that is MI that we can use.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Wednesday, July 11, 2007 7:39 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] USB Multiple Interfaces using KMDF

This multiple interface discussion is interesting. Wouldn’t it be nice
to have a sample driver that supports multiple interfaces in the WDK.
Hmmmmm…

ANYHow, to ask a simple question: Under what conditions are the generic
parent driver loaded, causing the device to be handled as a composite
device (as opposed to allowing my driver to handle the multiple
functions itself)? Is it only when I specify device
class/subclass/protocol of 0x00??

Peter
OSR


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</http:>