HID sensor HUB descriptor

Hello all.

I have a problem with an old project based on Due board.
I want to report multiple sensor with USB. For now I'm using native USB, but I need to write a "driver" to understand the data flow.

That's what I'm looking on the USB HID protocol...
I have read lots of documentation but now I'm lost.

For now, I'm just trying to send sensor data to the computer and I'm looking USB data with Wireshark.

What I want to made is reducing the size of the report descriptor.
Here is an example of what I want to make:

...
USAGE_PAGE ( Generic Desktop )
USAGE ( Sensor Zone )                   <= Logical Collection 0xC0 in Generic Desktop Page
COLLECTION ( Logical )
    LOGICAL_MIN ( -1 )
    LOGICAL_MAX ( 6000 )
    REPORT_SIZE ( 16 )

    REPORT_COUNT ( 1 )
    SENSOR Type ( RPM )                     <= Data Var 0xC1 in Generic Desktop Page
    INPUT ( Const_Var_Abs )

    REPORT_COUNT ( 1 )
    SENSOR Type ( RPM )
    INPUT ( Const_Var_Abs )

    REPORT_COUNT ( 1 )
    SENSOR Type ( RPM )
    INPUT ( Const_Var_Abs )
END_COLLECTION
...

It's OK, it work but ... it's really big and I have more than 3 to report !

When I test:

...
USAGE_PAGE ( Generic Desktop )
USAGE ( Sensor Zone )                   <= Logical Collection 0xC0 in Generic Desktop Page
COLLECTION ( Logical )
    LOGICAL_MIN ( -1 )
    LOGICAL_MAX ( 6000 )
    REPORT_SIZE ( 16 )

    REPORT_COUNT ( 3 )
    SENSOR Type ( RPM )                     <= Data Var 0xC1 in Generic Desktop Page
    INPUT ( Const_Var_Abs )
END_COLLECTION
...

Only the first report as the RPM usage, the other are padding. Normal, it's because Const_Var_Abs flag !

Another test:

...
USAGE_PAGE ( Generic Desktop )
USAGE ( Sensor Zone )                   <= Logical Collection 0xC0 in Generic Desktop Page
COLLECTION ( Logical )
    LOGICAL_MIN ( -1 )
    LOGICAL_MAX ( 6000 )
    REPORT_SIZE ( 16 )

    REPORT_COUNT ( 3 )
    SENSOR Type ( RPM )                     <= Data Var 0xC1 in Generic Desktop Page
    INPUT ( Const_Array_Abs )
END_COLLECTION
...

Now no padding, 3 report OK, but only the report with value = LOGICAL_MIN is RPM Usage.

How can I make to have all of my report have the same usage without having to declare them manually ?

May I ask why you use the Human Interface Device class it you control both sides of the communication? You can define your own class and write a driver for it on the PC side. That way you don't have to fight with the limitations of a device class that was designed for different task.

Hello.
I firstly make a try with a python code, but for my project I need something like a multi-os daemon for reporting data to the system and a GUI for controlling the device.
With HID all the in / out protocol is done by the OS and I just need to make the GUI.

I also try a "big" Vendor Specific HID report and it work, but I don't really like this.

Hello

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.