【发布时间】:2021-03-30 18:20:18
【问题描述】:
在一些 github 项目中,我看到 HID 键盘报告使用如下 Python 结构:
self.state = [
0xA1, # This is an input report
0x01, # Usage report = Keyboard
# Bit array for Modifier keys (D7 being the first element, D0 being last)
[0, # Right GUI - (usually the Windows key)
0, # Right ALT
0, # Right Shift
0, # Right Control
0, # Left GUI - (again, usually the Windows key)
0, # Left ALT
0, # Left Shift
0], # Left Control
0x00, # Vendor reserved
0x00, # Rest is space for 6 keys
0x00,
0x00,
0x00,
0x00,
0x00 ]
我对结构体中出现的前两个字节0xA1和0x01有些疑惑,因为剩下的就是带有键盘信息的数据。
HID 报告是否总是以 0xA1 开头?
如果第二个字节的值(0x01)表示“report usage = keyboard”,那么游戏手柄对应什么值?
感谢您的帮助。
【问题讨论】: