1

我需要获取有关从不同鼠标单击和释放的 Wheell 的信息。我在嵌入式设备上工作,可以访问原始形式的所有数据 - 字节流。

AFAIK 所有传输的字节都在 HID 报告描述符鼠标中进行了描述。我有 HID 报告描述符和来自 2 个不同鼠标的传输帧,但我不确定如何理解它们:

HID 罗技:

Interface 0 HID Report Descriptor Mouse
Item Tag (Value) Raw Data 
Usage Page (Generic Desktop) 05 01  
Usage (Mouse) 09 02  
Collection (Application) A1 01  
    Usage (Pointer) 09 01  
    Collection (Physical) A1 00  
        Usage Page (Button) 05 09  
        Usage Minimum (Button 1) 19 01  
        Usage Maximum (Button 3) 29 03  
        Logical Minimum (0) 15 00  
        Logical Maximum (1) 25 01  
        Report Size (1) 75 01  
        Report Count (3) 95 03  
        Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02  
        Report Size (5) 75 05  
        Report Count (1) 95 01  
        Input (Cnst,Ary,Abs) 81 01  
        Usage Page (Generic Desktop) 05 01  
        Usage (X) 09 30  
        Usage (Y) 09 31  
        Usage (Wheel) 09 38  
        Logical Minimum (-127) 15 81  
        Logical Maximum (127) 25 7F  
        Report Size (8) 75 08  
        Report Count (3) 95 03  
        Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06  
    End Collection C0  
End Collection C0  

Logitech 帧 4 字节,首先用于按钮:

00 00 00 00 : Button OFF (on release), X=0, Y=0, Whell=0
01 00 00 00 : Button 1 ON, X=0, Y=0, Whell=0
02 00 00 00 : Button 2 ON, X=0, Y=0, Whell=0

隐藏雅科斯:

Interface 0 HID Report Descriptor Mouse
Item Tag (Value) Raw Data 
Usage Page (Generic Desktop) 05 01  
Usage (Mouse) 09 02  
Collection (Application) A1 01  
    Report ID (1) 85 01  
    Usage (Pointer) 09 01  
    Collection (Physical) A1 00  
        Usage Page (Button) 05 09  
        Usage Minimum (Button 1) 19 01  
        Usage Maximum (Button 3) 29 03  
        Logical Minimum (0) 15 00  
        Logical Maximum (1) 25 01  
        Report Count (3) 95 03  
        Report Size (1) 75 01  
        Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02  
        Report Count (1) 95 01  
        Report Size (5) 75 05  
        Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03  
        Usage Page (Generic Desktop) 05 01  
        Logical Minimum (-2047) 16 01 F8  
        Logical Maximum (2047) 26 FF 07  
        Report Size (12) 75 0C  
        Report Count (2) 95 02  
    Usage (X) 09 30  
    Usage (Y) 09 31  
    Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06  
    Logical Minimum (-127) 15 81  
    Logical Maximum (127) 25 7F  
    Report Size (8) 75 08  
    Report Count (1) 95 01  
    Usage (Wheel) 09 38  
    Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06  
    End Collection C0  
    Usage Page (Consumer Devices) 05 0C  
    Usage (AC Pan) 0A 38 02  
    Report Count (1) 95 01  
    Input (Data,Var,Rel,NWrp,Lin,Pref,NNul,Bit) 81 06  
End Collection C0  
Usage Page 06 F3 F1  
Usage 0A F3 F1  
Collection (Application) A1 01  
    Report ID (2) 85 02  
    Usage 09 00  
    Report Count (1) 95 01  
    Report Size (8) 75 08  
    Logical Minimum (0) 15 00  
    Logical Maximum (255) 26 FF 00  
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02  
End Collection C0  

YACOSS 帧 7 字节,按钮秒:

01 00 00 00 00 00 00 Button 1 OFF (released), X=0, Y=0, Wheel=0, AC Pan=0 
01 01 00 00 00 00 00 Button 1 ON , X=0, Y=0, Wheel=0, AC Pan=0 
01 02 00 00 00 00 00 Button 2 ON , X=0, Y=0, Wheel=0, AC Pan=0 
4

1 回答 1

2

报告描述符格式在 HID 的设备类定义中进行了说明。鼠标也包含在 HID 使用表文档中。所有这些都可以在 usb.org 的 HID 页面上找到 -> http://www.usb.org/developers/docs/hidpage/

我在这里写了关于嵌入式 HID 的博客,包括报告描述符 -> http://www.circuitsathome.com/category/mcu/arduino/usb-shield/hid

此外,如果您只需要鼠标的某些功能,例如 X、Y、滚轮和 3 个按钮,您可以将其初始化为启动设备。然后,任何鼠标都将具有相同的报告结构(请参阅启动鼠标),您可以将其硬编码到您的应用程序中。

于 2013-09-10T20:01:26.967 回答