Skip to main content
Explorer
April 26, 2024
Solved

USB_HOST capability on STM32F4 is limited in its ability to process multiple HID Report Descriptor

  • April 26, 2024
  • 1 reply
  • 1134 views

Hello,

The setup comprises a keyboard connected to the Host-configured USB port of an STM32F4 dev board and the keyboard is configured with the following two HID Report Descriptors:

 

0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
0x05, 0x08, // Usage Page (LEDs)
0x19, 0x01, // Usage Minimum (Num Lock)
0x29, 0x03, // Usage Maximum (Scroll Lock)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x03, // Report Count (3)
0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x05, // Report Count (5)
0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x05, 0x07, // Usage Page (Kbrd/Keypad)
0x19, 0xE0, // Usage Minimum (0xE0)
0x29, 0xE7, // Usage Maximum (0xE7)
0x95, 0x08, // Report Count (8)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x08, // Report Size (8)
0x95, 0x01, // Report Count (1)
0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x19, 0x00, // Usage Minimum (0x00)
0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x95, 0x06, // Report Count (6)
0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x00, // Usage (0x00)
0x95, 0x08, // Report Count (8)
0x75, 0x08, // Report Size (8)
0xB1, 0x00, // Feature (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0, // End Collection

// 63 bytes

 

And

 

0x05, 0x0C, // Usage Page (Consumer)
0x09, 0x01, // Usage (Consumer Control)
0xA1, 0x01, // Collection (Application)
0x19, 0x00, // Usage Minimum (Unassigned)
0x2A, 0x3C, 0x02, // Usage Maximum (AC Format)
0x15, 0x00, // Logical Minimum (0)
0x26, 0x3C, 0x02, // Logical Maximum (572)
0x95, 0x01, // Report Count (1)
0x75, 0x10, // Report Size (16)
0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection

// 23 bytes

 

 

Although this second HID Report Descriptor manages additional functions like Volume Up and Down keys, the USB_HOST library appears to be restricted to handling only the first HID Report Descriptor, ignoring the second one.

As a result, the USBH_HID_EventCallback() function is not triggered when the Volume Up key is pressed.

Thank you.

 

    This topic has been closed for replies.
    Best answer by Pavel A.

    Correct, the ST USBH library is limited in support of complex HID reports. It is not really intended for production use, rather for quick prototyping and demonstration of the hardware. You are welcome to add code to handle your HID peripherals, or use a more feature rich USB library.

     

    1 reply

    Pavel A.Answer
    Super User
    April 26, 2024

    Correct, the ST USBH library is limited in support of complex HID reports. It is not really intended for production use, rather for quick prototyping and demonstration of the hardware. You are welcome to add code to handle your HID peripherals, or use a more feature rich USB library.

     

    Graduate II
    March 22, 2025

    You are welcome to add support == Yet again STM has no support for even basic features

    In my case even the ESC key was left out of the host keyboard map!

    A post on how to detect the volume up/down and mute keys would be useful as there is no documentation on what's needed to get the extended keys working.

    Why does something so simple have to be so difficult with STM MCUs?