2
\$\begingroup\$

What is "0x06, 0x00, 0xFF, // Usage Page = 0xFF00 (Vendor Defined Page 1)" used for?

USB HID Report descriptor.

**

In the USB documentation I only found this:

Unknown Usage Unknown usages can be standard HID usages that an application predates or vendor defined usages not recognized by a generic application.

**

For "Usage Page = 0xFF00 (Vendor Defined Page 1)" there are two groups:

Vendor Usage 1

and

Vendor Usage 2

... HID Descriptor Tool interface image ...

enter image description here

If you answer that these groups contain unknown devices, it will not be clear to me. There may be billions of unknown devices; the settings of all devices cannot be in these two groups.

And why is it written in my keyboard code “USAGE_PAGE (Vendor Defined Page 1)” if the device is known.

In my code it is written "USAGE_PAGE (Vendor Defined Page 1)" to control the keyboard, without a touchpad, just a regular keyboard.

In the code I replaced this USAGE_PAGE (Vendor Defined Page 1) with this USAGE_PAGE (Generic Desktop), Usage(Keyboard) and the code stopped working.

Here I found a report descriptor for Custom Keyboard that works for me.

STM32F407

__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END =
{
  0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
  0x09, 0x01,   // USAGE 
  0xa1, 0x01, // COLLECTION 
  0X85, 0X01, 

    0x09, 0x01, // USAGE
    0x15, 0x00, // LOGICAL_MINIMUM (0) 
    0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
    0x95, 0x40, // REPORT_COUNT (64) 
    0x75, 0x08, // REPORT_SIZE (8) 
    0x81, 0x02, // INPUT ( Data,Var,Abs)


    0x09, 0x01, // USAGE
    0x15, 0x00, // LOGICAL_MINIMUM (0)
    0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 
    0x95, 0x40, // REPORT_COUNT (64) 
    0x75 , 0x08, // REPORT_SIZE (8)
    0x91, 0x02, // OUTPUT (Data,Var,Abs)
    0xc0, // END_COLLECTION

        0x05, 0x01,//USAGE_PAGE (Generic Desktop)
        0x09, 0x06,//USAGE 
        0xa1, 0x01,//COLLECTION 

        0X85, 0X02,//ID2
        0x05, 0x07,//USAGE_PAGE
        0x19, 0xe0,//USAGE_MINIMUM
        0x29, 0xe7,// USAGE_MAXIMUM
        0x15, 0x00,//LOGICAL_MINIMUM (0)
        0x25, 0x01,//LOGICAL_MAXIMUM (1)
        0x75, 0x01,//REPORT_SIZE (1)
        0x95, 0x08,//REPORT_COUNT (8)
        0x81, 0x02 ,//
        0x95, 0x01,//REPORT_COUNT (1)
        0x75, 0x08,//REPORT_SIZE (8)
        0x81, 0x03,//INPUT (Cnst,Var,Abs)
        0x95, 0x05,//REPORT_COUNT (5)
        0x75, 0x01,// REPORT_SIZE (1)
        0x05, 0x08, // USAGE_PAGE
        0x19, 0x01, // USAGE_MINIMUM (Num Lock)
        0x29, 0x05, // USAGE_MAXIMUM (Kana)
        0x91, 0x02, // OUTPUT (Data, Var, Abs)
        0x95 , 0x01,//REPORT_COUNT (1)
        0x75, 0x03,//REPORT_SIZE (3)
        0x91, 0x03,//OUTPUT (Cnst,Var,Abs)
        0x95, 0x06,//REPORT_COUNT (6)
        0x75, 0x08,//REPORT_SIZE (8)
        0x15, 0x00,//
        0x25, 0xFF,//
        0x05, 0x07,//USAGE_PAGE
        0x19, 0x00,//USAGE_MINIMUM
        0x29, 0x65,//USAGE_MAXIMUM 
        0x81, 0x00,//INPUT (Data,Ary,Abs)
        0xc0
};

USBD_CUSTOM_HID_REPORT_DESC_SIZE must be changed to 101U

#define USBD_CUSTOM_HID_REPORT_DESC_SIZE 101U

\$\endgroup\$
5
  • \$\begingroup\$ which USB documentation? More context please! What is that dialog you're showing us? what are you working with? \$\endgroup\$ Sep 16, 2023 at 17:42
  • \$\begingroup\$ >which USB documentation?<usb.org/sites/default/files/hid1_12.pdf \$\endgroup\$
    – stm
    Sep 16, 2023 at 17:45
  • \$\begingroup\$ please add that to the question by editing it, and also, please answer the other two out of three questions from my comment, which you did not address. \$\endgroup\$ Sep 16, 2023 at 17:48
  • \$\begingroup\$ Post full report descriptors - those can have non trivial interactions. The USB.org documentation does not explain how the OS HID parsers work at all. \$\endgroup\$
    – Turbo J
    Sep 16, 2023 at 18:29
  • \$\begingroup\$ Vendor Defined Page 1 is located in the report descriptor for USB HID. I added everything you asked to the post above. \$\endgroup\$
    – stm
    Sep 16, 2023 at 18:58

1 Answer 1

1
\$\begingroup\$

Unlike to what the 'HID Descriptor Tool' might imply, you're not limited to only two vendor usages. The vendor specific usage ranges from 0xFF00 to 0xFFFF.

Macro from TI's TivaWare:

//*****************************************************************************
//
//! This is a macro to assist adding vendor-specific Usage entries in HID
//! report descriptors.
//!
//! \param value is the vendor-specific Usage value in the range 0xFF00 to
//! 0xFFFF.
//!
//! This macro takes a value and prepares it to be placed as a Usage entry into
//! a HID report structure.  These are defined by the USB HID specification.
//!
//! \return Not a function.
//
//*****************************************************************************
#define UsageVendor(value)   0x0A, ((value) & 0xFF), (((value) >> 8) & 0xFF)

You can use these Vendor Usages for anything that is not covered by the HID standard. In the example you showed, it could be that they're used for the purpose of a communication interface (data pipes; 64 byte input, 64 byte output).

If you answer that these groups contain unknown devices, it will not be clear to me. There may be billions of unknown devices; the settings of all devices cannot be in these two groups.

The combination of vendor ID (VID) and product ID (PID) sets the context for the vendor usages. HID means that you do not need to provide your own driver. However, because vendor usages are manufacturer-specific, the manufacturer is responsible for documenting the interface (if it is to be used by third parties).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.