【发布时间】:2017-11-28 16:15:29
【问题描述】:
我有一个具有以下隐藏报告描述符的设备:
Collection (Logical) A1 02
Usage Page (Physical Input Device) 05
Usage (DC Enable Actuators) 09 97
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Size (4) 75 04
Report Count (1) 95 01
Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02
Logical Minimum (0) 15 00
Logical Maximum (0) 25 00
Output (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 03
Usage (Magnitude) 09 70
Logical Minimum (0) 15 00
Logical Maximum (100) 25 64
Report Size (8) 75 08
Report Count (4) 95 04
Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02
...
End Collection C0
因此,我认为设备需要以下方式的数据:
8 位:报告 ID,4 位:DC 启用执行器,4 位:填充,32 位:幅度
因此,我在 linux 中的驱动程序代码如下所示:
...
static const u8 buf[] = {0x03, 0b00010000, 0x00, 0x00, 0x60, 0x60, 10, 0x00, 10};
hid_hw_output_report(hid, buf, 9);
...
不幸的是,这不是设备所期望的! 事实上,它只有在数据结构如下时才会做出反应:
8 位:报告 ID,4 位:填充,4 位:DC 启用执行器,32 位:幅度
这是:
...
static const u8 buf[] = {0x03, 0b00000001, 0x00, 0x00, 0x60, 0x60, 10, 0x00, 10};
hid_hw_output_report(hid, buf, 9);
...
这意味着填充出现在 DC Enable Actuators 字段之前,而不是之后。
有谁明白这两个字段为什么会切换?
提前谢谢你!
【问题讨论】:
标签: c linux-kernel usb linux-device-driver hid