WdfUsbTargetDeviceSelectConfig returns STATUS_INSUFFICIENT_RESOURCES

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
};

It was unkind of you to expect us to decode your descriptors. As a help to others, allow me to post the decoded descriptor:

0x09,        // bLength
0x02,        // bDescriptorType (Configuration)
0x29, 0x00,  // wTotalLength 41
0x01,        // bNumInterfaces 1
0x01,        // bConfigurationValue
0x00,        // iConfiguration (String Index)
0xA0,        // bmAttributes Remote Wakeup
0x32,        // bMaxPower 100mA

0x09,        // bLength
0x04,        // bDescriptorType (Interface)
0x00,        // bInterfaceNumber 0
0x00,        // bAlternateSetting
0x02,        // bNumEndpoints 2
0x03,        // bInterfaceClass
0x00,        // bInterfaceSubClass
0x00,        // bInterfaceProtocol
0x00,        // iInterface (String Index)

0x09,        // bLength
0x21,        // bDescriptorType (HID)
0x10, 0x01,  // bcdHID 1.10
0x00,        // bCountryCode
0x01,        // bNumDescriptors
0x22,        // bDescriptorType[0] (HID)
0x2F, 0x00,  // wDescriptorLength[0] 47

0x07,        // bLength
0x05,        // bDescriptorType (Endpoint)
0x81,        // bEndpointAddress (IN/D2H)
0x03,        // bmAttributes (Interrupt)
0x40, 0x00,  // wMaxPacketSize 64
0x0A,        // bInterval 10 (unit depends on device speed)

0x07,        // bLength
0x05,        // bDescriptorType (Endpoint)
0x01,        // bEndpointAddress (OUT/H2D)
0x03,        // bmAttributes (Interrupt)
0x40, 0x00,  // wMaxPacketSize 64
0x0A,        // bInterval 10 (unit depends on device speed)

// 41 bytes

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.

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.

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.