Search code examples
c++usbmousepcaphid

Get HID report Descriptor from .pcap file


I am building a C++ app on windows that should reinterpret USB data stream captured by Wireshark and USBPCap stored into a .pcap file. I am currently having trouble to get HID Report descriptor, so then i would be able to interpret data that mouse sends to the host.

The site USB Made Simple has been a great source of information so far, and i have also read a tons of tutorials how to write your own HID Report descriptor in order to understand them. But what i need is to retrieve one from current data flow.

According to wireshark, mouse is sending me a DEVICE DESCRIPTOR (example here), after that it sends CONFIGURATION DESCRIPTOR with its INTERFACE, HID and ENDPOINT DESCRIPTORS (example here).

According to value of wDescriptorLength in HID DESCRIPTOR, there should be HID REPORT DESCRIPTOR of length 56, but there is not. After this there is only ENDPOINT DESCRIPTOR of length 7 and another INTERFACE and HID DESCRIPTOR of total lenght 18.

Is there any way to get HID REPORT DESCRIPTOR from this or am I missing something out ?

Thank you for any input.


Solution

  • Is there any way to get HID REPORT DESCRIPTOR from this or am I missing something out ?

    Don't know about you but for me that looks like Wireshark/USBPCap is missing something. If you compare it with mine example it looks like entries with USBHID protocol are missing in your part.

    enter image description here

    Please check your Wireshark version or if you don't have enabled any filters in capture configuration.

    If you click 'gear' icon on the left side of USBPcap interface you can check your current settings:

    USBPcap settings

    Important note: Despite fact that "Inject already connected devices descriptors..." is checked it doesn't work for me like I would expect and to capture Report Descriptor you have to reconnect device: unplug USB-HID device -> Start capture -> Plug in USB device -> Now you can stop capture.