1
votes

I need to get information about Wheell clicked and released from different mouses. I work on embedded device and have access to all data in raw form - byte streams.

AFAIK all transferred bytes are described in HID Report Descriptor Mouse. I have both HID Report descriptor and transmitted frames from 2 different mouses, but I am not sure how to understand them:

HID Logitech:

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 frames 4bytes, first for buttons:

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

HID YACOSS:

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 frames 7bytes, second for button:

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 
1

1 Answers

2
votes

The report descriptor format is explained in Device Class definiton for HID. Mice are also covered in HID Usage tables doc. All this is available at usb.org on a HID page -> http://www.usb.org/developers/docs/hidpage/

I blog about embedded HID, including report descriptors, here -> http://www.circuitsathome.com/category/mcu/arduino/usb-shield/hid

Also, if you just need a certain functionality from a mouse, like X,Y, wheel and 3 buttons, you can initialize it as a boot device. Any mouse will then have the same report structure (see boot mouse) and you can hardcode it into your application.