TI中文支持网
TI专业的中文技术问题搜集分享网站

hid报告描述符,麻烦帮我解析下数据格式

// Report ID 1: Mouse buttons + scroll/pan
0x85, 0x01, // Report Id 1
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x05, 0x09, // Usage Page (Buttons)
0x19, 0x01, // Usage Minimum (01)
0x29, 0x05, // Usage Maximum (05)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x81, 0x02, // Input (Data, Variable, Absolute)
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x81, 0x01, // Input (Constant) for padding
0x75, 0x08, // Report Size (8)
0x95, 0x01, // Report Count (1)/**/
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x38, // Usage (Wheel)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x81, 0x06, // Input (Data, Variable, Relative)
0x05, 0x0C, // Usage Page (Consumer)
0x0A, 0x38,0x02, // Usage (AC Pan)
0x95, 0x01, // Report Count (1)
0x81, 0x06, // Input (Data,Value,Relative,Bit Field)/**/
0xC0, // End Collection (Physical)

总共是3个字节的长度,但我不知道怎么解析,下面举个例子说明我想要的东西

例如:鼠标的hid报告

0x05,0x01,//UsagePage(GenericDesktop)
0x09,0x02,//Usage(Mouse)
0xA1,0x01,//Collection(Application)
0x85,0x01,//ReportId(1)
0x09,0x01,//Usage(Pointer)
0xA1,0x00,//Collection(Physical)
0x05,0x09,//UsagePage(Buttons)
0x19,0x01,// UsageMinimum(01)-Button1
0x29,0x03,// UsageMaximum(03)-Button3
0x15,0x00,// LogicalMinimum(0)
0x25,0x01,// LogicalMaximum(1)
0x75,0x01,// ReportSize(1)
0x95,0x03,// ReportCount(3)
0x81,0x02,// Input(Data,Variable,Absolute)-Buttonstates
0x75,0x05,// ReportSize(5)
0x95,0x01,// ReportCount(1)
0x81,0x01,// Input(Constant)-PaddingorReservedbits
0x05,0x01,//UsagePage(GenericDesktop)
0x09,0x30,// Usage(X)
0x09,0x31,// Usage(Y)
0x09,0x38,// Usage(Wheel)
0x15,0x81,// LogicalMinimum(-127)
0x25,0x7F,// LogicalMaximum(127)
0x75,0x08,// ReportSize(8)
0x95,0x03,// ReportCount(3)
0x81,0x06,// Input(Data,Variable,Relative)-X&Ycoordinate
0xC0,//EndCollection(Physical)
0xC0 // End Collection (Application)

得到的数据格式是这样的:

b1 b2 b3 reserved x y wheel

0 1 2 3~7 0~7 0~7 0~7

总共24位,4个字节,所以send report时就是得按这种数据格式发送

Yan:

zenghui ,

这是HID的report map的定义,定义了一些应用场景和数据位数,是输入还是输出,值的范围等等。

你应该看一下关于USB HID的定义,网上有很多资料。

cedar_xuesong:

百度USB HID报告符

赞(0)
未经允许不得转载:TI中文支持网 » hid报告描述符,麻烦帮我解析下数据格式
分享到: 更多 (0)