"Get Input Report" 和 "Input report" 之间的 USB HID 区别

USB HID difference between "Get Input Report" and "Input report"

我正在实现具有以下接口的自定义 HID 设备:

0x06, 0xA0, 0xFF,  // Usage Page (Vendor Defined 0xFFA0)
0x09, 0x01,        // Usage (0x01)
0xA1, 0x01,        // Collection (Application)

0x85, 0x01,        //   Report ID (1)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0x01, 0x00,  //   Logical Maximum (1)
0x75, 0x08,        //   Report Size (8)
0x95, 0x01,        //   Report Count (1)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)

0x85, 0x01,        //   Report ID (1)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0x01, 0x00,  //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x02,        //   Report Count (2)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x06,        //   Report Size (6)
0x95, 0x01,        //   Report Count (1)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)

0x85, 0x03,        //   Report ID (1)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0xFF,  //   Logical Maximum (65535)
0x75, 0x10,        //   Report Size (16)
0x95, 0x01,        //   Report Count (1)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)

0xC0,              // End Collection

当我通过 USB 逻辑分析器将此设备插入计算机时,我看到它在枚举,然后某些东西(我不确定是什么,有什么想法吗?)使用 HID 报告描述符智能地获取一堆报告:

(control)(endpoint 0) Get Input Report[1]
(control)(endpoint 0) Get Feature Report[1]

“获取输入报告”条目让我感到困惑,因为我认为输入报告是通过中断传输发送的。如果我使用 usbhid 的 hid_write,我会看到以下条目,所以我必须至少对通过中断传输发送的输入报告的一半正确...:[=​​15=]

(interrupt)(endpoint 1) Input Report[1]"

我一直无法找到描述控制“获取输入报告”和中断“输入报告”传输之间差异的信息,我希望你们中的一位能知道。

为什么存在“获取输入报告”控件?

为什么不让规范强制要求每个“输入报告”id 条目都有一个“获取功能报告”条目?

为什么抓取每个定义的 input/feature 报告的 input/feature 报告对输入报告使用控制传输而不是中断传输?

看看USB HID v1.1。第 51 页上有 Get_Report 请求的定义:

This request is useful at initialization time for absolute items and for determining the state of feature items. This request is not intended to be used for polling the device state on a regular basis.

在这里,这正是驱动程序正在做的事情:它正在检索各种报告以初始化其当前状态。请注意,主机不能请求设备在其中断管道上发送报告。因此请求控制管道。

第 4.4 章解释了各种端点的用法。

另请注意,功能报告和输入报告不会处理相同的数据,即使它们具有相同的报告 ID(报告 ID 是每个报告类型)。