Jump-start your project by learning from devs who
write Windows drivers and file systems every day.
Take an OSR seminar!

OSR is Hiring! Click here to find out more.

Upcoming OSR Seminars:
Kernel Debugging & Crash Analysis for Windows Lab, Santa Clara, CA 9-13 September, 2013
Upcoming OSR Seminars:
Windows Internals & Software Drivers Lab, Santa Clara, CA 16-20 September, 2013
Writing WDF Drivers for Windows Lab, Boston/Waltham, MA 7-11 October, 2013
Developing File Systems for Windows, Seattle, WA 5-8 November, 2013


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 9  
02 Dec 07 10:28
ntdev member 14258
xxxxxx@jungo.com
Join Date:
Posts To This List: 62
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
  Message 2 of 9  
02 Dec 07 12:03
Doron Holan
xxxxxx@microsoft.com
Join Date: 08 Sep 2005
Posts To This List: 8350
RE: possible causes for WdfUsbTargetDeviceCreate failures

Another failure is a mismatch between the number of ep in an interface and the number of actual ep descriptors. !wdflogdump <your driver name> 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
  Message 3 of 9  
02 Dec 07 22:24
Chris Aseltine
xxxxxx@gmail.com
Join Date: 23 Sep 2006
Posts To This List: 1049
RE: possible causes for WdfUsbTargetDeviceCreate failures

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...
  Message 4 of 9  
03 Dec 07 04:31
ntdev member 14258
xxxxxx@jungo.com
Join Date:
Posts To This List: 62
Re: 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 <your driver name> 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 > <...excess quoted lines suppressed...>
  Message 5 of 9  
03 Dec 07 04:35
ntdev member 14258
xxxxxx@jungo.com
Join Date:
Posts To This List: 62
Re: possible causes for WdfUsbTargetDeviceCreate failures

(OSR Online does not support single-part messages with Content-Type: text/html)
  Message 6 of 9  
03 Dec 07 04:45
ntdev member 14258
xxxxxx@jungo.com
Join Date:
Posts To This List: 62
RE: possible causes for WdfUsbTargetDeviceCreate failures

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 <your driver name> ?
  Message 7 of 9  
03 Dec 07 10:17
Chris Aseltine
xxxxxx@gmail.com
Join Date: 23 Sep 2006
Posts To This List: 1049
RE: possible causes for WdfUsbTargetDeviceCreate failures

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...
  Message 8 of 9  
03 Dec 07 10:34
ntdev member 31002
xxxxxx@microsoft.com
Join Date:
Posts To This List: 539
RE: possible causes for WdfUsbTargetDeviceCreate failures

>> Is there a way to get verbose KMDF debug prints online ? I mean without breaking into debugger followed by !wdflogdump <your driver name> ? << 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.
  Message 9 of 9  
03 Dec 07 13:43
Doron Holan
xxxxxx@microsoft.com
Join Date: 08 Sep 2005
Posts To This List: 8350
RE: possible causes for WdfUsbTargetDeviceCreate failures

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 <your driver name> 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 > <...excess quoted lines suppressed...> --- 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
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 08:36.


Copyright ©2012, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license