Hi,
My KMDF fails to init a USB device using WdfUsbTargetDeviceCreate().
The same device works perfect with WDM driver.
After some experiments, I have noticed that WdfUsbTargetDeviceCreate verifies the USB configuration descriptor and eventually fails if the descriptor is wrong in some way.
For instance, if bNumInterfaces does not match the actual number of interface descriptors,
WdfUsbTargetDeviceCreate exits with STATUS_INVALID_PARAMETER.
Q1: what else may cause WdfUsbTargetDeviceCreate to fail ?
Q2: is there a way to get anything more explanatory than just STATUS_INVALID_PARAMETER ?
Thanks,
Alexey
Another failure is a mismatch between the number of ep in an interface and the number of actual ep descriptors. !wdflogdump should tell you about the error, although the logging does need to be a bit more verbose in the error paths.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@jungo.com
Sent: Sunday, December 02, 2007 7:28 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] possible causes for WdfUsbTargetDeviceCreate failures
Hi,
My KMDF fails to init a USB device using WdfUsbTargetDeviceCreate().
The same device works perfect with WDM driver.
After some experiments, I have noticed that WdfUsbTargetDeviceCreate verifies the USB configuration descriptor and eventually fails if the descriptor is wrong in some way.
For instance, if bNumInterfaces does not match the actual number of interface descriptors,
WdfUsbTargetDeviceCreate exits with STATUS_INVALID_PARAMETER.
Q1: what else may cause WdfUsbTargetDeviceCreate to fail ?
Q2: is there a way to get anything more explanatory than just STATUS_INVALID_PARAMETER ?
Thanks,
Alexey
—
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
Alexey Polonsky wrote:
My KMDF fails to init a USB device using WdfUsbTargetDeviceCreate().
The same device works perfect with WDM driver. After some
experiments, I have noticed that WdfUsbTargetDeviceCreate
verifies the USB configuration descriptor and eventually fails
if the descriptor is wrong in some way.
You didn’t explicitly ask this, but if this is a blocking issue for you (i.e. your device is already in the wild and you are converting an existing WDM driver), you can always create a simple lower filter to your KMDF USB function driver that feeds it modified/“proper” responses to the various descriptor URBs…
Apparently, WdfUsbTargetDeviceCreate() does more than just validating
bits of USB descriptors.
The problem is that this is an undocumented black box, that must succeed
in order to get the rest of the USB driver working.
In the analyzer trace I have noticed that GET_STATUS request is missing
the “status” stage (a zero-length OUT).
In my WDM driver, I recover from a failed GET_STATUS request.
Do I have such an option (to recover) in KMDF ?
Can I convince WdfUsbTargetDeviceCreate() to be more permissive ?
Thanks,
Alexey.
Doron Holan wrote:
Another failure is a mismatch between the number of ep in an interface and the number of actual ep descriptors. !wdflogdump should tell you about the error, although the logging does need to be a bit more verbose in the error paths.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@jungo.com
> Sent: Sunday, December 02, 2007 7:28 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] possible causes for WdfUsbTargetDeviceCreate failures
>
> Hi,
>
> My KMDF fails to init a USB device using WdfUsbTargetDeviceCreate().
> The same device works perfect with WDM driver.
>
> After some experiments, I have noticed that WdfUsbTargetDeviceCreate verifies the USB configuration descriptor and eventually fails if the descriptor is wrong in some way.
> For instance, if bNumInterfaces does not match the actual number of interface descriptors,
> WdfUsbTargetDeviceCreate exits with STATUS_INVALID_PARAMETER.
>
> Q1: what else may cause WdfUsbTargetDeviceCreate to fail ?
> Q2: is there a way to get anything more explanatory than just STATUS_INVALID_PARAMETER ?
>
> Thanks,
> Alexey
>
> —
> 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
>
>
>
Yep, you’ve guessed right, it is indeed a blocking issue, the device is
in the wild and the worse part is that the device is someone else’s.
So even getting a USB analyzer trace is a luxury.
Anyway, thanks for the idea. Having a lower filter will indeed solve
the problem.
Though getting it implemented will take some extensive amount of
ping-pong between me and the customer.
xxxxx@gmail.com wrote:
type=“cite”>
Alexey Polonsky wrote:
My KMDF fails to init a USB device using WdfUsbTargetDeviceCreate().
The same device works perfect with WDM driver. After some
experiments, I have noticed that WdfUsbTargetDeviceCreate
verifies the USB configuration descriptor and eventually fails
if the descriptor is wrong in some way.
You didn’t explicitly ask this, but if this is a blocking issue for you (i.e. your device is already in the wild and you are converting an existing WDM driver), you can always create a simple lower filter to your KMDF USB function driver that feeds it modified/“proper” responses to the various descriptor URBs…
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 athttp://www.osronline.com/page.cfm?name=ListServer
Chris, you’ve guessed right, it is indeed a blocking issue, the device is in the wild and the worse part
is that the device is someone else’s. So even getting a USB analyzer trace is a luxury.
Anyway, thanks for the idea. Having a lower filter will indeed solve the problem. Though getting it
implemented will take some extensive amount of ping-pong between me and the customer.
Is there a way to get verbose KMDF debug prints online ? I mean without breaking into debugger followed by !wdflogdump ?
Alexey Polonsky wrote:
Chris, you’ve guessed right, it is indeed a blocking issue, the device is
in the wild and the worse part is that the device is someone else’s.
So even getting a USB analyzer trace is a luxury. Anyway, thanks
for the idea. Having a lower filter will indeed solve the problem.
Though getting it implemented will take some extensive amount
of ping-pong between me and the customer.
I had a similar problem awhile back, so the idea came to mind immediately. That’s too bad that you don’t have the device locally. I would try to set up a remote desktop session to the customer’s machine or something similar, where you can at least try to debug (via print statements, at least) on live hardware, even if the hardware itself is not sitting your desk…
>>
Is there a way to get verbose KMDF debug prints online ? I mean without breaking
into debugger followed by !wdflogdump ?
<<
KMDF uses WPP for these messages. So you can use all the tracing tools in the WDK, as well as the built-in OS support. The CTL GUID for KMDF I’ve posted to this list before (but I haven’t time to look it up again, nor to give detailed instructions on how you pick up the traces). I know people on this list have used the tracing tools before, so some of them might help there.
You can actually get more info with more control over what you get by this route- you are not limited by the kernel-side buffer size limits, built-in logging levels and flags.
The WDF code (intentionally) assumes a well behaving/spec compliant device. by making the rules more lax, KMDF is propagating the development of non spec compliant devices. As chris said, you can write a lower filter to mask these problems quite easily if you want. The filter can be written in KMDF with very little time.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Alexey Polonsky
Sent: Monday, December 03, 2007 1:31 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] possible causes for WdfUsbTargetDeviceCreate failures
Apparently, WdfUsbTargetDeviceCreate() does more than just validating
bits of USB descriptors.
The problem is that this is an undocumented black box, that must succeed
in order to get the rest of the USB driver working.
In the analyzer trace I have noticed that GET_STATUS request is missing
the “status” stage (a zero-length OUT).
In my WDM driver, I recover from a failed GET_STATUS request.
Do I have such an option (to recover) in KMDF ?
Can I convince WdfUsbTargetDeviceCreate() to be more permissive ?
Thanks,
Alexey.
Doron Holan wrote:
Another failure is a mismatch between the number of ep in an interface and the number of actual ep descriptors. !wdflogdump should tell you about the error, although the logging does need to be a bit more verbose in the error paths.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@jungo.com
> Sent: Sunday, December 02, 2007 7:28 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] possible causes for WdfUsbTargetDeviceCreate failures
>
> Hi,
>
> My KMDF fails to init a USB device using WdfUsbTargetDeviceCreate().
> The same device works perfect with WDM driver.
>
> After some experiments, I have noticed that WdfUsbTargetDeviceCreate verifies the USB configuration descriptor and eventually fails if the descriptor is wrong in some way.
> For instance, if bNumInterfaces does not match the actual number of interface descriptors,
> WdfUsbTargetDeviceCreate exits with STATUS_INVALID_PARAMETER.
>
> Q1: what else may cause WdfUsbTargetDeviceCreate to fail ?
> Q2: is there a way to get anything more explanatory than just STATUS_INVALID_PARAMETER ?
>
> Thanks,
> Alexey
>
> —
> 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
>
>
>
—
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