Question about report descriptor

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
vsovereign
Rank 1
Rank 1
Posts: 21
Joined: Wed Dec 30, 2009 3:24 pm

Question about report descriptor

Post by vsovereign » Fri Jun 25, 2010 1:01 pm

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:

frank26080115
Rank 2
Rank 2
Posts: 43
Joined: Fri Jun 19, 2009 4:43 pm

Re: Question about report descriptor

Post by frank26080115 » Fri Jun 25, 2010 6:39 pm

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

Post Reply