Page 1 of 1

Question about report descriptor

Posted: Fri Jun 25, 2010 1:01 pm
by vsovereign
Okay, so I'm a newbie. So please bear with me on this :wink:

This is the report descriptor that can be found on the firmware of the hid-data example.

Code: Select all

PROGMEM char usbHidReportDescriptor[22] = {    /* USB report descriptor */
    0x06, 0x00, 0xff,              // USAGE_PAGE (Generic Desktop)
    0x09, 0x01,                    // USAGE (Vendor Usage 1)
    0xa1, 0x01,                    // COLLECTION (Application)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
    0x75, 0x08,                    //   REPORT_SIZE (8)
    0x95, 0x80,                    //   REPORT_COUNT (128)
    0x09, 0x00,                    //   USAGE (Undefined)
    0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0                           // END_COLLECTION


My question is :
1. why do we need USAGE (UNDEFINED) and what does that mean? We already have USAGE in the beginning.
2. what does FEATURE (Data,Var,Abs,Buf) mean and what function does it do?
3. what does the values 0xb2, 0x02, 0x01 in front of FEATURE mean?

Thanks :wink:

Re: Question about report descriptor

Posted: Fri Jun 25, 2010 6:39 pm
by frank26080115
go read the official HID documentation from USB.org

1.
Every "main item" in the report should have a usage, it's undefined in this case probably because there's no real set meaning to the data.
Go read section 5.5

2.
Every report can be either "input", "output", or "feature". Feature reports are data sent from the host (computer) to the usb device, like when the computer tells a keyboard to turn on the caps-lock LED
the (Data,Var,Abs,Buf) means the report contains variable data which is absolute (not relative), I can't recall what "Buf" means (probably buffer).

go read section 6.2.2

3.
0xb2, 0x02, 0x01 means "FEATURE (Data,Var,Abs,Buf)", the text "FEATURE (Data,Var,Abs,Buf)" is just a comment...
those numbers are generated from the HID descriptor tool, according to section 6.2.2.4 shows how those numbers work

Everything I said here is explained well in the HID documentation