Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


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/


WdfUsbTargetDeviceSelectConfig returns STATUS_INSUFFICIENT_RESOURCES

jtomczykjtomczyk Member Posts: 34

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

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,718
    edited June 30

    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.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • jtomczykjtomczyk Member Posts: 34

    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.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,718

    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.

  • jtomczykjtomczyk Member Posts: 34

    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.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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