Runtime descriptor parsing from hidapi #9
|
Hi, can I use this library to parse the report descriptor acquired from this hidapi librabry for Headset device https://github.com/libusb/hidapi/pull/451/files#diff-37a51f8fe6a77e89ab9694a39cf4e6c665cbdc96203d35ead0f55a9c37e0fc25 , is there any documentation for this library. thanks |
Replies: 3 comments
|
Yes you can! The Another reference for your implementation is If you provide more specific details on what information you want to gain out of the descriptor, I can guide you further. |
|
Hi, I want to parse the descriptor at run-time on desktop end to a readable format in c++ instad of raw bytes, for example like the javascript webhid object strucuture implemented by google https://wicg.github.io/webhid/#hidreportitem-dictionary, so that I clearly read and do some computation based on some fields |
|
For that the best starting point is here: hid-rp/hid-rp/hid/report_protocol.hpp Lines 180 to 234 in dc2c953 You need to replace the internal logic to push a new item to a vector of HID report items, filled with the information you get out of the passed parameters. The vector is a member variable of your custom parser, that's how it can be accessed reasonably in this virtual function. You get the boolean values out of the main_item parameter, the usages are collected by iterating through the main_section (see also the aforementioned get_application_usage_id), the rest are acquired from global_state.
|
For that the best starting point is here:
hid-rp/hid-rp/hid/report_protocol.hpp
Lines 180 to 234 in dc2c953