I have been working through the osrusbfx2 sample driver and have run
into a problem on step4. I am not using the osrusbfx2 hardware, but
am using my own hardware with one bulk IN and one bulk OUT endpoint
that I believe should be emulating the same interface. I recognize
this may be causing the problem, but the area the problem is occurring
doesn’t seem to be hardware dependent, just endpoint dependent.
Here’s the code that I am seeing an issue with:
In the function EvtDevicePrepareHardware():
…
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&configParams);
status = WdfUsbTargetDeviceSelectConfig(pDeviceContext->UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES,
&configParams);
if(!NT_SUCCESS(status)) {
KdPrint((“WdfUsbTargetDeviceSelectConfig failed 0x%x\n”, status));
return status;
}
pDeviceContext->UsbInterface =
configParams.Types.SingleInterface.ConfiguredUsbInterface;
pDeviceContext->BulkReadPipe = WdfUsbInterfaceGetConfiguredPipe(
pDeviceContext->UsbInterface,
BULK_IN_ENDPOINT_INDEX,
NULL);// pipeInfo
WdfUsbTargetPipeSetNoMaximumPacketSizeCheck(pDeviceContext->BulkReadPipe);
…
The problem is the WdfUsbInterfaceGetConfiguredPipe() function returns
a NULL pointer. In WinDbg the parameter pDeviceContext->UsbInterface
has a memory address, but when I use the Watch window to see the
contents of the struct it shows “”. The WDK
documentation indicates that you can call
WdfUsbTargetDeviceSelectConfig() to get the USB Interface so I can’t
see why that config parameter should be invalid memory.
Does anybody know of any issues with step 4 of this sample driver?
Thanks!
Jeremy
You are getting a wdf handle back, it is not a pointer you can access directly. Run
!wdfkd,wdfusbinterface (usb interface handle value)
And you should see the list of configured pipes.
d
Sent from my phone with no t9, all spilling mistakes are not intentional.
-----Original Message-----
From: Jeremy Ramer
Sent: Monday, February 16, 2009 3:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] osrusbfx2 step4 problem
I have been working through the osrusbfx2 sample driver and have run
into a problem on step4. I am not using the osrusbfx2 hardware, but
am using my own hardware with one bulk IN and one bulk OUT endpoint
that I believe should be emulating the same interface. I recognize
this may be causing the problem, but the area the problem is occurring
doesn’t seem to be hardware dependent, just endpoint dependent.
Here’s the code that I am seeing an issue with:
In the function EvtDevicePrepareHardware():
…
WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&configParams);
status = WdfUsbTargetDeviceSelectConfig(pDeviceContext->UsbDevice,
WDF_NO_OBJECT_ATTRIBUTES,
&configParams);
if(!NT_SUCCESS(status)) {
KdPrint((“WdfUsbTargetDeviceSelectConfig failed 0x%x\n”, status));
return status;
}
pDeviceContext->UsbInterface =
configParams.Types.SingleInterface.ConfiguredUsbInterface;
pDeviceContext->BulkReadPipe = WdfUsbInterfaceGetConfiguredPipe(
pDeviceContext->UsbInterface,
BULK_IN_ENDPOINT_INDEX,
NULL);// pipeInfo
WdfUsbTargetPipeSetNoMaximumPacketSizeCheck(pDeviceContext->BulkReadPipe);
…
The problem is the WdfUsbInterfaceGetConfiguredPipe() function returns
a NULL pointer. In WinDbg the parameter pDeviceContext->UsbInterface
has a memory address, but when I use the Watch window to see the
contents of the struct it shows “”. The WDK
documentation indicates that you can call
WdfUsbTargetDeviceSelectConfig() to get the USB Interface so I can’t
see why that config parameter should be invalid memory.
Does anybody know of any issues with step 4 of this sample driver?
Thanks!
Jeremy
—
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
Jeremy Ramer wrote:
I have been working through the osrusbfx2 sample driver and have run
into a problem on step4. I am not using the osrusbfx2 hardware, but
am using my own hardware with one bulk IN and one bulk OUT endpoint
that I believe should be emulating the same interface.
…
pDeviceContext->BulkReadPipe = WdfUsbInterfaceGetConfiguredPipe(
pDeviceContext->UsbInterface,
BULK_IN_ENDPOINT_INDEX,
NULL);// pipeInfo
…
The problem is the WdfUsbInterfaceGetConfiguredPipe() function returns
a NULL pointer.
Remember that BULK_IN_ENDPOINT_INDEX is, as it says, an index. It is
NOT the endpoint number. If your bulk IN endpoint is the first one in
the descriptors, you need to specify 0. If it is the second one, you
need to specify 1. This is a common mistake at this point.
Why don’t you post your descriptors? We can critique those as well.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
On Mon, Feb 16, 2009 at 6:49 PM, Tim Roberts wrote:
> Jeremy Ramer wrote:
>> I have been working through the osrusbfx2 sample driver and have run
>> into a problem on step4. I am not using the osrusbfx2 hardware, but
>> am using my own hardware with one bulk IN and one bulk OUT endpoint
>> that I believe should be emulating the same interface.
>> …
>> pDeviceContext->BulkReadPipe = WdfUsbInterfaceGetConfiguredPipe(
>> pDeviceContext->UsbInterface,
>> BULK_IN_ENDPOINT_INDEX,
>> NULL);// pipeInfo
>> …
>>
>>
>> The problem is the WdfUsbInterfaceGetConfiguredPipe() function returns
>> a NULL pointer.
>
> Remember that BULK_IN_ENDPOINT_INDEX is, as it says, an index. It is
> NOT the endpoint number. If your bulk IN endpoint is the first one in
> the descriptors, you need to specify 0. If it is the second one, you
> need to specify 1. This is a common mistake at this point.
Turns out that was the problem exactly. I was using the endpoint
number. In retrospect that should have been pretty obvious. Sorry for
the extraneous mail, but thanks so much for the help!
>
> Why don’t you post your descriptors? We can critique those as well.
>
> –
> 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
>