WdfUsbTargetDeviceSelectConfig exists b/c you have to select *a* config
in a USB driver. SelectConfig will by default select Setting #0 on each
interface. You can customize this default behavior and specify
different Alt Settings on each interface if you like.
I will fwd the feedback on the docs to our doc writer.
You can still write a KMDF based driver and roll your own USB I/O. This
way you still can take advantage of pnp, power, and power policy
(including selective suspend). The burden on you is to now track all
sent i/o and coordinate its cancellation/wait for completion during
power transitions. In fact you can still use KMDF for that. Just
create & open a generic WDFIOTARGET for each USB pipe you have, allocate
your own PURB and then format the WDFREQUEST with
WdfIoTargetFormatRequestForInternalIoctlOthers(). Essentially you lose
the automatic WDFUSBPIPE creation/deletion on select config/interface
and the ability to call USB specific formatting functions, but you can
still leverage KMDF for all the hard stuff.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Whitman, Steve
Sent: Monday, February 20, 2006 10:19 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How do you select a configuration using
WdfUsbTargetDeviceSelectConfig()
Unfortunately the device that I’m using has multiple configurations. I
can’t use the first configuration because that is used by the device to
perform certain functions that I don’t require. I also can’t change the
firmware of the device.
If KMDF only supports a single configuration then it sounds like I won’t
be able to use it for this device.
Can you explain why if KMDF doesn’t support multiple configurations why
there is a WdfUsbTargetDeviceSelectConfig() function in the first place?
Is this for future support of multiple configurations?
Also the documentation should be clarified on this matter. There are
many locations in the documentation where statements are made that imply
that other configurations can be used. For example the documentation
for WDF_USB_DEVICE_SELECT_CONFIG_PARAMS states:
Types.Descriptor.ConfigurationDescriptor
If the driver sets the Type member to
WdfUsbTargetDeviceSelectConfigTypeInterfacesDescriptor, this
member
contains a driver-supplied pointer to a
USB_CONFIGURATION_DESCRIPTOR
structure that specifies a configuration descriptor. If this
pointer
is NULL, the framework uses the device’s first configuration.
This implies that if the pointer is not NULL then another configuration
can be used.
In the “Working with USB Devices” chapter there is a subsection titled
“Selecting a Device Configuration” which also implies that I can select
a different configuration when the EvtDevicePrepareHardware callback is
made.
Just to be clear, you are saying that if I need to use a different
configuration other than the first configuration then I can’t use a KMDF
based driver.
Regards,
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-240574-
xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, February 20, 2006 12:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How do you select a configuration using
WdfUsbTargetDeviceSelectConfig()
Windows inbox client drivers support one config, the core doesn’t
really
care and you can do multiple configs in your own driver. I personally
don’t understand why you would need multiple configurations (outside
of
differing power requirements, but you can detect that in the single
configuration and adjust appropriately) in the first place, you can do
the same thing with multiple interface settings on the same config.
KMDF only supports a single configuration. When the docs talk about
specifying descriptors or a URB, it is assumed that they are from the
first config. Internally when you create a WDFUSBDEVICE, KMDF will
create a WDFUSBINTERFACE for each interface on the (first) config.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Whitman, Steve
Sent: Monday, February 20, 2006 9:31 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How do you select a configuration using
WdfUsbTargetDeviceSelectConfig()
If Windows only supports devices with one configuration then how have
I
been using a device that has two configurations for the past two
years?
The devices’ first configuration only has a control endpoint and the
second configuration has two bulk endpoints and an interrupt endpoint.
Here is the Device Descriptor and the second Configuration Descriptor
which I retrieved from a USB analyzer trace using an existing driver.
bLength 0x12
bDescriptorType 0x01
bcdUSB 0x0110
bDeviceClass 0xff
bDeviceSubClass 0x00
bDeviceProtocol 0x00
bMaxPacketSize0 0x08
idVendor 0xXXXX
idProduct 0xXXXX
iManufacturer 0x01
iProduct 0x02
iSerialNumber 0x03
bNumConfigurations 0x02
The second configuration is:
bLength 0x09
bDescriptorType 0x02
wTotalLength 0x0027
bNumInterfaces 0x01
bConfigurationValue 0x02
iConfiguration 0x00
bmAttributes 0xc0
bMaxPower 0x00
Also the documentation for WdfUsbTargetDeviceSelectConfig() states:
Your driver can select a device configuration by using a
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS structure to specify USB
descriptors,
a URB, or handles to framework USB interface objects.
To me this certainly implies that I can select configurations other
can
the first.
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:bounce-240566-
> xxxxx@lists.osr.com] On Behalf Of Doron Holan
> Sent: Monday, February 20, 2006 11:37 AM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] How do you select a configuration using
> WdfUsbTargetDeviceSelectConfig()
>
>
> Windows only supports devices which have *one* configuration. That
> configuration can have multiple *interfaces* though. To select
among
> different interfaces, you perform the initial select config (which
> defaults to Setting 0 unless you override) and then a
> WdfUsbInterfaceSelectSetting on the WDFUSBINTERFACEs that you want
to
> change.
>
> Yes, the end point descriptors must come after the interface
descriptor.
> Your descriptor set must be well formed, although during a select
> config, KMDF uses the config descriptor reported by the device.
>
> D
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Whitman,
Steve
> Sent: Monday, February 20, 2006 6:35 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How do you select a configuration using
> WdfUsbTargetDeviceSelectConfig()
>
> I’m trying to select another USB configuration using
> WdfUsbTargetDeviceSelectConfig. I’ve been successful at selecting
the
> first configuration and managed to get the 2nd configuration but my
> solution doesn’t seem right.
>
> Here is what I did to select a configuration. I used
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_INTERFACES_DESCRIPTORS() to
> build a WDF_USB_DEVICE_SELECT_CONFIG_PARAMS object and then I call
> WdfUsbTargetDeviceSelectConfig() to select the configuration.
>
> The trouble I had was that my first couple of implementations at
doing
> this failed. On my first attempt I created
USB_CONFIGURATION_DESCRIPTOR
> and USB_INTERFACE_DESCRIPTOR objects on the stack and then used
those
> objects to create the WDF_USB_DEVICE_SELECT_CONFIG_PARAMS object by
> calling
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_INTERFACES_DESCRIPTORS().
I
> found that if I set wTotalLength of the configuration descriptor to
39
> (the size of my configuration, interface and 3 endpoints) then the
call
> to WdfUsbTargetDeviceSelectConfig() failed with a status of
0xC0000001
> (STATUS_UNSUCCESSFUL). I then tried changing wTotalLength to 18 and
> this worked but when I called WdfUsbInterfaceGetNumConfiguredPipes()
it
> returned 0 which was not correct.
> I then changed my code so that the structures were allocated from
the
> PagedPool and I allocated enough space for the 3 endpoints in
addition
> to the configuration and interface descriptors. This worked and
> WdfUsbInterfaceGetNumConfiguredPipes() returned 3 as expected.
However
> when I called WdfUsbInterfaceGetConfiguredPipe() the pipe
information
> returned was clearly wrong. Finally I initialized the 3
> USB_ENDPOINT_DESCRIPTORS after the USB_INTERFACE_DESCRIPTORS and
this
> seems to work. The function prototype and documentation for
> WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_INTERFACES_DESCRIPTORS()
> doesn’t make any mention that the interface descriptor need to have
> correctly initialized endpoint descriptors allocated after them but
> without doing this I was unable to select the endpoints.
>
> My questions are:
> 1. Is this the correct way to select a different USB configuration
or
am
> I missing something?
> 2. If this is the correct method then when is it safe to free the
memory
> that I allocated to create the descriptors? Do I have to hold this
> memory until the device is removed or another configuration is
selected?
>
> Thanks,
> - Steve -
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
argument:
> ‘’
> To unsubscribe send a blank email to
xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag
argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com