How to tell WdfUsbTargetDeviceCreate which interface of a composite device to use?

Hi.

I have a compose USB device which has interface0 and interface1. I want WdfUsbTargetDeviceCreate to use interface1 and in my INF I have a fully qualified USB path including the interface1 (%USBT_Simple.DeviceDesc%=MicrosoftDS,USB\VID_5455&PID_5010&MI_01).

However, when using WdfUsbInterfaceGetConfiguredPipe() to get the pipes, I see that I always get the pipes for interface0.

Is there any way to control which interface of a composite device WdfUsbTargetDeviceCreate connects to?

Cheers

Philip

This has nothing to do with kmdf, you installed your driver on only one of the functions in your compound device. If you want one driver stack to contain both interfaces you have 2 options
1 install your driver on the device itself (USB\VID_5455&PID_5010), replacing usbccgp
2 include an IAD in your config descriptor and usbccgp will group the 2 interfaces together into one child function stack

If you want your driver to install as the fdo for the 2nd function stack, add an additional inf entry for the hw id USB\VID_5455&PID_5010&MI_02

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@cox.net
Sent: Friday, August 28, 2009 3:46 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of a composite device to use?

Hi.

I have a compose USB device which has interface0 and interface1. I want WdfUsbTargetDeviceCreate to use interface1 and in my INF I have a fully qualified USB path including the interface1 (%USBT_Simple.DeviceDesc%=MicrosoftDS,USB\VID_5455&PID_5010&MI_01).

However, when using WdfUsbInterfaceGetConfiguredPipe() to get the pipes, I see that I always get the pipes for interface0.

Is there any way to control which interface of a composite device WdfUsbTargetDeviceCreate connects to?

Cheers

Philip


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Thanks Doran.

I was not clear or I am confused. I WANT the driver to install on only one
function of the compound device (the audio function). I have a HID
function (interface0) followed by an Audio function (interface 1, and
interface 2 with alt settings, grouped with IAD). My inf entry is
USB\VID_5455&PID_5010&MI_01 which should point to the first interface of the
audio function. However, KMDF says that there is only one interface and
that interface contains the endpoints of the hid function. Specifying
MI_00, MI_01, or MI_02 does not make any difference.

Philip

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Sunday, August 30, 2009 12:21 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of
a composite device to use?

This has nothing to do with kmdf, you installed your driver on only one of
the functions in your compound device. If you want one driver stack to
contain both interfaces you have 2 options
1 install your driver on the device itself (USB\VID_5455&PID_5010),
replacing usbccgp
2 include an IAD in your config descriptor and usbccgp will group the 2
interfaces together into one child function stack

If you want your driver to install as the fdo for the 2nd function stack,
add an additional inf entry for the hw id USB\VID_5455&PID_5010&MI_02

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@cox.net
Sent: Friday, August 28, 2009 3:46 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of a
composite device to use?

Hi.

I have a compose USB device which has interface0 and interface1. I want
WdfUsbTargetDeviceCreate to use interface1 and in my INF I have a fully
qualified USB path including the interface1
(%USBT_Simple.DeviceDesc%=MicrosoftDS,USB\VID_5455&PID_5010&MI_01).

However, when using WdfUsbInterfaceGetConfiguredPipe() to get the pipes, I
see that I always get the pipes for interface0.

Is there any way to control which interface of a composite device
WdfUsbTargetDeviceCreate connects to?

Cheers

Philip


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Hi Doran.

Another strange thing is that the following code sends my target into an
almost infinite loop (several minutes) when executing
WdfUsbTargetDeviceSelectConfig(). I changed the USB device so that the HID
interface is after the audio interface and now KMDF tells me that it sees 3
interfaces. Looking at the number of endpoints in those interfaces shows
that it is seeing the 2 audio AND the 1 HID interface (although my inf says
USB\VID_5455&PID_5010&MI_00 now, specifying the audio device).

No crash, not getting to the next source code line in WinDbg (the system
seems to stay inside the WdfUsbTargetDeviceSelectConfig and magically exits
this call without exiting that function), but the install finally fails
after a long time.

I would suspect my USB descriptors, but the device works with the generic
drivers on Linux, OSX, and Vista… Both HID and audio.

Very strange…

Philip

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(&configParams,
0, 0);

ntStatus =
WdfUsbTargetDeviceSelectConfig(GetMyExtension()->UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES, &configParams);

Do not know what to tell you. Your driver cannor change the interface groupings for each function, so i do not see how installing on either function will cause misbehavior. If it is stuck for a long time, break in to the debugger and switch to the thread (!thread xxx) and see where it is spending its time. Make sure you iad is correct and look at the device in usbview, it might show you the groupings

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: pgruebele
Sent: Saturday, August 29, 2009 9:38 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of a composite device to use?

Hi Doran.

Another strange thing is that the following code sends my target into an
almost infinite loop (several minutes) when executing
WdfUsbTargetDeviceSelectConfig(). I changed the USB device so that the HID
interface is after the audio interface and now KMDF tells me that it sees 3
interfaces. Looking at the number of endpoints in those interfaces shows
that it is seeing the 2 audio AND the 1 HID interface (although my inf says
USB\VID_5455&PID_5010&MI_00 now, specifying the audio device).

No crash, not getting to the next source code line in WinDbg (the system
seems to stay inside the WdfUsbTargetDeviceSelectConfig and magically exits
this call without exiting that function), but the install finally fails
after a long time.

I would suspect my USB descriptors, but the device works with the generic
drivers on Linux, OSX, and Vista… Both HID and audio.

Very strange…

Philip

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(&configParams,
0, 0);

ntStatus =
WdfUsbTargetDeviceSelectConfig(GetMyExtension()->UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES, &configParams);


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Thanks Doron.

UsbView gives some interesting results. When the “config descriptors”
option is off it gives this for my device:

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0xEF
bDeviceSubClass: 0x02
bDeviceProtocol: 0x01
bMaxPacketSize0: 0x40 (64)
idVendor: 0x5555
idProduct: 0x5013
bcdDevice: 0x0100
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x03
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0005 (5)
bInterval: 0x0A

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Interrupt
wMaxPacketSize: 0x0001 (1)
bInterval: 0x0A

It is showing only the HID (non-IAD) interface even though it is the last
interface. When I select the “config descriptors” option, it simply
crashes.

Yet, my device works with OSX and Vista… Unfortunately none of the other
devices use IAD…

Philip

Hi Doron.

I made a change which now at least allows UsbView to work properly. It now
gives me the following output (see below) when the “config desciprtors”
option is on.

My device used to have this structure when UsbView failed:

Audio IAD
Audio Control Interface 0
Audio Stream Interface 1 Alt setting 0 (zero endpoints)
Audio Stream Interface 1 Alt setting 1 2 endpoints (44K)
Audio Stream Interface 1 Alt setting 2 2 endpoints (48K)
Audio Stream Interface 1 Alt setting 3 etc.
Audio Stream Interface 1 Alt setting 4
Audio Stream Interface 1 Alt setting 5
Audio Stream Interface 1 Alt setting 6
hid

Now, I got rid of all the alt settings and made the structure:

Audio IAD
Audio Control Interface 0
Audio Stream Interface 1 Alt setting 0
Audio Stream Interface 1 Alt setting 1
Hid

Voila, I get the correct output from USBView (see below). The thing is that
I am under the impression that what I was doing is OK. Of course I could
create a separate interface for each sample rate instead of a single
interface with alt settings for all the sample rates… IF this is what it
takes, I will do it, but this should not be necessary, right?

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0xEF
bDeviceSubClass: 0x02
bDeviceProtocol: 0x01
bMaxPacketSize0: 0x40 (64)
idVendor: 0x5555
idProduct: 0x5016
bcdDevice: 0x0100
iManufacturer: 0x01
0x0409: “Audiophilleo”
iProduct: 0x02
0x0409: “USBTransport1”
iSerialNumber: 0x03
0x0409: “6666”
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0005 (5)
bInterval: 0x0A

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Interrupt
wMaxPacketSize: 0x0001 (1)
bInterval: 0x0A

Configuration Descriptor:
wTotalLength: 0x009F
bNumInterfaces: 0x03
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0xA0 (Bus Powered Remote Wakeup)
MaxPower: 0x4B (150 mA)

Unknown Descriptor:
bDescriptorType: 0x0B
bLength: 0x08
08 0B 00 02 01 00 00 00

Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 (Audio)
bInterfaceSubClass: 0x01 (Audio Control)
bInterfaceProtocol: 0x00
iInterface: 0x00

Audio Control Interface Header Descriptor:
bLength: 0x09
bDescriptorType: 0x24
bDescriptorSubtype: 0x01
bcdADC: 0x0100
wTotalLength: 0x0028
bInCollection: 0x01
baInterfaceNr[1]: 0x01

Audio Control Input Terminal Descriptor:
bLength: 0x0C
bDescriptorType: 0x24
bDescriptorSubtype: 0x02
bTerminalID: 0x01
wTerminalType: 0x0101 (USB streaming)
bAssocTerminal: 0x02
bNrChannels: 0x02
wChannelConfig: 0x0003
iChannelNames: 0x00
iTerminal: 0x00

Audio Control Output Terminal Descriptor:
bLength: 0x09
bDescriptorType: 0x24
bDescriptorSubtype: 0x03
bTerminalID: 0x02
wTerminalType: 0x0301 (Speaker)
bAssocTerminal: 0x01
bSoruceID: 0x03
iTerminal: 0x00

Audio Control Feature Unit Descriptor:
bLength: 0x0A
bDescriptorType: 0x24
bDescriptorSubtype: 0x06
bUnitID: 0x03
bSourceID: 0x01
bControlSize: 0x01
bmaControls[0]:
01
bmaControls[1]:
00
bmaControls[2]:
00
iFeature: 0x00

Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 (Audio)
bInterfaceSubClass: 0x02 (Audio Streaming)
bInterfaceProtocol: 0x00
iInterface: 0x00

Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x01
bNumEndpoints: 0x02
bInterfaceClass: 0x01 (Audio)
bInterfaceSubClass: 0x02 (Audio Streaming)
bInterfaceProtocol: 0x00
iInterface: 0x00

Audio Streaming Class Specific Interface Descriptor:
bLength: 0x07
bDescriptorType: 0x24
bDescriptorSubtype: 0x01
bTerminalLink: 0x01
bDelay: 0x04
wFormatTag: 0x0001 (PCM)

Audio Streaming Format Type Descriptor:
bLength: 0x0B
bDescriptorType: 0x24
bDescriptorSubtype: 0x02
bFormatType: 0x01
bNrChannels: 0x02
bSubframeSize: 0x02
bBitResolution: 0x10
bSamFreqType: 0x01
tSamFreq[1]: 0x015888 (88200 Hz)

Endpoint Descriptor:
bEndpointAddress: 0x05 OUT
Transfer Type: Isochronous
wMaxPacketSize: 0x0170 (368)
wInterval: 0x0004
bSyncAddress: 0x83

Audio Streaming Class Specific Audio Data Endpoint Descriptor:
bLength: 0x07
bDescriptorType: 0x25
bDescriptorSubtype: 0x01
bmAttributes: 0x01
bLockDelayUnits: 0x00
wLockDelay: 0x0000

Endpoint Descriptor:
bEndpointAddress: 0x83 IN
Transfer Type: Isochronous
wMaxPacketSize: 0x0004 (4)
wInterval: 0x0404
bSyncAddress: 0x00

Interface Descriptor:
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x03 (HID)
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00

HID Descriptor:
bcdHID: 0x0111
bCountryCode: 0x21
bNumDescriptors: 0x01
bDescriptorType: 0x22
wDescriptorLength: 0x007C

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0005 (5)
bInterval: 0x0A

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Interrupt
wMaxPacketSize: 0x0001 (1)
bInterval: 0x0A

pgruebele wrote:

Another strange thing is that the following code sends my target into an
almost infinite loop (several minutes) when executing
WdfUsbTargetDeviceSelectConfig(). I changed the USB device so that the HID
interface is after the audio interface and now KMDF tells me that it sees 3
interfaces. Looking at the number of endpoints in those interfaces shows
that it is seeing the 2 audio AND the 1 HID interface (although my inf says
USB\VID_5455&PID_5010&MI_00 now, specifying the audio device).

And the IAD now groups interfaces 0 and 1?

If your HID INF really does match MI_02, then usbccgp.sys will present a
fake configuration descriptor to you that includes only interface 2.
The fact that you’re not getting that suggests there may be a problem
with the INFs. You have 2 INFs (one for HID, one for audio), right?

Do you have an INF that matches USB\VID_5455&PID_5010 without the
interfaces? You don’t want to match that at all. The system will fall
back to the generic composite device handler, usbccgp.sys, which will
then enumerate the individual interfaces. Can you post the INFs?

I would suspect my USB descriptors, but the device works with the generic
drivers on Linux, OSX, and Vista… Both HID and audio.

Some of the operating systems are more forgiving of descriptor issues
than the others.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

pgruebele wrote:

Hi Doron.

I made a change which now at least allows UsbView to work properly. It now
gives me the following output (see below) when the “config desciprtors”
option is on.

My device used to have this structure when UsbView failed:

You seem to have a rather old version of usbview. Where did you get
it? You might try uvcview from the tools\avstream directory in the
WDK. It is a bit smarter.

Voila, I get the correct output from USBView (see below). The thing is that
I am under the impression that what I was doing is OK.

Yes, there’s nothing wrong with having multiple settings. I know it
works in usbaudio.sys – I’ve done it.

Of course I could
create a separate interface for each sample rate instead of a single
interface with alt settings for all the sample rates… IF this is what it
takes, I will do it, but this should not be necessary, right?

No. There’s something else going on. Now, usbaudio cannot handle
isochronous pipes with a bInterval smaller than 4, which limits the data
rate to 1MB/sec. Are you under that rate?

Audio Control Input Terminal Descriptor:
bLength: 0x0C
bDescriptorType: 0x24
bDescriptorSubtype: 0x02
bTerminalID: 0x01
wTerminalType: 0x0101 (USB streaming)
bAssocTerminal: 0x02
bNrChannels: 0x02
wChannelConfig: 0x0003
iChannelNames: 0x00
iTerminal: 0x00

Audio Control Output Terminal Descriptor:
bLength: 0x09
bDescriptorType: 0x24
bDescriptorSubtype: 0x03
bTerminalID: 0x02
wTerminalType: 0x0301 (Speaker)
bAssocTerminal: 0x01
bSoruceID: 0x03
iTerminal: 0x00

This is not related to your problem, but you should set bAssocTerminal
to 0 in both of those descriptors. bAssocTerminal is used, for example,
when you have an integrated headset with microphone, to say that the two
exposed terminals are related. In your case, what you have here is just
three nodes that constitute a speaker. The two terminals are already
part of a chain (1 -> 3 -> 2), so bAssocTerminal does not apply.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim.

Yes, IAD now groups interfaces 0 and 1 as my audio device. Interface 2 is the HID.

My INF matches only USB\VID_5455&PID_5010&MI_00 (which should only the be audio device). I only have one INF for the audio device portion of my device since I want Vista to use the generic HID drivers for the HID function. Also bInterval=4 in my case, so that’s not the problem (it was in the past).

I was compiling usbiew from the latest (7600) DDK, but I guess the source code is out of date. Running the newer version gives me this. I wonder why the HID endpoints 1 & 2 area listed twice (first and last).

[Port3] : USB Composite Device

—===>Device Information<===—
English product name: “USBTransport1”

ConnectionStatus:
Current Config Value: 0x01 -> Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0005 = 1 transactions per microframe, 0x05 max bytes
bInterval: 0x0A

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0001 = 1 transactions per microframe, 0x01 max bytes
bInterval: 0x0A

===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0xEF -> This is a Multi-interface Function Code Device
bDeviceSubClass: 0x02 -> This is the Common Class Sub Class
bDeviceProtocol: 0x01 -> This is the Interface Association Descriptor protocol
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0x5555 = Vendor ID not listed with USB.org as of 03-19-2008
idProduct: 0x5021
bcdDevice: 0x0100

===>Configuration Descriptor<===
bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x009F -> Validated
bNumInterfaces: 0x03
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0xA0 -> Bus Powered
MaxPower: 0x4B = 150 mA

===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x00
bInterfaceCount: 0x02
bFunctionClass: 0x01 -> Audio Interface Class
bFunctionSubClass: 0x01 -> Audio Control Interface SubClass
bFunctionProtocol: 0x00
iFunction: 0x00

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x01 -> Audio Control Interface SubClass
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00

===>Audio Control Interface Header Descriptor<===
bLength: 0x09
bDescriptorType: 0x24
bDescriptorSubtype: 0x01
bcdADC: 0x0100
wTotalLength: 0x0028
bInCollection: 0x01
baInterfaceNr[1]: 0x01

===>Audio Control Input Terminal Descriptor<===
bLength: 0x0C
bDescriptorType: 0x24
bDescriptorSubtype: 0x02
bTerminalID: 0x01
wTerminalType: 0x0101 (USB streaming)
bAssocTerminal: 0x00
bNrChannels: 0x02
wChannelConfig: 0x0003
iChannelNames: 0x00
iTerminal: 0x00

===>Audio Control Output Terminal Descriptor<===
bLength: 0x09
bDescriptorType: 0x24
bDescriptorSubtype: 0x03
bTerminalID: 0x02
wTerminalType: 0x0301 (Speaker)
bAssocTerminal: 0x00
bSourceID: 0x03
iTerminal: 0x00

===>Audio Control Feature Unit Descriptor<===
bLength: 0x0A
bDescriptorType: 0x24
bDescriptorSubtype: 0x06
bUnitID: 0x03
bSourceID: 0x01
bControlSize: 0x01
bmaControls[0]:
01
bmaControls[1]:
00
bmaControls[2]:
00
iFeature: 0x00

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x00
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x02 -> Audio Streaming Interface SubClass
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x01
bNumEndpoints: 0x02
bInterfaceClass: 0x01 -> Audio Interface Class
bInterfaceSubClass: 0x02 -> Audio Streaming Interface SubClass
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00

===>Audio Streaming Class Specific Interface Descriptor<===
bLength: 0x07
bDescriptorType: 0x24
bDescriptorSubtype: 0x01
bTerminalLink: 0x01
bDelay: 0x04
wFormatTag: 0x0001 (PCM)

===>Audio Streaming Format Type Descriptor<===
bLength: 0x0B
bDescriptorType: 0x24
bDescriptorSubtype: 0x02
bFormatType: 0x01
bNrChannels: 0x02
bSubframeSize: 0x02
bBitResolution: 0x10
bSamFreqType: 0x01
tSamFreq[1]: 0x015888 (88200 Hz)

===>Endpoint Descriptor<===
bLength: 0x09
bDescriptorType: 0x05
bEndpointAddress: 0x05 -> Direction: OUT - EndpointID: 5
bmAttributes: 0x05 -> Isochronous Transfer Type
Synchronization Type = Asynchronous
Bulk Transfer Type
wMaxPacketSize: 0x0170 = 1 transactions per microframe, 0x170 max bytes
wInterval: 0x0004
bSyncAddress: 0x83

===>Audio Streaming Class Specific Audio Data Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x25
bDescriptorSubtype: 0x01
bmAttributes: 0x01
bLockDelayUnits: 0x00
wLockDelay: 0x0000

===>Endpoint Descriptor<===
bLength: 0x09
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x11 -> Isochronous Transfer Type
Synchronization Type = No Synchronization
Bulk Transfer Type
wMaxPacketSize: 0x0004 = 1 transactions per microframe, 0x04 max bytes
wInterval: 0x0404
bSyncAddress: 0x00

===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x03 -> HID Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00

===>HID Descriptor<===
bLength: 0x09
bDescriptorType: 0x21
bcdHID: 0x0111
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22
wDescriptorLength: 0x007C

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0005 = 1 transactions per microframe, 0x05 max bytes
bInterval: 0x0A

===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0001 = 1 transactions per microframe, 0x01 max bytes
bInterval: 0x0A

Here is my INF. adding or removing the usb.inf references does not seem to make a difference.

[Version]
Signature=“$CHICAGO$”
Class=MEDIA
Provider=%MSFT%
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
DriverVer=08/31/2009,6.1.7600.16385
CatalogFile=USBDongle1.cat

;Class=USB
;ClassGUID={36FC9E60-C465-11CF-8056-444553540000}

;===========================================================================
; USB Plug and Play Devices
;===========================================================================

[DeviceList]
%USBT_Simple.DeviceDesc%=MicrosoftDS,USB\VID_5555&PID_5013&MI_00

[SourceDisksNames]
222=“USBDongle1 Driver Disk”,“”,222

[SourceDisksFiles]
USBDongle1.sys=222

;;This syntax is only recognized on Windows XP and above- it is needed to install 64-bit drivers on
;;Windows Server 2003 Service Pack 1 and above.

[Manufacturer]
%MfgName%=MicrosoftDS,NTAMD64,NTIA64

;; For Windows Server 2003 Service Pack 1 and above, a 64-bit OS will not install a driver
;; unless the Manufacturer and Models Sections explicitly show it is a driver for that platform
;; But the individual model section decorations (or lack thereof) work as they always have.
;; All of the model sections referred to are undecorated or NT-decorated, hence work on all platforms

[MicrosoftDS]
%USBT_Simple.DeviceDesc%=USBT_Simple,*USBT

;; This section enables installing on x64 systems

[MicrosoftDS.NTAMD64]
%USBT_Simple.DeviceDesc%=USBT_Simple,*USBT

;; This section enables installing on Itanium systems

[MicrosoftDS.NTIA64]
%USBT_Simple.DeviceDesc%=USBT_Simple,*USBT

[DestinationDirs]
USBT_Simple.CopyList=10,system32\drivers
DefaultDestDirs = 11

;======================================================
; USBT_SIMPLE
;======================================================
[USBT_Simple]
AlsoInstall=ks.registration(ks.inf),wdmaudio.registration(wdmaudio.inf)
CopyFiles=USBT_Simple.CopyList
AddReg=USBT_Simple.AddReg

[USBT_Simple.CopyList]
USBDongle1.sys

[USBT_Simple.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_RENDER%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_CAPTURE%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Topology%,USBT.I.Topo

[USBT_Simple.AddReg]
HKR,AssociatedFilters,“wdmaud,swmidi,redbook”
HKR,Driver,USBDongle1.sys

HKR,Drivers,SubClasses,“wave,midi,mixer”

HKR,Drivers\wave\wdmaud.drv,Driver,wdmaud.drv
HKR,Drivers\midi\wdmaud.drv,Driver,wdmaud.drv
HKR,Drivers\mixer\wdmaud.drv,Driver,wdmaud.drv

HKR,Drivers\wave\wdmaud.drv,Description,%USBT_Simple.DeviceDesc%
HKR,Drivers\midi\wdmaud.drv,Description,%USBT_MIDI%
HKR,Drivers\mixer\wdmaud.drv,Description,%USBT_Simple.DeviceDesc%

HKLM,%MediaCategories%%Simple.NameGuid%,Name,%Simple.Name%

;======================================================
; COMMON
;======================================================
[USBT.I.Wave]
AddReg=USBT.I.Wave.AddReg
[USBT.I.Wave.AddReg]
HKR,CLSID,%Proxy.CLSID%
HKR,FriendlyName,%USBT.Wave.szPname%

[USBT.I.Topo]
AddReg=USBT.I.Topo.AddReg
[USBT.I.Topo.AddReg]
HKR,CLSID,%Proxy.CLSID%
HKR,FriendlyName,%USBT.Topo.szPname%

;======================================================
; USBT_SIMPLE. usb.inf and Composite.Dev may not be needed since we have proper IAD
;======================================================
[USBT_Simple.NT]
Characteristics = 0x84
BusType = 5
Include=ks.inf,wdmaudio.inf,usb.inf
Needs=KS.Registration, WDMAUDIO.Registration, Composite.Dev
CopyFiles=USBT_Simple.CopyList
AddReg=USBT_Simple.AddReg

[USBT_Simple.NT.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_RENDER%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_CAPTURE%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Topology%,USBT.I.Topo

[USBT_Simple.NT.Services]
AddService=USBDongle1,0x00000002,USBTransport1_Service_Inst

[USBTransport1_Service_Inst]
DisplayName=%USBDongle1.SvcDesc%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%10%\system32\drivers\USBDongle1.sys

;-------------- WDF Coinstaller installation

[DestinationDirs]
CoInstaller_CopyFiles = 11

[USBT_Simple.NT.CoInstallers]
AddReg=CoInstaller_AddReg
CopyFiles=CoInstaller_CopyFiles

[CoInstaller_CopyFiles]
wdfcoinstaller01009_chk.dll

[SourceDisksFiles]
wdfcoinstaller01009_chk.dll=222 ; make sure the number matches with SourceDisksNames

[CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “wdfcoinstaller01009_chk.dll,WdfCoInstaller”

[USBT_Simple.NT.Wdf]
KmdfService = USBDongle1, USBT_wdfsect

[USBT_wdfsect]
KmdfLibraryVersion = 1.9

;---------------------------------------------------------------;

[Strings]
MSFT=“The Company”
MfgName=“The Company”
USBT_Simple.DeviceDesc=“USBDongle1 192Khz/24Bit”

USBT.Wave.szPname=“USBT Wave”
USBT.Topo.szPname=“USBT Topology”
USBT_MIDI=“USBT -> WDM Midi Device”

Proxy.CLSID=“{17CCA71B-ECD7-11D0-B908-00A0C9223196}”
KSCATEGORY_AUDIO=“{6994AD04-93EF-11D0-A3CC-00A0C9223196}”
KSCATEGORY_RENDER=“{65E8773E-8F56-11D0-A3B9-00A0C9223196}”
KSCATEGORY_CAPTURE=“{65E8773D-8F56-11D0-A3B9-00A0C9223196}”

KSNAME_Wave=“Wave”
KSNAME_Topology=“Topology”

USBDongle1.SvcDesc=“The Company USBDongle1 192Khz Driver”

MediaCategories=“SYSTEM\CurrentControlSet\Control\MediaCategories”

Simple.NameGuid=“{946A7B1A-EBBC-422a-A81F-F07C8D40D3B4}”
Simple.Name=“USBT”

xxxxx@cox.net wrote:

Yes, IAD now groups interfaces 0 and 1 as my audio device. Interface 2 is the HID.

My INF matches only USB\VID_5455&PID_5010&MI_00 (which should only the be audio device). I only have one INF for the audio device portion of my device since I want Vista to use the generic HID drivers for the HID function. Also bInterval=4 in my case, so that’s not the problem (it was in the past).

I was compiling usbiew from the latest (7600) DDK, but I guess the source code is out of date. Running the newer version gives me this. I wonder why the HID endpoints 1 & 2 area listed twice (first and last).

Usbview and uvcview both show you the currently active configuration of
the device first, followed by the device descriptor, followed by the
configuration descriptor. Someone has done a select_configuration with
the HID interface, so its endpoints are currently active.

When you add the additional alternate settings, you are repeating these
6 descriptors for each format, right?

===>Interface Descriptor<===
===>Audio Streaming Class Specific Interface Descriptor<===
===>Audio Streaming Format Type Descriptor<===
===>Endpoint Descriptor<===
===>Audio Streaming Class Specific Audio Data Endpoint Descriptor<===
===>Endpoint Descriptor<==

That should work. As I said, I’ve done it, except for the “sync”
endpoint. None of the devices I’ve worked with have ever used those.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Yes, I am repeating all those descriptors + the synch descriptors.

I have managed to get my driver to load correctly and the following code to
work.

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(&configParams,
0, 0);
ntStatus =
WdfUsbTargetDeviceSelectConfig(GetMyExtension()->UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES, &configParams);

So now I need to focus on this composite device business.

If I understand correctly, given my INF, my driver should only see 2
interfaces (interface 0 and 1), right? But
WdfUsbTargetDeviceGetNumInterfaces() is telling me that there are 3
interfaces (and these are interfaces 0,1,2) so it is seeing the HID
interface. The system still detects and installs the generic HID function
drivers, but the system no longer receives keyboard events after
WdfUsbTargetDeviceSelectConfig() is called. Probably because it is seeing
interface 2 (which it should not) and therefore messing with the HID
interface? If I just install the generic usb audio driver, the HID keyboard
works perfectly.

Also, when I place the HID descriptors before the audio IAD, then WDF only
sees one interface (interface 0 from the HID) even if my INF says MI_01.
How could that be? Why is it seeing only one (the wrong one) when placing
IAD first makes it see ALL interfaces when it should not?

I’m just really confused about what WDF is seeing and why…

Thanks
Philip

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, August 31, 2009 2:53 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of
a composite device to use?

xxxxx@cox.net wrote:

Yes, IAD now groups interfaces 0 and 1 as my audio device. Interface 2 is
the HID.

My INF matches only USB\VID_5455&PID_5010&MI_00 (which should only the be
audio device). I only have one INF for the audio device portion of my
device since I want Vista to use the generic HID drivers for the HID
function. Also bInterval=4 in my case, so that’s not the problem (it was in
the past).

I was compiling usbiew from the latest (7600) DDK, but I guess the source
code is out of date. Running the newer version gives me this. I wonder why
the HID endpoints 1 & 2 area listed twice (first and last).

Usbview and uvcview both show you the currently active configuration of
the device first, followed by the device descriptor, followed by the
configuration descriptor. Someone has done a select_configuration with
the HID interface, so its endpoints are currently active.

When you add the additional alternate settings, you are repeating these
6 descriptors for each format, right?

===>Interface Descriptor<===
===>Audio Streaming Class Specific Interface Descriptor<===
===>Audio Streaming Format Type Descriptor<===
===>Endpoint Descriptor<===
===>Audio Streaming Class Specific Audio Data Endpoint
Descriptor<===
===>Endpoint Descriptor<==

That should work. As I said, I’ve done it, except for the “sync”
endpoint. None of the devices I’ve worked with have ever used those.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Another Update. This one regarding the handing problem I was having (perhaps related to the problem of detecting too many interfaces?).

The following code also causes the infinite loop inside WdfUsbTargetDeviceSelectConfig() if and only if I load the usbaudio.sys driver first and then update the driver to mine using the device MMC. Before I was always updating from usbaudio.sys so I was always getting the hang. But if I reboot and allow my driver to load directly I never get a hang. I can replug my device and reboot as many times as I like and it works. I can also update to a newer version of my driver and that works too. Only if I update from usbaudio.sys, the following code hangs:

WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(&configParams, 0, 0);
ntStatus = WdfUsbTargetDeviceSelectConfig(GetMyExtension()->UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES, &configParams);

I did a debug break during this infinite loop and dumped the WDF log to get the following:

There are 2 log entries
— start of log —
1: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7BCE0308 state, sending WDFREQUEST 8875F9D8, state WdfIoTargetStarted
1: FxIoTarget::SubmitLocked - ignoring WDFIOTARGET 7BCE0308 state, sending WDFREQUEST 8875F9D8, state WdfIoTargetStarted
---- end of log ----

!thread xxx yields the following:

ChildEBP RetAddr Args to Child
8875f568 81cc0332 83aa0828 83aa08b0 81d1613c nt!KiSwapContext+0x26 (FPO: [Uses EBP] [0,0,4])
8875f5ac 81c5bf38 83aa0828 857670e8 856a48d0 nt!KiSwapThread+0x44f
8875f600 8c449169 856a48d0 00000005 00000000 nt!KeWaitForSingleObject+0x492
8875f620 8c44899e 85767028 856a4768 856a4768 USBPORT!USBPORT_CloseEndpointRefList+0x2b (FPO: [2,0,4])
8875f640 8c44889c 86d3f3d0 50456c63 856a4768 USBPORT!USBPORT_CloseEndpoint+0xee (FPO: [3,1,4])
8875f660 8c46d1fb 86d3f3d0 85767028 57706970 USBPORT!USBPORT_ClosePipe+0x146 (FPO: [3,0,4])
8875f688 8c44cbad 86d3f3d0 85767028 00000000 USBPORT!USBPORT_InternalCloseConfiguration+0x204 (FPO: [3,2,4])
8875f6d0 8c445260 85767028 846980e8 849b15b0 USBPORT!USBPORT_SelectConfiguration+0xcd (FPO: [3,10,4])
8875f704 8c441c0f 86c49028 85767028 846980e8 USBPORT!USBPORT_ProcessURB+0x8f7 (FPO: [5,5,4])
8875f730 8c43ecf8 86c49028 846980e8 8432aa28 USBPORT!USBPORT_PdoInternalDeviceControlIrp+0x198 (FPO: [3,1,4])
8875f75c 81c58976 86c49028 8432aa28 ffef3ff7 USBPORT!USBPORT_Dispatch+0x31a (FPO: [2,3,4])
8875f774 8228d6c2 ffef3ff7 8875f794 8229407a nt!IofCallDriver+0x63
8875f780 8229407a 86c3d9c0 846980e8 8469820c acpi!ACPIDispatchForwardIrp+0x2a (FPO: [2,0,4])
8875f794 8228df02 86c3d9c0 846980e8 846980e8 acpi!ACPIIrpDispatchDeviceControl+0xa4 (FPO: [2,0,4])
8875f7c4 81c58976 86c3d9c0 83a4acb8 8469824c acpi!ACPIDispatchIrp+0x19a (FPO: [2,5,4])
8875f7dc 8c60fc4a 8561f030 846980e8 86c46028 nt!IofCallDriver+0x63
8875f800 8c60cd19 86c46028 8561f030 846980e8 usbhub!UsbhFdoSelectConfigurationPdo+0x194 (FPO: [3,4,4])
8875f820 8c60d1d5 86c460e0 8561f030 846980e8 usbhub!UsbhFdoUrbPdoFilter+0x9b (FPO: [3,0,4])
8875f844 8c60ce81 8561f030 84698230 8561f030 usbhub!UsbhPdoInternalDeviceControl+0xf6 (FPO: [2,1,4])
8875f858 81c58976 8561f030 846980e8 ffef3ff7 usbhub!UsbhGenDispatch+0x4a (FPO: [2,0,4])
8875f870 8228d6c2 ffef3ff7 8875f890 8229407a nt!IofCallDriver+0x63
8875f87c 8229407a 86da5020 846980e8 84698230 acpi!ACPIDispatchForwardIrp+0x2a (FPO: [2,0,4])
8875f890 8228df02 86da5020 846980e8 846980e8 acpi!ACPIIrpDispatchDeviceControl+0xa4 (FPO: [2,0,4])
8875f8c0 81c58976 86da5020 83a4b008 86dadcb8 acpi!ACPIDispatchIrp+0x19a (FPO: [2,5,4])
8875f8d8 8ccaa556 846980e8 86dadcb8 846980e8 nt!IofCallDriver+0x63
8875f8ec 8cca6fad 86dadcb8 86da5020 846980e8 usbccgp!UsbcForwardIrp+0x4c (FPO: [6,0,4])
8875f918 8cca63e2 86dadcb8 846980e8 8875f958 usbccgp!DispatchFdoInternalDeviceControl+0x77 (FPO: [2,0,4])
8875f928 8cca6675 86dadcb0 846980e8 846d55b8 usbccgp!USBC_InternalDeviceControl+0x1a (FPO: [2,0,0])
8875f958 81c58976 86dadbf8 016980e8 8875f9d0 usbccgp!USBC_Dispatch+0x1d5 (FPO: [2,5,4])
8875f970 8221049c 8875fa80 846d55b8 8875fab8 nt!IofCallDriver+0x63
8875f9b4 822194d4 0175f9d0 8875fa70 00000000 Wdf01000!FxIoTarget::SubmitSync+0x198 (FPO: [3,12,4])
8875fab8 82219c71 00000000 849b15b0 8875fcf0 Wdf01000!FxUsbDevice::SelectConfig+0x372 (FPO: [3,56,0])
8875fbfc 822144e0 00000000 8875fce0 846b3008 Wdf01000!FxUsbDevice::SelectConfigMulti+0x29a (FPO: [2,73,4])
8875fc28 983a83ad 8464ecf8 00000000 00000000 Wdf01000!imp_WdfUsbTargetDeviceSelectConfig+0x30a (FPO: [4,4,4])
8875fc40 983ae997 7b92aa40 00000000 8875fce0 USBTransport1!WdfUsbTargetDeviceSelectConfig+0x1d (FPO: [Non-Fpo]) (CONV: stdcall) [d:\winddk\7600.16385.0\inc\wdf\kmdf\1.9\wdfusb.h @ 1170]
8875fcf4 983cc6ad 8757e030 846b3008 a29ed850 USBTransport1!StartDevice+0x517 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\at91\driver\usbtransport1\adapter.cpp @ 521]
8875fd1c 983cc64a 00000000 00000000 8757e030 portcls!PnpStartDevice+0x4f (FPO: [2,2,4])
8875fd30 81e21865 8757e030 aa040db0 83aa0828 portcls!EnqueuedIoWorkItemCallback+0x20 (FPO: [2,0,4])
8875fd44 81cb9e22 846689a8 00000000 83aa0828 nt!IopProcessWorkItem+0x23
8875fd7c 81de9c42 846689a8 431bb4dc 00000000 nt!ExpWorkerThread+0xfd

The same stack trace is shown even if I let the target run a little more and debug break it again.
One thing I am curious about is that I am using Wdf01009, so I don’t know why Wdf01000 shows up in the trace.

Now here is the interesting part: After I reboot the machine, and plug inmy USB device again, my driver loads normally and WdfUsbTargetDeviceSelectConfig() does not hang. I double checked to make sure that my latest driver is loaded etc. Normally, my device gets detected as a Generic USB Audio device and they I “update” the driver to my driver using the MMC device manager, and that is when the hang and error happens. BUT, when my driver gets loaded without having previously loaded the generic USB audio driver, things work!

Is it possible that the USBAudio.sys is not cleaning up properly? I do not have problems with the generic usb audio driver by itself. I can plug the device in as many times as I want and everything works perfectly…

Any ideas what this means?

Thanks

Philip

xxxxx@cox.net wrote:

Here is my INF. adding or removing the usb.inf references does not seem to make a difference.

I’m not surprised in the least. Notice:

;===========================================================================
; USB Plug and Play Devices
;===========================================================================

[DeviceList]
%USBT_Simple.DeviceDesc%=MicrosoftDS,USB\VID_5555&PID_5013&MI_00

You have YOUR devices in a section called [DeviceList], but you don’t
refer to that section anywhere. Therefore, this section is NOT BEING
USED. Your device is still being recognized by whatever older INFs you
might have hanging around.

[Manufacturer]
%MfgName%=MicrosoftDS,NTAMD64,NTIA64

THIS is the section that points to the real list of devices –
[MicrosoftDS] in this case…

[MicrosoftDS]
%USBT_Simple.DeviceDesc%=USBT_Simple,*USBT

…and the [MicrosoftDS] section doesn’t include your VID/PID.

Change the section name in the first/only line in your [Manufacturer]
section to refer to DeviceList instead, and then you should make some
progress.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@cox.net wrote:

The same stack trace is shown even if I let the target run a little more and debug break it again.
One thing I am curious about is that I am using Wdf01009, so I don’t know why Wdf01000 shows up in the trace.

The name of the driver for all WDF 1.x versions is wdf01000.sys. Only
the co-installer contains the sub-version number.

Now here is the interesting part: After I reboot the machine, and plug inmy USB device again, my driver loads normally and WdfUsbTargetDeviceSelectConfig() does not hang. I double checked to make sure that my latest driver is loaded etc. Normally, my device gets detected as a Generic USB Audio device and they I “update” the driver to my driver using the MMC device manager, and that is when the hang and error happens. BUT, when my driver gets loaded without having previously loaded the generic USB audio driver, things work!

Is it possible that the USBAudio.sys is not cleaning up properly? I do not have problems with the generic usb audio driver by itself. I can plug the device in as many times as I want and everything works perfectly…

Any ideas what this means?

As I said in the last message (which you haven’t seen yet), your INF
file is not matching what you think it is. Thus, you are still being
loaded from some older – and probably invalid – INF. For example, if
you had an INF that matched your VID/PID without the interface numbers,
I might expect the kind of weirdness you are seeing.

You need to go in and clean out all of your old INF files and start over
with a clean INF. If you can restore from an old snapshot, that might
be even better.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks Tim.

I used ChkInf to clean up my INF. Before, when installing my driver, I was getting an extra warning before the “unsigned driver” warning saying that windows cannot verify that this is the correct driver etc. Now that warning is gone (since Vista can match my driver with the device).

I also went in and removed every reference to my device in windows\inf and system32\DriverStore.

However, when I “update driver software” from the devices mmc (after installing usbaudio.sys driver), I still get the hang as before. And, rebooting the machine and letting my driver load without having previously loaded USBAudio.sys still gets rid of the hang. And, unfortunately, WDF is still giving me all 3 interfaces, including the HID interface. So, nothing except for the warning message when installing the driver has changed…

Here is my new INF. Perhaps there is something else wrong?

Thanks,
Philip

;-------------------------------------------------------------------------
; MyDevice.inf – USB Audio Driver
;
; Copyright (c) MyCompany. All rights reserved.
;-------------------------------------------------------------------------
[Version]
Signature=“$CHICAGO$”
Class=MEDIA
Provider=%MSFT%
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
DriverVer=08/31/2009,6.1.7600.16385
CatalogFile=MyDevice.cat

;===========================================================================
; USB Plug and Play Devices
;===========================================================================

[SourceDisksNames]
222=%DISK%,“”,222

[SourceDisksFiles]
MyDevice.sys=222
wdfcoinstaller01009_chk.dll=222

[Manufacturer]
%MfgName%=DeviceList

[DeviceList]
%USBT1.DeviceDesc%=USBT1,USB\VID_5555&PID_5021&MI_00

[DestinationDirs]
USBT1.CopyList=10,system32\drivers

[USBT1.CopyList]
MyDevice.sys

[USBT1.AddReg]
HKR,AssociatedFilters,“wdmaud,swmidi,redbook”
HKR,Driver,MyDevice.sys
HKR,Drivers,SubClasses,“wave,midi,mixer”
HKR,Drivers\wave\wdmaud.drv,Driver,wdmaud.drv
HKR,Drivers\midi\wdmaud.drv,Driver,wdmaud.drv
HKR,Drivers\mixer\wdmaud.drv,Driver,wdmaud.drv
HKR,Drivers\wave\wdmaud.drv,Description,%USBT1.DeviceDesc%
HKR,Drivers\midi\wdmaud.drv,Description,%USBT_MIDI%
HKR,Drivers\mixer\wdmaud.drv,Description,%USBT1.DeviceDesc%
HKLM,%MediaCategories%%Simple.NameGuid%,Name,%Simple.Name%

;======================================================
; USBT1. usb.inf and Composite.Dev may not be needed since we have proper IAD
;======================================================
[USBT1.NT]
Include=ks.inf,wdmaudio.inf
Needs=KS.Registration, WDMAUDIO.Registration
CopyFiles=USBT1.CopyList
AddReg=USBT1.AddReg

[USBT.I.Wave]
AddReg=USBT.I.Wave.AddReg
[USBT.I.Wave.AddReg]
HKR,CLSID,%Proxy.CLSID%
HKR,FriendlyName,%USBT.Wave.szPname%

[USBT.I.Topo]
AddReg=USBT.I.Topo.AddReg
[USBT.I.Topo.AddReg]
HKR,CLSID,%Proxy.CLSID%
HKR,FriendlyName,%USBT.Topo.szPname%

[USBT1.NT.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_RENDER%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_CAPTURE%,%KSNAME_Wave%,USBT.I.Wave
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Topology%,USBT.I.Topo

[USBT1.NT.Services]
AddService=MyDevice,0x00000002,USBTransport1_Service_Inst

[USBTransport1_Service_Inst]
DisplayName=%MyDevice.SvcDesc%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%10%\system32\drivers\MyDevice.sys

;-------------- WDF Coinstaller installation

[DestinationDirs]
CoInstaller_CopyFiles = 11

[USBT1.NT.CoInstallers]
AddReg=CoInstaller_AddReg
CopyFiles=CoInstaller_CopyFiles

[CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “wdfcoinstaller01009_chk.dll,WdfCoInstaller”

[CoInstaller_CopyFiles]
wdfcoinstaller01009_chk.dll

[USBT1.NT.Wdf]
KmdfService = MyDevice, USBT_wdfsect

[USBT_wdfsect]
KmdfLibraryVersion = 1.9

;---------------------------------------------------------------;

[Strings]
MSFT=“MyCompany”
MfgName=“MyCompany”
USBT1.DeviceDesc=“MyDevice”
USBT.Wave.szPname=“USBT Wave”
USBT.Topo.szPname=“USBT Topology”
USBT_MIDI=“USBT -> WDM Midi Device”
DISK=“MyDevice Driver Disk”

Proxy.CLSID=“{17CCA71B-ECD7-11D0-B908-00A0C9223196}”
KSCATEGORY_AUDIO=“{6994AD04-93EF-11D0-A3CC-00A0C9223196}”
KSCATEGORY_RENDER=“{65E8773E-8F56-11D0-A3B9-00A0C9223196}”
KSCATEGORY_CAPTURE=“{65E8773D-8F56-11D0-A3B9-00A0C9223196}”

KSNAME_Wave=“Wave”
KSNAME_Topology=“Topology”

MyDevice.SvcDesc=“MyCompany MyDevice”

MediaCategories=“SYSTEM\CurrentControlSet\Control\MediaCategories”

Simple.NameGuid=“{946A7B1A-EBBC-422a-A81F-F07C8D40D3B4}”
Simple.Name=“USBT”

xxxxx@cox.net wrote:

I used ChkInf to clean up my INF. Before, when installing my driver, I was getting an extra warning before the “unsigned driver” warning saying that windows cannot verify that this is the correct driver etc. Now that warning is gone (since Vista can match my driver with the device).

So, you are running the checked build of Vista?

I also went in and removed every reference to my device in windows\inf and system32\DriverStore.

However, when I “update driver software” from the devices mmc (after installing usbaudio.sys driver), I still get the hang as before. And, rebooting the machine and letting my driver load without having previously loaded USBAudio.sys still gets rid of the hang. And, unfortunately, WDF is still giving me all 3 interfaces, including the HID interface. So, nothing except for the warning message when installing the driver has changed…

You wrote a kernel streaming driver in KMDF? Interesting. Most of what
KMDF provides is already being provided by Port class. And since the
KMDF continuous reader doesn’t support isochronous pipes, you will still
be doing your own URBs and IRPs. Did you set the NoDispatchOverride
flag, and call WdfDeviceMiniportCreate?

I don’t see anything else in the INF. With the &MI_00 in there, and
given your IAD, the configuration descriptor handed to your driver
should only include interfaces 0 and 1, just like what usbaudio.sys was
handed when it controlled your device.

Are you using windbg? If you use !devstack on your device object, do
you see usbccgp in the stack?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I am running the retail build of vista.

I used the msvad example to create a WDM portcls based driver. Now I want
to use WDF USB functionality in it because it provides some nice
abstractions. I did use NoDispatchOverride and call
WdfDeviceMiniportCreate.

!devstack yield the following:

0: kd> !devstack 0x86f04d78
!DevObj !DrvObj !DevExt ObjectName

86f04d78 \Driver\MyDevice86f04e30 00000071
86ea8988 \Driver\usbccgp 86ea8a40 0000006f
!DevNode 84178378 :
DeviceInst is “USB\VID_5555&PID_5021&MI_00\6&389cb1ef&0&0000”
ServiceName is “MyDevice”

I hope that sheds some light…

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, August 31, 2009 8:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of
a composite device to use?

xxxxx@cox.net wrote:

I used ChkInf to clean up my INF. Before, when installing my driver, I
was getting an extra warning before the “unsigned driver” warning saying
that windows cannot verify that this is the correct driver etc. Now that
warning is gone (since Vista can match my driver with the device).

So, you are running the checked build of Vista?

I also went in and removed every reference to my device in windows\inf and
system32\DriverStore.

However, when I “update driver software” from the devices mmc (after
installing usbaudio.sys driver), I still get the hang as before. And,
rebooting the machine and letting my driver load without having previously
loaded USBAudio.sys still gets rid of the hang. And, unfortunately, WDF is
still giving me all 3 interfaces, including the HID interface. So, nothing
except for the warning message when installing the driver has changed…

You wrote a kernel streaming driver in KMDF? Interesting. Most of what
KMDF provides is already being provided by Port class. And since the
KMDF continuous reader doesn’t support isochronous pipes, you will still
be doing your own URBs and IRPs. Did you set the NoDispatchOverride
flag, and call WdfDeviceMiniportCreate?

I don’t see anything else in the INF. With the &MI_00 in there, and
given your IAD, the configuration descriptor handed to your driver
should only include interfaces 0 and 1, just like what usbaudio.sys was
handed when it controlled your device.

Are you using windbg? If you use !devstack on your device object, do
you see usbccgp in the stack?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

In case it’s of relevance, AddDevice does the following:

// Tell the class driver to add the device.
ntStatus = PcAddAdapterDevice(DriverObject, PhysicalDeviceObject,
PCPFNSTARTDEVICE(USBTStartDevice), MAX_MINIPORTS, 128 + MY_EXTENSION_SIZE +
PORT_CLASS_DEVICE_EXTENSION_SIZE);

if (!NT_SUCCESS (ntStatus))
{
usbtDebugPrint((DBGERROR, “PcAddAdapterDevice failed
(0x%x)\n”, ntStatus));
return ntStatus;
}

FunctionalDeviceObject = IoGetAttachedDevice(PhysicalDeviceObject);

GetMyExtension()->WdfDriver = WdfGetDriver();
GetMyExtension()->WdfDevice = 0;
GetMyExtension()->UsbDevice = 0;

WDF_OBJECT_ATTRIBUTES attributes;
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
WDF_DEVICE_INFO);
ntStatus = WdfDeviceMiniportCreate(GetMyExtension()->WdfDriver,
&attributes,
FunctionalDeviceObject,
PhysicalDeviceObject->NextDevice,
PhysicalDeviceObject,
&(GetMyExtension()->WdfDevice));

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, August 31, 2009 8:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to tell WdfUsbTargetDeviceCreate which interface of
a composite device to use?

xxxxx@cox.net wrote:

I used ChkInf to clean up my INF. Before, when installing my driver, I
was getting an extra warning before the “unsigned driver” warning saying
that windows cannot verify that this is the correct driver etc. Now that
warning is gone (since Vista can match my driver with the device).

So, you are running the checked build of Vista?

I also went in and removed every reference to my device in windows\inf and
system32\DriverStore.

However, when I “update driver software” from the devices mmc (after
installing usbaudio.sys driver), I still get the hang as before. And,
rebooting the machine and letting my driver load without having previously
loaded USBAudio.sys still gets rid of the hang. And, unfortunately, WDF is
still giving me all 3 interfaces, including the HID interface. So, nothing
except for the warning message when installing the driver has changed…

You wrote a kernel streaming driver in KMDF? Interesting. Most of what
KMDF provides is already being provided by Port class. And since the
KMDF continuous reader doesn’t support isochronous pipes, you will still
be doing your own URBs and IRPs. Did you set the NoDispatchOverride
flag, and call WdfDeviceMiniportCreate?

I don’t see anything else in the INF. With the &MI_00 in there, and
given your IAD, the configuration descriptor handed to your driver
should only include interfaces 0 and 1, just like what usbaudio.sys was
handed when it controlled your device.

Are you using windbg? If you use !devstack on your device object, do
you see usbccgp in the stack?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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