...
嵌入式

HID 报告描述详解

HID 报告描述

1. 报告描述简介

Report Description,即上报事件的描述,描述所支持事件的格式及取值意义,比如鼠标按键上报格式、左键右键中间键分别对应的值等;报告描述类似,都是结构数据,格式类似

{usage:1, {id:0,usage:1.1,size:1,count:1,min:0,max:5,format:xx}}

2. 描述符结构

几个主要的名词解释一下:

  • Collection,集合,相当于{},用来包含一组描述;Collection有Application和Physical之分,Application表示大项,里有可以有很多Physical子项
  • Report,报告,在上图中只是一个ID号,来区分不同report。
  • Main Item,主项,例出来哪些项
  • Report Size,每一项有多少位。
  • Report Count, 总共有多少项
  • Logical Minimum,每个项的取值范围中的最小值,即最小只能取的值。
  • Logical Maximum,每个项的取值范围中的最大值,即最大只能取的值。
  • Usage,用途,表示有哪些功能,一个Usage代表一个功能。

项描述基本上是由两个字节构成,第一个字节表示名称,第二个字节表示值,
如Report Size,8
Report Size 是名称,8是它的值。
Report Size 对应的16制数据是0x75,在代码里上面的表现是0x75,0x08。

项描述基本上是由两个字节构成,第一个字节表示名称,第二个字节表示值,
如Report Size,8
Report Size 是名称,8是它的值。
Report Size 对应的16制数据是0x75,在代码里上面的表现是0x75,0x08。
有些名称不需要带值,如Collection的结束符( ) )为0xC0,就没有第二个字节。有些名称不需要带值,如Collection的结束符( ) )为0xC0,就没有第二个字节。

3. 名称

名称有分长字和短字,这里只介绍短字,短字是由一个字节构成,结构如下:

第3 ~ 2位表示类型,有如下几种:

  • 0 = Main
  • 1 = Global
  • 2 = Local
  • 3 = Reserved

第1 ~ 0位表示名称的值由多少个字节构成,具体意义如下:

  • 0 = 0 bytes,名称后面不带值
  • 1 = 1 bytes,名称后面带1个值
  • 2 = 2 bytes,名称后面带2个值
  • 3 = 4 bytes,名称后面带4个值

第7 ~ 4位表示Tag,Tag与类型对应,每种类型有很多不同的Tag。

3.1 Main类对应的Tag


在上面表格中,可以看到,第3 ~ 2位是00,这两位是bType值,00表示类型为Main;nn是第1 ~ 0位,是bSize,表示数值的字节数;第7 ~ 4位是bTag,如
1000(0x8?)表示Input;Valid Data表示值的意义,如Input项,Bit 0 {Data(0) | Constant(1)},意思是说,如果值的第0位的是0,即表示Data,如果是
Constant,如下语句:

  • 0x81, 0x02, // Input: (Data,Variable, Absolute)
  • 它的值是2,第0位是0对应的是Data,第1位是1 对应的是Variable,第二位是0对应的是Absolute,所以它是一个Data、Variable、 Absolute的类型。

下面对Data、Variable等的意思作一下解释。

  • Data 表示是一个可写的数据。
  • Constant 表示是一个只读的数据。
  • Aarray 表示数据里的值代表一个Usage,Report Size表示位数,即Report Size的存储单元里的值是Usage的Index。Report Count一般为1,如果大以同时出现多个Usage.
  • Variable 则是一个Report Size存储单元表示一个Usage,其值表示Usage的状态;Report Size表示位数,Report Count表示长度。
  • Absolute 表示绝对数据,如触模屏数据,便使用Absolute。
  • Relative 表示相对数据,如鼠标数据,便使用Relative。
  • 其也用的少就不多说了,详细参看《HID协议》。

3.2 Global类对应的Tag


在上面表格中,可以看到,第3 ~ 2位是01,这两位是bType值,01表示类型为Global;nn是第1 ~ 0位,是bSize,表示数值的字节数;第7 ~ 4位是bTag,
0000(0x0?)表示Usage Page。

3.3 Local类对应的Tag


在上面表格中,可以看到,第3 ~ 2位是10,这两位是bType值,10表示类型为Local;nn是第1 ~ 0位,是bSize,表示数值的字节数;第7 ~ 4位是bTag,
0000(0x0?)表示Usage。

4 样例解读

下面是一个伪代码描述的样例
其中涉及到的页码可查看第5段用途表:

Usage Page (Generic Desktop), //定位到Generic Desktop页,这个相当于指针跳转一样的东西
Usage (Mouse), //指定Generic Desktop里的mouse,表示这是一个鼠标
Collection (Application), // Collection Application,是对Mouse的解释
Usage(Pointer), //表示指针形式
Collection (Physical), // CollectionPhysical,是对Pointer的解释
ReportID (0A), //id为0x0A的报告
Usage(X), Usage (Y), //上报X,Y两个数据
LogicalMinimum (-127), ;Report data values range from -127
LogicalMaximum (127), ;to 127 //X,Y的取值范围是-127~127
ReportSize (8), Report Count (2), //总共要上报2个字节,即x一个字节,y一个字节
Input(Data, Variable, Relative), //将X,Y这两个字节添加到0x0A的报告里,且这两个值是可写并且是相对的
LogicalMinimum (0), ;
LogicalMaximum (1), ;//下面Button的取值范围是0~1
ReportSize (1), Report Count (3), //3个1位的数据
UsagePage (Button Page),//是一个BUTTON
UsageMinimum (1),
Usage Maximum (3),//共有BUTTON1~BUTTON3,即总共有3个BUTTON
Input(Data, Variable, Absolute),//将3个分别代表的BUTTON1,BUTTON2,BUTTON3的位添加到0x0A的报告
ReportSize (5),
Input(Constant), //增加5个无效的位与上面3位凑成一个字节
EndCollection,
End Collection

综上所示,上面样例所表达的意思就是下图所示的:

再举一个实际的例子进行解读,下面是摘自TI CC2540/CC2541 SDK里的BLE-CC254x_v1.4.0\Projects\ble\Profiles\HIDDevKbM\hidkbmservice.c

static CONST uint8 hidReportMap[] =
{
// 鼠标
0x05, 0x01, // UsagePage (Generic Desktop)
 0x09, 0x02, // Usage (Mouse)
 0xA1, 0x01, // Collection (Application)
 0x85, 0x01, // Report Id (1)
 0x09, 0x01, // Usage (Pointer)
 0xA1, 0x00, // Collection (Physical)
 0x05, 0x09, // Usage Page (Buttons)
 0x19, 0x01, // Usage Minimum (01) -Button 1
 0x29, 0x03, // Usage Maximum (03) -Button 3
 0x15, 0x00, // Logical Minimum (0)
 0x25, 0x01, // Logical Maximum (1)
 0x75, 0x01, // Report Size (1)
 0x95, 0x03, // Report Count (3)
 0x81, 0x02, // Input (Data, Variable,Absolute) - Button states
 0x75, 0x05, // Report Size (5)
 0x95, 0x01, // Report Count (1)
 0x81, 0x01, // Input (Constant) - Paddingor Reserved bits
 0x05, 0x01, // Usage Page (GenericDesktop)
 0x09, 0x30, // Usage (X)
 0x09, 0x31, // Usage (Y)
 0x09, 0x38, // Usage (Wheel)
 0x15, 0x81, // Logical Minimum (-127)
 0x25, 0x7F, // Logical Maximum (127)
 0x75, 0x08, // Report Size (8)
 0x95, 0x03, // Report Count (3)
 0x81, 0x06, // Input (Data, Variable,Relative) - X & Y coordinate
 0xC0, // End Collection
 0xC0, // End Collection
// 键盘
0x05, 0x01, // UsagePg (Generic Desktop)
 0x09, 0x06, // Usage (Keyboard)
 0xA1, 0x01, // Collection: (Application)
 0x85, 0x02, // Report Id (2)
 //
 0x05, 0x07, // Usage Pg (Key Codes)
 0x19, 0xE0, // Usage Min (224)
 0x29, 0xE7, // Usage Max (231)
 0x15, 0x00, // Log Min (0)
 0x25, 0x01, // Log Max (1)
 // Modifier byte
 0x75, 0x01, // Report Size (1)
 0x95, 0x08, // Report Count (8)
 0x81, 0x02, // Input: (Data, Variable,Absolute)
 // Reserved byte
 0x95, 0x01, // Report Count (1)
 0x75, 0x08, // Report Size (8)
 0x81, 0x01, // Input: (Constant)
 // LED report
 0x95, 0x05, // Report Count (5)
 0x75, 0x01, // Report Size (1)
 0x05, 0x08, // Usage Pg (LEDs)
 0x19, 0x01, // Usage Min (1)
 0x29, 0x05, // Usage Max (5)
 0x91, 0x02, // Output: (Data, Variable,Absolute)
 // LED report padding
 0x95, 0x01, // Report Count (1)
 0x75, 0x03, // Report Size (3)
 0x91, 0x01, // Output: (Constant)
 // Key arrays (6 bytes)
 0x95, 0x06, // Report Count (6)
 0x75, 0x08, // Report Size (8)
 0x15, 0x00, // Log Min (0)
 0x25, 0x65, // Log Max (101)
 0x05, 0x07, // Usage Pg (Key Codes)
 0x19, 0x00, // Usage Min (0)
 0x29, 0x65, // Usage Max (101)
 0x81, 0x00, // Input: (Data, Array)
 0xC0, // End Collection
// Consumer
0x05, 0x0C, // Usage Pg (Consumer Devices)
 0x09, 0x01, // Usage (Consumer Control)
 0xA1, 0x01, // Collection (Application)
 0x85, 0x03, // Report Id (3)
 0x09, 0x02, // Usage (Numeric KeyPad)
 0xA1, 0x02, // Collection (Logical)
 0x05, 0x09, // Usage Pg (Button)
 0x19, 0x01, // Usage Min (Button1)
 0x29, 0x0A, // Usage Max (Button10)
 0x15, 0x01, // Logical Min (1)
 0x25, 0x0A, // Logical Max (10)
 0x75, 0x04, // Report Size (4)
 0x95, 0x01, // Report Count (1)
 0x81, 0x00, // Input (Data, Ary,Abs)
 0xC0, // End Collection
 0x05, 0x0C, // Usage Pg (ConsumerDevices)
 0x09, 0x86, // Usage (Channel)
 0x15, 0xFF, // Logical Min (-1)
 0x25, 0x01, // Logical Max (1)
 0x75, 0x02, // Report Size (2)
 0x95, 0x01, // Report Count (1)
 0x81, 0x46, // Input (Data, Var,Rel, Null)
 0x09, 0xE9, // Usage (Volume Up)
 0x09, 0xEA, // Usage (Volume Down)
 0x15, 0x00, // Logical Min (0)
 0x75, 0x01, // Report Size (1)
 0x95, 0x02, // Report Count (2)
 0x81, 0x02, // Input (Data, Var,Abs)
 0x09, 0xE2, // Usage (Mute)
 0x09, 0x30, // Usage (Power)
 0x09, 0x40, // Usage (Menu)
 0x09, 0xB1, // Usage (Pause)
 0x09, 0xB2, // Usage (Record)
 0x0a, 0x23, 0x02, // Usage (Home)
 0x0a, 0x24, 0x02, // Usage (Back)
 0x09, 0xB3, // Usage (Fast Forward)
 0x09, 0xB4, // Usage (Rewind)
 0x09, 0xB5, // Usage (Scan Next)
 0x09, 0xB6, // Usage (Scan Prev)
 0x09, 0xB7, // Usage (Stop)
 0x15, 0x01, // Logical Min (1)
 0x25, 0x0C, // Logical Max (12)
 0x75, 0x04, // Report Size (4)
 0x95, 0x01, // Report Count (1)
 0x81, 0x00, // Input (Data, Ary,Abs)
 0x09, 0x80, // Usage (Selection)
 0xA1, 0x02, // Collection (Logical)
 0x05, 0x09, // Usage Pg (Button)
 0x19, 0x01, // Usage Min (Button1)
 0x29, 0x03, // Usage Max (Button3)
 0x15, 0x01, // Logical Min (1)
 0x25, 0x03, // Logical Max (3)
 0x75, 0x02, // Report Size (2)
 0x81, 0x00, // Input (Data, Ary,Abs)
 0xC0, // End Collection
 0x81, 0x03, // Input (Const, Var,Abs)
 0xC0 // End Collection
};

上面用三大应用功能,分别鼠标、键盘和Consumer,每个应用功能都是用Collection Application括起来的。

我们先来解析鼠标的报告描述:

// 0x04代表是Global类的Usage Page功能,最位2位表示带多少个字节的数据,因为只带1个数据,所以是1,跟0x04组合起来就是0x05了。其他名称的不多,数值可以参照上面的《3名称》
0x05,0x01, // Usage Page (Generic Desktop)
// 表示这是一个鼠标, Usage是为了给对方解析数据时有个参照
0x09, 0x02, // Usage (Mouse)
// 0xA1, 0x01 表示Collection Application ; 0xA1,0x00表示CollectionPhysical.表示下面所包含的是对Mouse的解释
0xA1, 0x01, // Collection (Application)
// 该报告对应的ID是1
0x85, 0x01, // Report Id (1)
// 这是个指针形式
0x09, 0x01, // Usage (Pointer)
// 下面所包含的是对指针的解释
0xA1, 0x00, // Collection (Physical)
// 下面定义的是按键
0x05, 0x09, // Usage Page (Buttons)
// 总共有3个按键
0x19, 0x01, // Usage Minimum (01) -Button 1
0x29, 0x03, // Usage Maximum (03) -Button 3
// 按键的值是0和1,表示放开和按下
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
// 有3个1位,即用3bits分别对应三个按键
0x75, 0x01, // Report Size (1)
0x95, 0x03, // Report Count (3)
// 将这三个位加入本报告的数据中,这三位是可读写的绝对值
0x81, 0x02, // Input (Data, Variable,Absolute) - Button states
// 定义1个5位的数据
0x75, 0x05, // Report Size (5)
0x95, 0x01, // Report Count (1)
// 将这个数据添加到本报告的数据中,主要是与前面3位组成一个字节,这5位是Constant数据
0x81, 0x01, // Input (Constant) - Paddingor Reserved bits
// 下面定义的是X,Y,Wheel三个功能
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x09, 0x38, // Usage (Wheel)
// X,Y,Wheel的取值范围是-127~127
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
// 用三个字节来表示x,y,wheel
0x75, 0x08, // Report Size (8)
0x95, 0x03, // Report Count (3)
// 将这三个字节添加到本报告中
0x81, 0x06, // Input (Data, Variable,Relative) - X & Y coordinate
0xC0, // End Collection

上面解析出来的数据格式如下:

我们来看一下,如果要发一个鼠标的坐标,该如何发:

static void hidEmuKbdSendMouseReport( uint8buttons )
{
    uint8 buf[HID_MOUSE_IN_RPT_LEN];
    buf[0] = buttons; // Buttons
    buf[1] = 0; // X
    buf[2] = 0; // Y
    buf[3] = 0; // Wheel
    HidDev_Report( HID_RPT_ID_MOUSE_IN, HID_REPORT_TYPE_INPUT, HID_MOUSE_IN_RPT_LEN, buf );
}

从上面函数可以看到,X,Y在第2、3个字节,结合上面的数据格式图可以看出,正好是对应的。

我们接着解析键盘的报告描述:

// 这是一个键盘
0x05,0x01, // Usage Pg (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
// 本报告的ID是2
0xA1, 0x01, // Collection: (Application)
0x85, 0x02, // Report Id (2)
// 下面定义的是按键码
0x05, 0x07, // Usage Pg (Key Codes)
// 按键码分别是224~231,共总有8个按键码
0x19, 0xE0, // Usage Min (224)
0x29, 0xE7, // Usage Max (231)
// 按键码的值是0和1,分别代表放开和按下
0x15, 0x00, // Log Min (0)
0x25, 0x01, // Log Max (1)
// 用8个bit分别表示8个按键的状态
// Modifier byte
0x75, 0x01, // Report Size (1)
0x95, 0x08, // Report Count (8)
// 将这8个bit添加到本报告中
0x81, 0x02, // Input: (Data, Variable,Absolute)
// 另外再预留8个bit备用,暂时没用
// Reserved byte
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x01, // Input: (Constant)
// 定义5个1bit
// LED report
0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
// 这是LED
0x05, 0x08, // Usage Pg (LEDs)
// 5个bit分别对应LED1~LED5
0x19, 0x01, // Usage Min (1)
0x29, 0x05, // Usage Max (5)
// 将这5个bit添加到本报告中,LED需要作为OUT
0x91, 0x02, // Output: (Data, Variable,Absolute)
// 再增加3个bit,与上面5个bit组成一个字节
// LED report padding
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x91, 0x01, // Output: (Constant)
// 定义6个字节
// Key arrays (6 bytes)
0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
// 每个字节的取值范围是0~101
0x15, 0x00, // Log Min (0)
0x25, 0x65, // Log Max (101)
// 这个也是键盘码
0x05, 0x07, // Usage Pg (Key Codes)
// 分别是键盘码0~键盘码101
0x19, 0x00, // Usage Min (0)
0x29, 0x65, // Usage Max (101)
// 将这6个字节添加到本报告中,表示同时可产生6个键值。
0x81, 0x00, // Input: (Data, Array)
0xC0, // End Collection

上面解析出来的数据格式如下:

Input和Out是不同的两条通道。现在我们来看一下,如果要发一个按键K0~K101,需要怎么发,如下:

static void hidEmuKbdSendReport( uint8keycode )
{
    uint8 buf[HID_KEYBOARD_IN_RPT_LEN];
    buf[0] = 0; // Modifierkeys
    buf[1] = 0; // Reserved
    buf[2] = keycode; // Keycode 1
    buf[3] = 0; // Keycode 2
    buf[4] = 0; // Keycode 3
    buf[5] = 0; // Keycode 4
    buf[6] = 0; // Keycode 5
    buf[7] = 0; // Keycode 6
    HidDev_Report( HID_RPT_ID_KEY_IN, HID_REPORT_TYPE_INPUT, HID_KEYBOARD_IN_RPT_LEN, buf );
}

上面函数可以看到,它是放在第3个字节,结合数据格式图可以看出,第3个字节开始,刚好是在K0~K101的按键区。

我们最后来解析Consumer的报告描述:

// 这是个Consumer控制
0x05,0x0C, // Usage Pg (Consumer Devices)
0x09, 0x01, // Usage (Consumer Control)
// 本报告ID为3
0xA1, 0x01, // Collection (Application)
0x85, 0x03, // Report Id (3)
// 下面定义的是数字键盘
0x09, 0x02, // Usage (Numeric KeyPad)
// 下面定义的是按键
0xA1, 0x02, // Collection (Logical)
0x05, 0x09, // Usage Pg (Button)
// 分别是Button1~Button10
0x19, 0x01, // Usage Min (Button1)
0x29, 0x0A, // Usage Max (Button10)
// 每个按键的取值范围为1~10
0x15, 0x01, // Logical Min (1)
0x25, 0x0A, // Logical Max (10)
// 1个4bit的值,来表示键值1~10,这个值是哪个就表示哪个键按下。
0x75, 0x04, // Report Size (4)
0x95, 0x01, // Report Count (1)
// 将这4bit添加到本报告中
0x81, 0x00, // Input (Data, Ary, Abs)
0xC0, // End Collection
// 这里定义的是频道
0x05, 0x0C, // Usage Pg (ConsumerDevices)
0x09, 0x86, // Usage (Channel)
// 频道值范围是-1~1,这里应该只用到-1和1,表示频道+和-
0x15, 0xFF, // Logical Min (-1)
0x25, 0x01, // Logical Max (1)
// 用一个2bit来表示,第1个bit表示频道+,第二个表示频道-
0x75, 0x02, // Report Size (2)
0x95, 0x01, // Report Count (1)
// 将这个2bit加到本报告中
0x81, 0x46, // Input (Data, Var,Rel, Null)
// 定义两个按键,音量加和音量减
0x09, 0xE9, // Usage (Volume Up)
0x09, 0xEA, // Usage (Volume Down)
// 按键值为0~1,这里少了LogicalMax,继承上面的LogicalMax=1
0x15, 0x00, // Logical Min (0)
0x75, 0x01, // Report Size (1)
// 定义2个1bit,每个bit代表一个键
0x95, 0x02, // Report Count (2)
// 将2个1bit添加到本报告中
0x81, 0x02, // Input (Data, Var,Abs)
// 定义12个按键
0x09, 0xE2, // Usage (Mute)
0x09, 0x30, // Usage (Power)
0x09, 0x40, // Usage (Menu)
0x09, 0xB1, // Usage (Pause)
0x09, 0xB2, // Usage (Record)
0x0a, 0x23, 0x02, // Usage (Home)
0x0a, 0x24, 0x02, // Usage (Back)
0x09, 0xB3, // Usage (Fast Forward)
0x09, 0xB4, // Usage (Rewind)
0x09, 0xB5, // Usage (Scan Next)
0x09, 0xB6, // Usage (Scan Prev)
0x09, 0xB7, // Usage (Stop)
// 用一个4位来存储1~12,1表示Mute … 12表示Stop
0x15, 0x01, // Logical Min (1)
0x25, 0x0C, // Logical Max (12)
0x75, 0x04, // Report Size (4)
0x95, 0x01, // Report Count (1)
// 将这个4bit添加到报告中
0x81, 0x00, // Input (Data, Ary,Abs)
0x09, 0x80, // Usage (Selection)
// 这是按键
0xA1, 0x02, // Collection (Logical)
0x05, 0x09, // Usage Pg (Button)
// 分别是Button1~Button3
0x19, 0x01, // Usage Min (Button1)
0x29, 0x03, // Usage Max (Button3)
// 每个按键取值范围是1~3
0x15, 0x01, // Logical Min (1)
0x25, 0x03, // Logical Max (3)
// 这里缺少了Report Count,继承上面的Report Count =1,也就是用1个2bit来存储1~3
0x75, 0x02, // Report Size (2)
// 将1个字节添加到本报告中
0x81, 0x00, // Input (Data, Ary,Abs)
0xC0, // End Collection
// 再补充2个bit将上面的凑成一个字节,ReportSize=2和Report Count=1继承上面的。
0x81, 0x03, // Input (Const, Var,Abs)
0xC0 // End Collection

修改后,解析出来的数据格式如下:

我们来看一下,如果要发音量+/-键该怎么发:

static void hidCCSendReport( uint8 cmd,bool keyPressed )
{
    //Only send the report if something meaningful to report
    uint8 buf[HID_CC_IN_RPT_LEN] = { 0, 0 };
    //No need to include Report Id
    if( keyPressed )
    {
        hidCCBuildReport( buf, cmd );
    }
    HidDev_Report( HID_RPT_ID_CC_IN, HID_REPORT_TYPE_INPUT, HID_CC_IN_RPT_LEN, buf );
}

在hidCCBuildReport对音量加减解析出来是:
音量加是:buf[0] =0x40, buf[1] = 0x00
音量减是:buf[0] =0x80, buf[1] = 0x00
正好与数据格式图中第一个字节的第6位和第7位相对应。

5 用途表

下面用途表中列了几个常用的表,其他详细请参看《HID用途表》
Usage Page

Page ID Page Name
0 Undefined
1 Generic Desktop Controls
2 Simulation Controls
3 VR Controls
4 Sport Controls
5 Game Controls
6 Generic Device Controls
7 Keyboard / Keypad
8 LEDs
9 Button
0A Ordinal
0B Telephony
0C Consumer
0D Digitizer
0E Reserved
0F PID Page
10 Unicode
11-13 Reserved
14 Alphanumeric Display
15-3F Reserved
40 Medical Instruments
41-7F Reserved
80-83 Monitor pages
84-87 Power pages
88-8B Reserved
8C Bar Code Scanner page
8D Scale page
8E Magnetic Stripe Reading (MSR) Devices
8F Reserved Point of Sale pages

Generic Desktop Page(0x01)

Usage ID Usage Name
0 Undefined
1 Pointer
2 Mouse
3 Reserved
4 Joystick
5 Game Pad
6 Keyboard
7 Keypad
8 Multi-axis Controller
9 Tablet PC System Controls
0A-2F Reserved
30 X
31 Y
32 Z
33 Rx
34 Ry
35 Rz
36 Slider
37 Dial
38 Wheel
39 Hat switch
3A Counted Buffer
3B Byte Count
3C Motion Wakeup
3D Start OOC
3E Select OOC
3F Reserved
40 Vx
41 Vy
42 Vz
43 Vbrx
44 Vbry
45 Vbrz
46 Vno
47 Feature Notification
48 Resolution Multiplier
49-7F Reserved
80 System Control
81 System Power Down
82 System Sleep
83 System Wake Up
84 System Context Menu
85 System Main Menu
86 System App Menu
87 System Menu Help
88 System Menu Exit
89 System Menu Select
8A System Menu Right
8B System Menu Left
8C System Menu Up
8D System Menu Down
8E System Cold Restart
8F System Warm Restart
90 D-pad Up
91 D-pad Down
92 D-pad Right
93 D-pad Left
94-9F Reserved
A0 System Dock
A1 System Undock
A2 System Setup
A3 System Break
A4 System Debugger Break
A5 Application Break
A6 Application Debugger Break
A7 System Speaker Mute
A8 System Hibernate
A9-AF Reserved
B0 System Display Invert
B1 System Display Internal
B2 System Display External
B3 System Display Both
B4 System Display Dual
B5 System Display Toggle Int/Ext
B6 System Display Swap Primary/Secondary
B7 System Display LCD Autoscale
B8-FFFF Reserved

Keyboard/Keypad Page(0x07)

Usage ID (Dec) Usage ID (Hex) Usage Name
1 01 Keyboard ErrorRollOver9
2 02 Keyboard POSTFail9
3 03 Keyboard ErrorUndefined9
4 04 Keyboard a and A4
5 05 Keyboard b and B
6 06 Keyboard c and C4
7 07 Keyboard d and D
8 08 Keyboard e and E
9 09 Keyboard f and F
10 0A Keyboard g and G
11 0B Keyboard h and H
12 0C Keyboard i and I
13 0D Keyboard j and J
14 0E Keyboard k and K
15 0F Keyboard l and L
16 10 Keyboard m and M4
17 11 Keyboard n and N
18 12 Keyboard o and O4
19 13 Keyboard p and P4
20 14 Keyboard q and Q4
21 15 Keyboard r and R
22 16 Keyboard s and S4
23 17 Keyboard t and T
24 18 Keyboard u and U
25 19 Keyboard v and V
26 1A Keyboard w and W4
27 1B Keyboard x and X4
28 1C Keyboard y and Y4
29 1D Keyboard z and Z4
30 1E Keyboard 1 and !4
31 1F Keyboard 2 and @4
32 20 Keyboard 3 and #4
33 21 Keyboard 4 and $4
34 22 Keyboard 5 and %4
35 23 Keyboard 6 and ^4
36 24 Keyboard 7 and &4
37 25 Keyboard 8 and *4
38 26 Keyboard 9 and (4
39 27 Keyboard 0 and )4
40 28 Keyboard Return (ENTER)5
41 29 Keyboard ESCAPE
42 2A Keyboard DELETE (Backspace)13
43 2B Keyboard Tab
44 2C Keyboard Spacebar
45 2D Keyboard - and (underscore)4
46 2E Keyboard = and +4
47 2F Keyboard [ and {4
48 30 Keyboard ] and }4
49 31 Keyboard \ and
50 32 Keyboard Non-US # and ~2
51 33 Keyboard ; and :4
52 34 Keyboard ‘ and “4
53 35 Keyboard Grave Accent and Tilde4
54 36 Keyboard , and <4
55 37 Keyboard . and >4
56 38 Keyboard / and ?4
57 39 Keyboard Caps Lock11
58 3A Keyboard F1
59 3B Keyboard F2
60 3C Keyboard F3
61 3D Keyboard F4
62 3E Keyboard F5
63 3F Keyboard F6
64 40 Keyboard F7
65 41 Keyboard F8
66 42 Keyboard F9
67 43 Keyboard F10
68 44 Keyboard F11
69 45 Keyboard F12
70 46 Keyboard PrintScreen1
71 47 Keyboard Scroll Lock11
72 48 Keyboard Pause1
73 49 Keyboard Insert1
74 4A Keyboard Home1
75 4B Keyboard PageUp1
76 4C Keyboard Delete Forward1
77 4D Keyboard End1
78 4E Keyboard PageDown1
79 4F Keyboard RightArrow1
80 50 Keyboard LeftArrow1
81 51 Keyboard DownArrow1
82 52 Keyboard UpArrow1
83 53 Keypad Num Lock and Clear11
84 54 Keypad /1
85 55 Keypad *
86 56 Keypad -
87 57 Keypad +
88 58 Keypad ENTER5
89 59 Keypad 1 and End
90 5A Keypad 2 and Down Arrow
91 5B Keypad 3 and PageDn
92 5C Keypad 4 and Left Arrow
93 5D Keypad 5
94 5E Keypad 6 and Right Arrow
95 5F Keypad 7 and Home
96 60 Keypad 8 and Up Arrow
97 61 Keypad 9 and PageUp
98 62 Keypad 0 and Insert
99 63 Keypad . and Delete
100 64 Keyboard Non-US \ and 3;6
101 65 Keyboard Application10
102 66 Keyboard Power
103 67 Keypad =
104 68 Keyboard F13
105 69 Keyboard F14
106 6A Keyboard F15
107 6B Keyboard F16
108 6C Keyboard F17
109 6D Keyboard F18
110 6E Keyboard F19
111 6F Keyboard F20
112 70 Keyboard F21
113 71 Keyboard F22
114 72 Keyboard F23
115 73 Keyboard F24
116 74 Keyboard Execute
117 75 Keyboard Help
118 76 Keyboard Menu
119 77 Keyboard Select
120 78 Keyboard Stop
121 79 Keyboard Again
122 7A Keyboard Undo
123 7B Keyboard Cut
124 7C Keyboard Copy
125 7D Keyboard Paste
126 7E Keyboard Find
127 7F Keyboard Mute
128 80 Keyboard Volume Up
129 81 Keyboard Volume Down
130 82 Keyboard Locking Caps Lock
131 83 Keyboard Locking Num Lock
132 84 Keyboard Locking Scroll Lock
133 85 Keypad Comma
134 86 Keypad Equal Sign
135 87 Keyboard International1
136 88 Keyboard International2
137 89 Keyboard International3
138 8A Keyboard International4
139 8B Keyboard International5
140 8C Keyboard International6
141 8D Keyboard International7
142 8E Keyboard International8
143 8F Keyboard International9
144 90 Keyboard LANG1
145 91 Keyboard LANG2
146 92 Keyboard LANG3
147 93 Keyboard LANG4
148 94 Keyboard LANG5
149 95 Keyboard LANG6
150 96 Keyboard LANG7
151 97 Keyboard LANG8
152 98 Keyboard LANG9
153 99 Keyboard Alternate Erase
154 9A Keyboard SysReq/Attention
155 9B Keyboard Cancel
156 9C Keyboard Clear
157 9D Keyboard Prior
158 9E Keyboard Return
159 9F Keyboard Separator
160 A0 Keyboard Out
161 A1 Keyboard Oper
162 A2 Keyboard Clear/Again
163 A3 Keyboard CrSel/Props
164 A4 Keyboard ExSel
165-175 A5-CF Reserved
176 B0 Keypad 00
177 B1 Keypad 000
178 B2 Thousands Separator
179 B3 Decimal Separator
180 B4 Currency Unit
181 B5 Currency Sub-unit
182 B6 Keypad (
183 B7 Keypad )
184 B8 Keypad {
185 B9 Keypad }
186 BA Keypad Tab
187 BB Keypad Backspace
188 BC Keypad A
189 BD Keypad B
190 BE Keypad C
191 BF Keypad D
192 C0 Keypad E
193 C1 Keypad F
194 C2 Keypad XOR
195 C3 Keypad ^
196 C4 Keypad %
197 C5 Keypad <
198 C6 Keypad >
199 C7 Keypad &
200 C8 Keypad &&
201 C9 Keypad |
202 CA Keypad ||
203 CB Keypad :
204 CC Keypad #
205 CD Keypad Space
206 CE Keypad @
207 CF Keypad !
208 D0 Keypad Memory Store
209 D1 Keypad Memory Recall
210 D2 Keypad Memory Clear
211 D3 Keypad Memory Add
212 D4 Keypad Memory Subtract
213 D5 Keypad Memory Multiply
214 D6 Keypad Memory Divide
215 D7 Keypad +/-
216 D8 Keypad Clear
217 D9 Keypad Clear Entry
218 DA Keypad Binary
219 DB Keypad Octal
220 DC Keypad Decimal
221 DD Keypad Hexadecimal
222 DE-DF Reserved
224 E0 Keyboard LeftControl
225 E1 Keyboard LeftShift
226 E2 Keyboard LeftAlt
227 E3 Keyboard Left GUI
228 E4 Keyboard RightControl
229 E5 Keyboard RightShift
230 E6 Keyboard RightAlt
231 E7 Keyboard Right GUI

LED Usage Page(0x08)

Usage ID (Hex) Usage Name
00 Undefined
01 Num Lock
02 Caps Lock
03 Scroll Lock
04 Compose
05 Kana
06 Power
07 Shift
08 Do Not Disturb
09 Mute
0A Tone Enable
0B High Cut Filter
0C Low Cut Filter
0D Equalizer Enable
0E Sound Field On
0F Surround On
10 Repeat
11 Stereo
12 Sampling Rate Detect
13 Spinning
14 CAV
15 CLV
16 Recording Format Detect
17 Off-Hook
18 Ring
19 Message Waiting
1A Data Mode
1B Battery Operation
1C Battery OK
1D Battery Low
1E Speaker

Button Usage Page(0x09)

Usage ID (Hex) Usage Name
00 No button pressed
01 Button 1 (primary/trigger)
02 Button 2 (secondary)
03 Button 3 (tertiary)
04 Button 4 See Note

Consumer Usage Page(0x0C)

Usage ID (Hex) Usage Name
00 Unassigned
01 Consumer Control
02 Numeric Key Pad
03 Programmable Buttons
04 Microphone
05 Headphone
06 Graphic Equalizer
07-1F Reserved
20 +10
21 +100
22 AM/PM
23-3F Reserved
30 Power
31 Reset
32 Sleep
33 Sleep After
34 Sleep Mode
35 Illumination
36 Function Buttons
37-3F Reserved
40 Menu
41 Menu Pick
42 Menu Up
43 Menu Down
44 Menu Left
45 Menu Right
46 Menu Es
47 Menu Value Increase
48 Menu Value Decrease
49-5F Reserved
60 Data On Screen
61 Closed
STC8G驱动WS2812 前端JS使用Zip打包下载
biu biu biu
HID 报告描述详解 STC8G驱动WS2812 STC8G使用串口打印调试 记录一次单片机IO接线太长导致中断频发或死机问题的解决办法(长线通讯噪声抑制方法) js将字符串数字数组转换成uint8Array数组,用于mcu通讯指令。