Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Hello,
I am working on a driver for a virtual USB device and virtual host controller. The sample that I am using contains a simple Configuration Descriptor that defines a single interface and a few endpoints.
That configuration descriptor works fine.
I have attempted to replace that working descriptor with a HID Configuration Descriptor that I found in Jan Axelson’s book “USB Complete”.
The WinDbg log shows that things are fine until WdfUsbTargetDeviceSelectConfig executes in the host controller. It returns STATUS_INSUFFICIENT_RESOURCES each time.
I know that the descriptor is fine because USBD_ValidateConfigurationDescriptor shows no errors.
Below I have included the configuration and HID report descriptor for reference.
Do you have any suggestions?
const UCHAR g_UsbConfigDescriptorSet[0x29] =
{
// Configuration
0x09,
0x02,
0x29, 0x00,
0x01,
0x01,
0x00,
0xa0,
0x32,
// Interface
0x09,
0x04,
0x00,
0x00,
0x02,
0x03,
0x00,
0x00,
0x00,
// HID Class Descriptor
0x09,
0x21,
0x10, 0x01,
0x00,
0x01,
0x22,
0x2f, 0x00,
// Interrupt IN EP
0x07,
0x05,
0x81,
0x03,
0x40, 0x00,
0x0a,
// Interrupt OUT EP
0x07,
0x05,
0x01,
0x03,
0x40, 0x00,
0x0a,
}
The HID report descriptor is:
const UCHAR CrestronDspHidReportDescriptor[0x2f] =
{
0x06, 0xa0, 0xff,
0x09, 0x01,
0xa1, 0x01,
0x09, 0x03,
0x15, 0x00,
0x26, 0xff, 0x00,
0x75, 0x08,
0x95, 0x02,
0x81, 0x02,
0x09, 0x04,
0x15, 0x00,
0x26, 0xff, 0x00,
0x75, 0x08,
0x95, 0x02,
0x91, 0x02,
0x09, 0x05,
0x15, 0x00,
0x26, 0xff, 0x00,
0x75, 0x08,
0x95, 0x02,
0xb1, 0x02,
0xc0
};
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Kernel Debugging | 13-17 May 2024 | Live, Online |
Developing Minifilters | 1-5 Apr 2024 | Live, Online |
Internals & Software Drivers | 11-15 Mar 2024 | Live, Online |
Writing WDF Drivers | 26 Feb - 1 Mar 2024 | Live, Online |
Comments
It was unkind of you to expect us to decode your descriptors. As a help to others, allow me to post the decoded descriptor:
What is the USB version in your device descriptor? At what speed does it enumerate? STATUS_INSUFFICIENT_RESOURCES implies that there isn't enough bandwidth left on the bus to make this reservation.
And as a side note, USBD_ValidateConfigurationDescriptor only validate that there are no structural errors in your descriptor. It doesn't check that the descriptor makes sense.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Thanks for the reply.
Sorry, I didn't expect you to debug my descriptor. It was simply for reference to emphasize that the descriptor ISN'T the problem.
The device descriptor specifies a USB 2.0 device:
const UCHAR g_UsbDeviceDescriptor[18] =
{
0x12, // Descriptor size
USB_DEVICE_DESCRIPTOR_TYPE, // Device descriptor type
0x00, 0x02, // USB 2.0
0x00, // Device class (interface-class defined)
0x00, // Device subclass
0x00, // Device protocol
0x40, // Maxpacket size for EP0
UDEFX2_DEVICE_VENDOR_ID, // Vendor ID
UDEFX2_DEVICE_PROD_ID, // Product ID
0x00, // LSB of firmware revision
0x01, // MSB of firmware revision
0x01, // Manufacture string index
0x02, // Product string index
0x00, // Serial number string index
0x01 // Number of configurations
};
Not sure by what you mean by "what speed it enumerates at".
The device capability callback shows a capability type of GUID_USB_CAPABILITY_HIGH_BANDWIDTH_ISOCH.
I was expecting GUID_USB_CAPABILITY_DEVICE_CONNECTION_HIGH_SPEED_COMPATIBLE.
A USB 2.0 device that enumerates at high speed has different requirements and different descriptor meanings from a USB 2.0 device that enumerates at full speed.
Does your device appear in Device Manager?
The SelectConfig call is not actually required, since you only have one configuration. Does it work without it? Or is that coming from a driver you don't control.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Hello,
The device appears in Device Manager (along with that yellow yield symbol).
Removing the WdfUsbTargetDeviceSelectConfig enabled the code to advance beyond that issue.
However, the result is the same (yellow yield symbol).
I was able to retrieve all device endpoint info from the controller.
So the controller does recognize the device attached to it.
Eventually, I will need to add additional configurations.
At this point, I would be happy to get this single configuration to work.