cancel
Showing results for 
Search instead for 
Did you mean: 

CUSTOMHID_SIZ_REPORT_DESC larger than 255

gurnett2
Associate II
Posted on March 09, 2012 at 12:29

I have a hid report created using descriptor tool 2.4. The final descriptor size is 289. which appears to be to large (hid not detected). If I cut a few reports out so the size becomes less than 256 it works fine. Is it possible to increase the limit or do I need to do something else to get around this.

I'm using STM32_USB-FS-Device_Lib_V3.3.0

Thank you

Michael
3 REPLIES 3
tsuneo
Senior
Posted on March 10, 2012 at 02:27

Fix wItemLength field of HID descriptor (in the config descriptor set), as follows

usb_desc.c

#define WBVAL(x) (x & 0xFF),((x >> 8) & 0xFF)    // <--- add this definition

const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC] =

  {

    ...

    ...

    /******************** Descriptor of Custom HID HID ********************/

    /* 18 */

    0x09,         /* bLength: HID Descriptor size */

    HID_DESCRIPTOR_TYPE, /* bDescriptorType: HID */

    0x10,         /* bcdHID: HID Class Spec release number */

    0x01,

    0x00,         /* bCountryCode: Hardware target country */

    0x01,         /* bNumDescriptors: Number of HID class descriptors to follow */

    0x22,         /* bDescriptorType */

                                           // modify these two lines

//    CUSTOMHID_SIZ_REPORT_DESC,/* wItemLength: Total length of Report descriptor */

//    0x00,

    WBVAL( CUSTOMHID_SIZ_REPORT_DESC ), /* wItemLength: Total length of Report descriptor */

Tsuneo

gurnett2
Associate II
Posted on March 10, 2012 at 18:19

Thanks

I figured it out an your suggestion is pretty much what I did which confirms that I was on the right track

-Michael

tsuneo
Senior
Posted on March 10, 2012 at 18:58

> your suggestion is pretty

Thanks,

but such a macro is a standard way to fill two-bytes numbers into descriptors.

You'll see this way in many USB examples from other resources.

If ST team would learn the standard way, you shouldn't be trapped.

Tsuneo