hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

Need API to get the HID Report Descriptor or a similar data structure

Open JoergAtGithub opened this issue 3 years ago • 132 comments

We need a function to read the HID Report Descriptor or an equal data structure with information about the fields in the different HID reports.

Background: For the cross platform Mixxx DJ software we need a solution, to allow the end user to map HID controller buttons, faders, knobs, RGB LEDs, etc. These are different on any DJ controller. Therefore this mapping it must be customizeable by end users. As input we need information about the field, e.g.: a 12 bit field at position n of Input report with ID0x02 with a logical minimum of -2048 and a maximum of +2047.

JoergAtGithub avatar Feb 26 '21 19:02 JoergAtGithub

Potentially helpful links: https://github.com/DIGImend/usbhid-dump https://github.com/DIGImend/hidrd Those are both licensed under the GPL, so they couldn't be used directly in hidapi unless the maintainers are willing to change the hidapi license. Nevertheless they could be useful examples to reference.

https://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/

Be-ing avatar Feb 26 '21 19:02 Be-ing

Go check: https://github.com/todbot/win-hid-dump https://github.com/todbot/mac-hid-dump

Youw avatar Feb 28 '21 11:02 Youw

Actually, it somewhat comes for free as the basic usage page and usage are extracted from the report descriptor which is read here:

https://github.com/libusb/hidapi/blob/0ea5e9502f31a1e4dbc71567c0f9a781930f1d38/libusb/hid.c#L644

In my eyes it'd make sense to directly store this descriptor either

  • by (optionally) allocating memory linked through a new field in struct hid_device_info (simpler) or
  • by postponing allocation of found device structs here until the size of the report descriptor is found, allocating the base size along with the descriptor size and appending an indefinite size field to struct hid_device_info (feels more elegant)

That said, it might be nice or meaningful to somehow incorporate this quite nice descriptor to string parser based on which I'm momentarily trying to make a generic parser to help extract meaningful values from given reports without having to know the report layout beforehand (primarily trying to make it work with my use cases, but for simple devices should be fine).

tschiemer avatar Mar 16 '21 18:03 tschiemer

Thanks for that info @tschiemer. I have not looked into what it would take to implement this. If you have a branch of hidapi you are working on, please open a pull request for this upstream repository and I'd be happy to test it with my Native Instruments Traktor Kontrol S4 Mk3.

Be-ing avatar Mar 16 '21 18:03 Be-ing

Ok, can see to it, but might take a moment

tschiemer avatar Mar 16 '21 18:03 tschiemer

Actually, it somewhat comes for free as the basic usage page and usage are extracted from the report descriptor

While this indeed already available and easy to get for libusb and hidraw backends, one of the first things about HIDAPI is being cross-platform.

I agree that this would be very useful, but Windows backend doesn't have an API to get a descriptor at all. The descriptor could be partially reconstructed, but still, it is not an easy task. I know one successfull attempt to reconstruct a HID descriptor using WinAPI calls, but that one is written on C# (https://github.com/todbot/win-hid-dump is using it). If someone could port it to C - I'd gladly introduce a new API (to get HID descriptor) for all platforms/backends.

Youw avatar Mar 16 '21 20:03 Youw

There's also the approach to use the generic WinUSB driver (comes with Win7 or newer) instead of Windows High-Level-HID-API: https://github.com/libusb/hidapi/issues/61#issuecomment-638397298 As far as I understood it, the WinUSB driver gives a userspace Windows program full access to an USB device, but locks it exclusive.

JoergAtGithub avatar Mar 16 '21 22:03 JoergAtGithub

gives a userspace Windows program full access to an USB device, but locks it exclusive

Yeah, and someone actually needs to make a driver for each specific device. And the problem not even with making a driver - a template inf file can be generated. But signing a driver properly - that requires some effort.

And you'd need to compile a libusb backend on Windows, which isn't compilable of-the-box yet.

Youw avatar Mar 16 '21 22:03 Youw

Ok, that doesn't sounds like what we're looking for.

JoergAtGithub avatar Mar 16 '21 22:03 JoergAtGithub

I think it could be a good idea to start with libusb or hidraw to figure out what the API should be then implement it for other backends.

Be-ing avatar Mar 17 '21 03:03 Be-ing

@Be-ing so not quite a hidapi branch, but as a proof of concept I implemented this puredata external to parse input reports based on the report descriptor, works for me on macos and a rpi4/linux with a joystick and mouse (see releases for binaries).

It's a bit of a mess as it uses libusb to find devices according to search criteria (more than hidapi provides out of the box, but meaningful in my opinion and based on hidapi-libusb internals) and reads/parses the report descriptor but relies on hidapi to actually receive input reports (and thus on linux the device listing is set to detach devices as in the hidapi driver..) - should have had a deeper look at hidapi's (or hidraw) interface before..

At the moment only the raw values as given in the input report are extracted without making use of any of the logical/physical min/max, unit, exponential etc values but adding that shouldn't be too big of a deal.. Could not test this with any feature/output reports or more complicated report descriptors, as I have neither the devices nor much more capacity.. The hid report parser just creates a datastructure that's more easy to handle but I would guess it won't work for all descriptors (collection items are somewhat ignored; note that the handling of output and feature items likely will need some fixing in the parser..). As external it "publishes" any changed values (usage page, usage, value), similar to the apple HIDIOManager value callbacks. I guess construction of output reports can be achieved by inverting the logic of the value extractor.

Maybe this is helpful in some form

tschiemer avatar Mar 22 '21 16:03 tschiemer

I agree that this would be very useful, but Windows backend doesn't have an API to get a descriptor at all. The descriptor could be partially reconstructed, but still, it is not an easy task. I know one successfull attempt to reconstruct a HID descriptor using WinAPI calls, but that one is written on C# (https://github.com/todbot/win-hid-dump is using it). If someone could port it to C - I'd gladly introduce a new API (to get HID descriptor) for all platforms/backends.

I implemented such a reconstructor in C and will start a Pull Request for HIDAPI soon. Stay tuned!

JoergAtGithub avatar Apr 06 '21 19:04 JoergAtGithub

I started PR #262 with a C implementation of the Windows Report-Descriptor code.

JoergAtGithub avatar Apr 10 '21 12:04 JoergAtGithub

I think libusb HID backend has already the codes to partially reconstruct the descriptors. Some from the USB HUB driver, some from the USB HID driver. But that may not be suitable for HIDAPI as it is also for bluetooth devices.

https://github.com/libusb/libusb/blob/master/libusb/os/windows_winusb.c#L3728 static int hid_open(int sub_api, struct libusb_device_handle *dev_handle)

While this indeed already available and easy to get for libusb and hidraw backends, one of the first things about HIDAPI is being cross-platform.

I agree that this would be very useful, but Windows backend doesn't have an API to get a descriptor at all. The descriptor could be partially reconstructed, but still, it is not an easy task. I know one successfull attempt to reconstruct a HID descriptor using WinAPI calls, but that one is written on C# (https://github.com/todbot/win-hid-dump is using it). If someone could port it to C - I'd gladly introduce a new API (to get HID descriptor) for all platforms/backends.

mcuee avatar Jun 13 '21 04:06 mcuee

FYI I have just tested win-hid-dump. It seems I got some problems with it. https://github.com/todbot/win-hid-dump/issues/2

mcuee avatar Jun 17 '21 07:06 mcuee

But HIDSharp seems to work (not checking the contents). I have a long list of HID device in the system (Windows 10, Dell Laptop with a docking station). Edit to add: it is not stable for my system and the output does not seem to be correct, at least for my Microchip PICKit 2).

click to expand
/c/work/hid/HidSharp
$ ./bin/HidSharp.Test.exe
All device list:
(unnamed manufacturer) (unnamed product) (no serial number) (VID 32903, PID 2590, version 2.0) @ \\?\hid#intc816&col01#3&36a7043c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13) @ \\?\hid#dell091a&col01#5&99b72d3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13) @ \\?\hid#dell091a&col02#5&99b72d3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1) @ \\?\hid#vid_046d&pid_c534&mi_01&col03#7&1ebb799e&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
   (VID 1102, PID 4626, version 0.0) @ \\?\hid#vid_044e&pid_1212&col01&col02#7&290aacae&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1) @ \\?\hid#vid_046d&pid_c534&mi_01&col04#7&1ebb799e&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
Plantronics Plantronics Blackwire 3220 Series D1CEC32927974D5F9BD6B2AEBF2EA8E3 (VID 1151, PID 49238, version 2.10) @ \\?\hid#vid_047f&pid_c056&mi_03&col01#f&39e6f119&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1) @ \\?\hid#vid_046d&pid_c534&mi_01&col05#7&1ebb799e&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 1118, PID 0, version 0.0) @ \\?\hid#converteddevice&col02#5&379854aa&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 32903, PID 2590, version 2.0) @ \\?\hid#intc816&col02#3&36a7043c&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
   (VID 1102, PID 4626, version 0.0) @ \\?\hid#vid_044e&pid_1212&col01&col01#7&290aacae&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Optical Mouse (no serial number) (VID 1133, PID 49271, version 72.0) @ \\?\hid#vid_046d&pid_c077#e&113cd935&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Plantronics Plantronics Blackwire 3220 Series D1CEC32927974D5F9BD6B2AEBF2EA8E3 (VID 1151, PID 49238, version 2.10) @ \\?\hid#vid_047f&pid_c056&mi_03&col03#f&39e6f119&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13) @ \\?\hid#dell091a&col04#5&99b72d3&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 1118, PID 0, version 0.0) @ \\?\hid#converteddevice&col03#5&379854aa&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
DELL Dell USB Entry Keyboard (no serial number) (VID 16700, PID 8455, version 1.78) @ \\?\hid#vid_413c&pid_2107#e&11005b8d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13) @ \\?\hid#dell091a&col05#5&99b72d3&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1) @ \\?\hid#vid_046d&pid_c534&mi_01&col01#7&1ebb799e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Plantronics Plantronics Blackwire 3220 Series D1CEC32927974D5F9BD6B2AEBF2EA8E3 (VID 1151, PID 49238, version 2.10) @ \\?\hid#vid_047f&pid_c056&mi_03&col02#f&39e6f119&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 1118, PID 0, version 0.0) @ \\?\hid#converteddevice&col01#5&379854aa&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1) @ \\?\hid#vid_046d&pid_c534&mi_01&col02#7&1ebb799e&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1) @ \\?\hid#vid_046d&pid_c534&mi_00#7&51bc424&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13) @ \\?\hid#dell091a&col03#5&99b72d3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer)  (no serial number) (VID 16700, PID 45166, version 1.1) @ \\?\hid#vid_413c&pid_b06e#c&37ff1248&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microchip Technology Inc. Simple HID Device Demo (no serial number) (VID 1240, PID 63, version 0.2) @ \\?\hid#vid_04d8&pid_003f#e&24ba9f4d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer)  (no serial number) (VID 16700, PID 45167, version 1.1) @ \\?\hid#vid_413c&pid_b06f#d&3624b04c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
COM3 (\\.\COM3) @ \\.\COM3
BLE device list:

Press any key

Complete device list (took 0 ms to get 26 devices):
\\?\hid#intc816&col01#3&36a7043c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 32903, PID 2590, version 2.0)
Max Lengths: Input 2, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 0C A1 01 85 08 09 C6 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 06 95 07 81 03 C1 00 (34 bytes)
  UsagePage 1
  Usage 12
  Collection 1
    ReportID 8
    Usage 198
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 6
    ReportCount 7
    Input 3
  EndCollection 0
Usage: 1000C 65548
Input: ReportID=8, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: 100C6 65734
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#dell091a&col01#5&99b72d3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13)
Max Lengths: Input 6, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 02 A1 01 85 01 09 01 A1 00 05 09 19 01 29 03 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 03 81 02 95 05 81 03 05 01 09 30 25 7F 45 00 75 08 95 01 81 06 09 31 81 06 09 38 81 06 05 0C 0A 38 02 81 06 C1 00 C1 00 (73 bytes)
  UsagePage 1
  Usage 2
  Collection 1
    ReportID 1
    Usage 1
    Collection 0
      UsagePage 9
      UsageMinimum 1
      UsageMaximum 3
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 3
      Input 2
      ReportCount 5
      Input 3
      UsagePage 1
      Usage 48
      LogicalMaximum 127
      PhysicalMaximum 0
      ReportSize 8
      ReportCount 1
      Input 6
      Usage 49
      Input 6
      Usage 56
      Input 6
      UsagePage 12
      Usage 568
      Input 6
    EndCollection 0
  EndCollection 0
Usage: 10002 GenericDesktopMouse
Input: ReportID=1, Length=6, Items=6
  3 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 90001 Button1, 90002 Button2, 90003 Button3
  5 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10030 GenericDesktopX
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10031 GenericDesktopY
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10038 GenericDesktopWheel
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: C0238 787000
Opening device for 20 seconds...
Failed to open device.


\\?\hid#dell091a&col02#5&99b72d3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13)
Max Lengths: Input 10, Output 0, Feature 257
Serial Ports:
Report Descriptor:
  05 0D 09 05 A1 01 85 08 09 22 A1 02 09 47 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 02 09 42 81 02 09 51 25 05 45 00 75 03 81 02 25 01 45 01 75 01 95 03 81 03 05 01 09 30 26 AF 04 46 E8 03 65 11 55 0E 75 10 95 01 81 02 09 31 26 7B 02 46 12 02 81 02 C1 00 05 0D 09 56 26 FF FF 46 FF FF 66 01 10 55 0C 81 02 09 54 25 05 75 08 81 02 05 09 09 02 25 01 45 01 65 00 55 00 75 01 81 02 09 03 81 02 95 06 81 03 85 09 05 0D 09 55 25 05 46 FF FF 66 01 10 55 0C 75 08 95 01 B1 02 25 01 45 01 65 00 55 00 75 01 96 F8 07 B1 03 85 0A 06 00 FF 09 C5 25 FF 46 FF FF 66 01 10 55 0C 75 08 96 00 01 B1 02 C1 00 (200 bytes)
  UsagePage 13
  Usage 5
  Collection 1
    ReportID 8
    Usage 34
    Collection 2
      Usage 71
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 1
      Input 2
      Usage 66
      Input 2
      Usage 81
      LogicalMaximum 5
      PhysicalMaximum 0
      ReportSize 3
      Input 2
      LogicalMaximum 1
      PhysicalMaximum 1
      ReportSize 1
      ReportCount 3
      Input 3
      UsagePage 1
      Usage 48
      LogicalMaximum 1199
      PhysicalMaximum 1000
      Unit 17
      UnitExponent 14
      ReportSize 16
      ReportCount 1
      Input 2
      Usage 49
      LogicalMaximum 635
      PhysicalMaximum 530
      Input 2
    EndCollection 0
    UsagePage 13
    Usage 86
    LogicalMaximum 65535
    PhysicalMaximum 65535
    Unit 4097
    UnitExponent 12
    Input 2
    Usage 84
    LogicalMaximum 5
    ReportSize 8
    Input 2
    UsagePage 9
    Usage 2
    LogicalMaximum 1
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    Input 2
    Usage 3
    Input 2
    ReportCount 6
    Input 3
    ReportID 9
    UsagePage 13
    Usage 85
    LogicalMaximum 5
    PhysicalMaximum 65535
    Unit 4097
    UnitExponent 12
    ReportSize 8
    ReportCount 1
    Feature 2
    LogicalMaximum 1
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 2040
    Feature 3
    ReportID 10
    UsagePage 65280
    Usage 197
    LogicalMaximum 255
    PhysicalMaximum 65535
    Unit 4097
    UnitExponent 12
    ReportSize 8
    ReportCount 256
    Feature 2
  EndCollection 0
Usage: D0005 851973
Input: ReportID=8, Length=10, Items=11
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: D0047 852039
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: D0042 852034
  1 Elements x 3 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: D0051 852049
  3 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
  1 Elements x 16 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: 10030 GenericDesktopX
  1 Elements x 16 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: 10031 GenericDesktopY
  1 Elements x 16 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: D0056 852054
  1 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: D0054 852052
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 90002 Button2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 90003 Button3
  6 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Feature: ReportID=9, Length=257, Items=2
  1 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: D0055 852053
  2040 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Feature: ReportID=10, Length=257, Items=1
  256 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: FF0000C5 4278190277
Opening device for 20 seconds...
Failed to open device.


\\?\hid#vid_046d&pid_c534&mi_01&col03#7&1ebb799e&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1)
Max Lengths: Input 2, Output 0, Feature 0
Serial Ports:
System.NotSupportedException: Unable to reconstruct the report descriptor.
   at HidSharp.Platform.Windows.WinHidDevice.GetRawReportDescriptor() in C:\work\libusb\HidSharp\HidSharp\Platform\Windows\WinHidDevice.cs:line 195
   at HidSharp.Test.Program.Main(String[] args) in C:\work\libusb\HidSharp\HidSharp.Test\Program.cs:line 249
\\?\hid#vid_044e&pid_1212&col01&col02#7&290aacae&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
   (VID 1102, PID 4626, version 0.0)
Max Lengths: Input 9, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 06 A1 01 85 07 05 07 19 E0 29 E7 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 08 81 02 95 38 81 03 C1 00 (38 bytes)
  UsagePage 1
  Usage 6
  Collection 1
    ReportID 7
    UsagePage 7
    UsageMinimum 224
    UsageMaximum 231
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 8
    Input 2
    ReportCount 56
    Input 3
  EndCollection 0
Usage: 10006 GenericDesktopKeyboard
Input: ReportID=7, Length=9, Items=2
  8 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 700E0 KeyboardLeftControl, 700E1 KeyboardLeftShift, 700E2 KeyboardLeftAlt, 700E3 KeyboardLeftGUI, 700E4 KeyboardRightControl, 700E5 KeyboardRightShift, 700E6 KeyboardRightAlt, 700E7 KeyboardRightGUI
  56 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Failed to open device.


\\?\hid#vid_046d&pid_c534&mi_01&col04#7&1ebb799e&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1)
Max Lengths: Input 7, Output 7, Feature 0
Serial Ports:
Report Descriptor:
  06 00 FF 09 01 A1 01 85 10 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 30 81 03 91 03 C1 00 (31 bytes)
  UsagePage 65280
  Usage 1
  Collection 1
    ReportID 16
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 48
    Input 3
    Output 3
  EndCollection 0
Usage: FF000001 4278190081
Input: ReportID=16, Length=7, Items=1
  48 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=16, Length=7, Items=1
  48 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_047f&pid_c056&mi_03&col01#f&39e6f119&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Plantronics Plantronics Blackwire 3220 Series D1CEC32927974D5F9BD6B2AEBF2EA8E3 (VID 1151, PID 49238, version 2.10)
Max Lengths: Input 33, Output 37, Feature 0
Serial Ports:
Report Descriptor:
  05 0C 09 01 A1 01 85 01 09 E9 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 06 09 EA 81 06 95 FE 81 03 85 02 96 00 01 81 03 85 05 09 00 45 00 75 08 95 20 81 02 85 07 09 00 81 02 85 04 09 00 95 24 91 02 85 06 09 00 91 02 C1 00 (77 bytes)
  UsagePage 12
  Usage 1
  Collection 1
    ReportID 1
    Usage 233
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 6
    Usage 234
    Input 6
    ReportCount 254
    Input 3
    ReportID 2
    ReportCount 256
    Input 3
    ReportID 5
    Usage 0
    PhysicalMaximum 0
    ReportSize 8
    ReportCount 32
    Input 2
    ReportID 7
    Usage 0
    Input 2
    ReportID 4
    Usage 0
    ReportCount 36
    Output 2
    ReportID 6
    Usage 0
    Output 2
  EndCollection 0
Usage: C0001 ConsumerConsumerControl
Input: ReportID=1, Length=33, Items=3
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: C00E9 ConsumerVolumeIncrement
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: C00EA ConsumerVolumeDecrement
  254 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Input: ReportID=2, Length=33, Items=1
  256 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Input: ReportID=5, Length=33, Items=1
  32 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: C0000 786432
Input: ReportID=7, Length=33, Items=1
  32 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: C0000 786432
Output: ReportID=4, Length=37, Items=1
  36 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: C0000 786432
Output: ReportID=6, Length=37, Items=1
  36 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: C0000 786432
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_046d&pid_c534&mi_01&col05#7&1ebb799e&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1)
Max Lengths: Input 20, Output 20, Feature 0
Serial Ports:
Report Descriptor:
  06 00 FF 09 02 A1 01 85 11 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 98 81 03 91 03 C1 00 (31 bytes)
  UsagePage 65280
  Usage 2
  Collection 1
    ReportID 17
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 152
    Input 3
    Output 3
  EndCollection 0
Usage: FF000002 4278190082
Input: ReportID=17, Length=20, Items=1
  152 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=17, Length=20, Items=1
  152 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#converteddevice&col02#5&379854aa&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 1118, PID 0, version 0.0)
Max Lengths: Input 2, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 0C 09 01 A1 01 85 02 09 E9 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 02 09 EA 81 02 0A 21 02 81 02 95 05 81 03 C1 00 (43 bytes)
  UsagePage 12
  Usage 1
  Collection 1
    ReportID 2
    Usage 233
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 2
    Usage 234
    Input 2
    Usage 545
    Input 2
    ReportCount 5
    Input 3
  EndCollection 0
Usage: C0001 ConsumerConsumerControl
Input: ReportID=2, Length=2, Items=4
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: C00E9 ConsumerVolumeIncrement
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: C00EA ConsumerVolumeDecrement
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: C0221 786977
  5 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#intc816&col02#3&36a7043c&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 32903, PID 2590, version 2.0)
Max Lengths: Input 2, Output 0, Feature 2
Serial Ports:
Report Descriptor:
  05 01 09 0D A1 01 85 1C 09 0D A1 02 09 81 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 02 95 07 81 03 09 CB 95 01 B1 02 95 07 B1 03 C1 00 C1 00 (50 bytes)
  UsagePage 1
  Usage 13
  Collection 1
    ReportID 28
    Usage 13
    Collection 2
      Usage 129
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 1
      Input 2
      ReportCount 7
      Input 3
      Usage 203
      ReportCount 1
      Feature 2
      ReportCount 7
      Feature 3
    EndCollection 0
  EndCollection 0
Usage: 1000D 65549
Input: ReportID=28, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 10081 65665
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Feature: ReportID=28, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 100CB 65739
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_044e&pid_1212&col01&col01#7&290aacae&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
   (VID 1102, PID 4626, version 0.0)
Max Lengths: Input 6, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 02 A1 01 85 06 09 01 A1 00 05 09 19 01 29 03 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 03 81 02 95 05 81 03 05 01 09 30 26 00 02 45 00 75 10 95 01 81 06 09 31 81 06 C1 00 C1 00 (63 bytes)
  UsagePage 1
  Usage 2
  Collection 1
    ReportID 6
    Usage 1
    Collection 0
      UsagePage 9
      UsageMinimum 1
      UsageMaximum 3
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 3
      Input 2
      ReportCount 5
      Input 3
      UsagePage 1
      Usage 48
      LogicalMaximum 512
      PhysicalMaximum 0
      ReportSize 16
      ReportCount 1
      Input 6
      Usage 49
      Input 6
    EndCollection 0
  EndCollection 0
Usage: 10002 GenericDesktopMouse
Input: ReportID=6, Length=6, Items=4
  3 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 90001 Button1, 90002 Button2, 90003 Button3
  5 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
  1 Elements x 16 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10030 GenericDesktopX
  1 Elements x 16 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10031 GenericDesktopY
Opening device for 20 seconds...
Failed to open device.


\\?\hid#vid_046d&pid_c077#e&113cd935&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Optical Mouse (no serial number) (VID 1133, PID 49271, version 72.0)
Max Lengths: Input 5, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 02 A1 01 09 01 A1 00 05 09 19 01 29 03 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 03 81 02 95 05 81 03 05 01 09 30 25 7F 45 00 75 08 95 01 81 06 09 31 81 06 09 38 81 06 C1 00 C1 00 (64 bytes)
  UsagePage 1
  Usage 2
  Collection 1
    Usage 1
    Collection 0
      UsagePage 9
      UsageMinimum 1
      UsageMaximum 3
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 3
      Input 2
      ReportCount 5
      Input 3
      UsagePage 1
      Usage 48
      LogicalMaximum 127
      PhysicalMaximum 0
      ReportSize 8
      ReportCount 1
      Input 6
      Usage 49
      Input 6
      Usage 56
      Input 6
    EndCollection 0
  EndCollection 0
Usage: 10002 GenericDesktopMouse
Input: ReportID=0, Length=5, Items=5
  3 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 90001 Button1, 90002 Button2, 90003 Button3
  5 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10030 GenericDesktopX
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10031 GenericDesktopY
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10038 GenericDesktopWheel
Opening device for 20 seconds...
Failed to open device.


\\?\hid#vid_047f&pid_c056&mi_03&col03#f&39e6f119&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
Plantronics Plantronics Blackwire 3220 Series D1CEC32927974D5F9BD6B2AEBF2EA8E3 (VID 1151, PID 49238, version 2.10)
Max Lengths: Input 33, Output 33, Feature 3
Serial Ports:
Report Descriptor:
  06 A0 FF 09 03 A1 01 85 14 09 B1 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 06 09 B2 81 06 09 B5 81 06 09 B7 81 06 09 B3 81 06 95 FB 81 03 85 1F 09 9C 95 01 81 06 95 FF 81 03 85 03 09 30 45 00 75 08 95 20 81 02 85 15 09 8C 26 FF FF 75 10 95 01 81 22 25 01 45 01 75 01 95 F0 81 03 85 19 09 8D 95 01 91 22 09 8F 91 22 09 9E 91 22 09 DC 91 22 09 D2 91 06 09 D9 91 06 95 FA 91 03 85 1A 09 B5 95 01 91 22 95 FF 91 03 85 03 09 30 45 00 75 08 95 20 91 02 85 1B 09 CF 45 01 75 01 95 01 B1 22 09 B5 B1 22 09 DE B1 23 09 D8 B1 22 95 04 B1 03 09 09 95 01 B1 22 09 17 B1 22 09 18 B1 22 09 1E B1 22 09 20 B1 22 09 2A B1 22 95 02 B1 03 C1 00 (212 bytes)
  UsagePage 65440
  Usage 3
  Collection 1
    ReportID 20
    Usage 177
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 6
    Usage 178
    Input 6
    Usage 181
    Input 6
    Usage 183
    Input 6
    Usage 179
    Input 6
    ReportCount 251
    Input 3
    ReportID 31
    Usage 156
    ReportCount 1
    Input 6
    ReportCount 255
    Input 3
    ReportID 3
    Usage 48
    PhysicalMaximum 0
    ReportSize 8
    ReportCount 32
    Input 2
    ReportID 21
    Usage 140
    LogicalMaximum 65535
    ReportSize 16
    ReportCount 1
    Input 34
    LogicalMaximum 1
    PhysicalMaximum 1
    ReportSize 1
    ReportCount 240
    Input 3
    ReportID 25
    Usage 141
    ReportCount 1
    Output 34
    Usage 143
    Output 34
    Usage 158
    Output 34
    Usage 220
    Output 34
    Usage 210
    Output 6
    Usage 217
    Output 6
    ReportCount 250
    Output 3
    ReportID 26
    Usage 181
    ReportCount 1
    Output 34
    ReportCount 255
    Output 3
    ReportID 3
    Usage 48
    PhysicalMaximum 0
    ReportSize 8
    ReportCount 32
    Output 2
    ReportID 27
    Usage 207
    PhysicalMaximum 1
    ReportSize 1
    ReportCount 1
    Feature 34
    Usage 181
    Feature 34
    Usage 222
    Feature 35
    Usage 216
    Feature 34
    ReportCount 4
    Feature 3
    Usage 9
    ReportCount 1
    Feature 34
    Usage 23
    Feature 34
    Usage 24
    Feature 34
    Usage 30
    Feature 34
    Usage 32
    Feature 34
    Usage 42
    Feature 34
    ReportCount 2
    Feature 3
  EndCollection 0
Usage: FFA00003 4288675843
Input: ReportID=20, Length=33, Items=6
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000B1 4288676017
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000B2 4288676018
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000B5 4288676021
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000B7 4288676023
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000B3 4288676019
  251 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Input: ReportID=31, Length=33, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA0009C 4288675996
  255 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Input: ReportID=3, Length=33, Items=1
  32 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: FFA00030 4288675888
Input: ReportID=21, Length=33, Items=2
  1 Elements x 16 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, NoPreferred, Usages: FFA0008C 4288675980
  240 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=25, Length=33, Items=7
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA0008D 4288675981
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA0008F 4288675983
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA0009E 4288675998
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA000DC 4288676060
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000D2 4288676050
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: FFA000D9 4288676057
  250 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=26, Length=33, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA000B5 4288676021
  255 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=3, Length=33, Items=1
  32 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: FFA00030 4288675888
Feature: ReportID=27, Length=3, Items=12
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA000CF 4288676047
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA000B5 4288676021
  1 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, NoPreferred, Usages: FFA000DE 4288676062
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA000D8 4288676056
  4 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA00009 4288675849
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA00017 4288675863
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA00018 4288675864
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA0001E 4288675870
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA00020 4288675872
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: FFA0002A 4288675882
  2 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#dell091a&col04#5&99b72d3&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13)
Max Lengths: Input 0, Output 0, Feature 135
Serial Ports:
Report Descriptor:
  06 02 FF 09 01 A1 01 85 07 09 02 15 00 25 FF 35 00 46 FF FF 66 01 10 55 0C 75 08 95 86 B1 02 C1 00 (33 bytes)
  UsagePage 65282
  Usage 1
  Collection 1
    ReportID 7
    Usage 2
    LogicalMinimum 0
    LogicalMaximum 255
    PhysicalMinimum 0
    PhysicalMaximum 65535
    Unit 4097
    UnitExponent 12
    ReportSize 8
    ReportCount 134
    Feature 2
  EndCollection 0
Usage: FF020001 4278321153
Feature: ReportID=7, Length=135, Items=1
  134 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: FF020002 4278321154
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#converteddevice&col03#5&379854aa&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer) (unnamed product) (no serial number) (VID 1118, PID 0, version 0.0)
Max Lengths: Input 2, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 80 A1 01 85 03 09 81 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 02 95 07 81 03 C1 00 (34 bytes)
  UsagePage 1
  Usage 128
  Collection 1
    ReportID 3
    Usage 129
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 2
    ReportCount 7
    Input 3
  EndCollection 0
Usage: 10080 GenericDesktopSystemControl
Input: ReportID=3, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 10081 65665
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_413c&pid_2107#e&11005b8d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
DELL Dell USB Entry Keyboard (no serial number) (VID 16700, PID 8455, version 1.78)
Max Lengths: Input 9, Output 2, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 08 81 02 95 38 81 03 05 08 19 01 29 03 95 03 91 02 95 05 91 03 C1 00 (50 bytes)
  UsagePage 1
  Usage 6
  Collection 1
    UsagePage 7
    UsageMinimum 224
    UsageMaximum 231
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 8
    Input 2
    ReportCount 56
    Input 3
    UsagePage 8
    UsageMinimum 1
    UsageMaximum 3
    ReportCount 3
    Output 2
    ReportCount 5
    Output 3
  EndCollection 0
Usage: 10006 GenericDesktopKeyboard
Input: ReportID=0, Length=9, Items=2
  8 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 700E0 KeyboardLeftControl, 700E1 KeyboardLeftShift, 700E2 KeyboardLeftAlt, 700E3 KeyboardLeftGUI, 700E4 KeyboardRightControl, 700E5 KeyboardRightShift, 700E6 KeyboardRightAlt, 700E7 KeyboardRightGUI
  56 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=0, Length=2, Items=2
  3 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 80001 LedNumLock, 80002 LedCapsLock, 80003 LedScrollLock
  5 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Failed to open device.


\\?\hid#dell091a&col05#5&99b72d3&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13)
Max Lengths: Input 0, Output 0, Feature 2
Serial Ports:
Report Descriptor:
  05 0D 09 0E A1 01 85 0C 09 22 A1 00 09 57 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 B1 02 09 58 B1 02 95 06 B1 03 85 0B C1 00 09 22 A1 02 09 52 25 0A 46 FF FF 66 01 10 55 0C 75 08 95 01 B1 02 C1 00 C1 00 (70 bytes)
  UsagePage 13
  Usage 14
  Collection 1
    ReportID 12
    Usage 34
    Collection 0
      Usage 87
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 1
      Feature 2
      Usage 88
      Feature 2
      ReportCount 6
      Feature 3
      ReportID 11
    EndCollection 0
    Usage 34
    Collection 2
      Usage 82
      LogicalMaximum 10
      PhysicalMaximum 65535
      Unit 4097
      UnitExponent 12
      ReportSize 8
      ReportCount 1
      Feature 2
    EndCollection 0
  EndCollection 0
Usage: D000E 851982
Feature: ReportID=12, Length=2, Items=3
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: D0057 852055
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: D0058 852056
  6 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Feature: ReportID=11, Length=2, Items=1
  1 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: D0052 852050
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_046d&pid_c534&mi_01&col01#7&1ebb799e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1)
Max Lengths: Input 8, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 02 A1 01 85 02 09 01 A1 00 05 09 19 01 29 10 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 10 81 02 05 01 09 30 26 FF 07 45 00 75 0C 95 01 81 06 09 31 81 06 09 38 25 7F 75 08 81 06 05 0C 0A 38 02 81 06 C1 00 C1 00 (74 bytes)
  UsagePage 1
  Usage 2
  Collection 1
    ReportID 2
    Usage 1
    Collection 0
      UsagePage 9
      UsageMinimum 1
      UsageMaximum 16
      LogicalMinimum 0
      LogicalMaximum 1
      PhysicalMinimum 0
      PhysicalMaximum 1
      Unit 0
      UnitExponent 0
      ReportSize 1
      ReportCount 16
      Input 2
      UsagePage 1
      Usage 48
      LogicalMaximum 2047
      PhysicalMaximum 0
      ReportSize 12
      ReportCount 1
      Input 6
      Usage 49
      Input 6
      Usage 56
      LogicalMaximum 127
      ReportSize 8
      Input 6
      UsagePage 12
      Usage 568
      Input 6
    EndCollection 0
  EndCollection 0
Usage: 10002 GenericDesktopMouse
Input: ReportID=2, Length=8, Items=5
  16 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 90001 Button1, 90002 Button2, 90003 Button3, 90004 Button4, 90005 Button5, 90006 Button6, 90007 Button7, 90008 Button8, 90009 Button9, 9000A Button10, 9000B Button11, 9000C Button12, 9000D Button13, 9000E Button14, 9000F Button15, 90010 Button16
  1 Elements x 12 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10030 GenericDesktopX
  1 Elements x 12 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10031 GenericDesktopY
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: 10038 GenericDesktopWheel
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Relative, Usages: C0238 787000
Opening device for 20 seconds...
Failed to open device.


\\?\hid#vid_047f&pid_c056&mi_03&col02#f&39e6f119&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
Plantronics Plantronics Blackwire 3220 Series D1CEC32927974D5F9BD6B2AEBF2EA8E3 (VID 1151, PID 49238, version 2.10)
Max Lengths: Input 2, Output 2, Feature 0
Serial Ports:
Report Descriptor:
  05 0B 09 05 A1 01 85 08 09 2F 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 06 09 20 81 22 09 21 81 22 95 05 81 03 85 09 05 08 09 09 95 01 91 22 95 07 91 03 85 17 09 17 95 01 91 22 95 07 91 03 85 18 09 18 95 01 91 22 95 07 91 03 85 1E 09 1E 95 01 91 22 95 07 91 03 85 20 09 20 95 01 91 22 95 07 91 03 85 2A 09 2A 95 01 91 22 95 07 91 03 C1 00 (116 bytes)
  UsagePage 11
  Usage 5
  Collection 1
    ReportID 8
    Usage 47
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 6
    Usage 32
    Input 34
    Usage 33
    Input 34
    ReportCount 5
    Input 3
    ReportID 9
    UsagePage 8
    Usage 9
    ReportCount 1
    Output 34
    ReportCount 7
    Output 3
    ReportID 23
    Usage 23
    ReportCount 1
    Output 34
    ReportCount 7
    Output 3
    ReportID 24
    Usage 24
    ReportCount 1
    Output 34
    ReportCount 7
    Output 3
    ReportID 30
    Usage 30
    ReportCount 1
    Output 34
    ReportCount 7
    Output 3
    ReportID 32
    Usage 32
    ReportCount 1
    Output 34
    ReportCount 7
    Output 3
    ReportID 42
    Usage 42
    ReportCount 1
    Output 34
    ReportCount 7
    Output 3
  EndCollection 0
Usage: B0005 720901
Input: ReportID=8, Length=2, Items=4
  1 Elements x 1 Bits, Units: None, Expected Usage Type: OneShot, Flags: Variable, Relative, Usages: B002F 720943
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: B0020 720928
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: B0021 720929
  5 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=9, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: 80009 524297
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=23, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: 80017 524311
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=24, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: 80018 524312
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=30, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: 8001E 524318
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=32, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: 80020 524320
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=42, Length=2, Items=2
  1 Elements x 1 Bits, Units: None, Expected Usage Type: ToggleButton, Flags: Variable, NoPreferred, Usages: 8002A 524330
  7 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#converteddevice&col01#5&379854aa&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
(unnamed manufacturer) (unnamed product) (no serial number) (VID 1118, PID 0, version 0.0)
Max Lengths: Input 2, Output 0, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 06 A1 01 85 01 05 07 09 69 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 01 81 02 09 6A 81 02 09 6B 81 02 09 6C 81 02 09 E3 81 02 09 4C 81 02 09 E2 81 02 09 E0 81 02 C1 00 (60 bytes)
  UsagePage 1
  Usage 6
  Collection 1
    ReportID 1
    UsagePage 7
    Usage 105
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 1
    Input 2
    Usage 106
    Input 2
    Usage 107
    Input 2
    Usage 108
    Input 2
    Usage 227
    Input 2
    Usage 76
    Input 2
    Usage 226
    Input 2
    Usage 224
    Input 2
  EndCollection 0
Usage: 10006 GenericDesktopKeyboard
Input: ReportID=1, Length=2, Items=8
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 70069 458857
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 7006A 458858
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 7006B 458859
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 7006C 458860
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 700E3 KeyboardLeftGUI
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 7004C KeyboardDelete
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 700E2 KeyboardLeftAlt
  1 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 700E0 KeyboardLeftControl
Opening device for 20 seconds...
Failed to open device.


\\?\hid#vid_046d&pid_c534&mi_01&col02#7&1ebb799e&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1)
Max Lengths: Input 5, Output 0, Feature 0
Serial Ports:
System.NotSupportedException: Unable to reconstruct the report descriptor.
   at HidSharp.Platform.Windows.WinHidDevice.GetRawReportDescriptor() in C:\work\libusb\HidSharp\HidSharp\Platform\Windows\WinHidDevice.cs:line 195
   at HidSharp.Test.Program.Main(String[] args) in C:\work\libusb\HidSharp\HidSharp.Test\Program.cs:line 249
\\?\hid#vid_046d&pid_c534&mi_00#7&51bc424&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Logitech USB Receiver (no serial number) (VID 1133, PID 50484, version 29.1)
Max Lengths: Input 9, Output 2, Feature 0
Serial Ports:
Report Descriptor:
  05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 08 81 02 95 38 81 03 05 08 19 01 29 05 95 05 91 02 95 03 91 03 C1 00 (50 bytes)
  UsagePage 1
  Usage 6
  Collection 1
    UsagePage 7
    UsageMinimum 224
    UsageMaximum 231
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 8
    Input 2
    ReportCount 56
    Input 3
    UsagePage 8
    UsageMinimum 1
    UsageMaximum 5
    ReportCount 5
    Output 2
    ReportCount 3
    Output 3
  EndCollection 0
Usage: 10006 GenericDesktopKeyboard
Input: ReportID=0, Length=9, Items=2
  8 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 700E0 KeyboardLeftControl, 700E1 KeyboardLeftShift, 700E2 KeyboardLeftAlt, 700E3 KeyboardLeftGUI, 700E4 KeyboardRightControl, 700E5 KeyboardRightShift, 700E6 KeyboardRightAlt, 700E7 KeyboardRightGUI
  56 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=0, Length=2, Items=2
  5 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: Variable, Usages: 80001 LedNumLock, 80002 LedCapsLock, 80003 LedScrollLock, 80004 LedCompose, 80005 LedKana
  3 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Failed to open device.


\\?\hid#dell091a&col03#5&99b72d3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microsoft HIDI2C Device 9999 (VID 1160, PID 4639, version 4.13)
Max Lengths: Input 28, Output 0, Feature 8
Serial Ports:
Report Descriptor:
  06 01 FF 09 01 A1 01 85 03 09 01 15 00 25 FF 35 00 46 FF FF 66 01 10 55 0C 75 08 95 1B 81 02 85 04 09 02 81 02 85 06 09 04 95 07 81 02 25 01 45 01 65 00 55 00 75 01 95 A0 81 03 85 05 09 03 25 FF 46 FF FF 66 01 10 55 0C 75 08 95 07 B1 02 C1 00 (81 bytes)
  UsagePage 65281
  Usage 1
  Collection 1
    ReportID 3
    Usage 1
    LogicalMinimum 0
    LogicalMaximum 255
    PhysicalMinimum 0
    PhysicalMaximum 65535
    Unit 4097
    UnitExponent 12
    ReportSize 8
    ReportCount 27
    Input 2
    ReportID 4
    Usage 2
    Input 2
    ReportID 6
    Usage 4
    ReportCount 7
    Input 2
    LogicalMaximum 1
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 160
    Input 3
    ReportID 5
    Usage 3
    LogicalMaximum 255
    PhysicalMaximum 65535
    Unit 4097
    UnitExponent 12
    ReportSize 8
    ReportCount 7
    Feature 2
  EndCollection 0
Usage: FF010001 4278255617
Input: ReportID=3, Length=28, Items=1
  27 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: FF010001 4278255617
Input: ReportID=4, Length=28, Items=1
  27 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: FF010002 4278255618
Input: ReportID=6, Length=28, Items=2
  7 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: FF010004 4278255620
  160 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Feature: ReportID=5, Length=8, Items=1
  7 Elements x 8 Bits, Units: SILinear, Expected Usage Type: 0, Flags: Variable, Usages: FF010003 4278255619
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_413c&pid_b06e#c&37ff1248&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer)  (no serial number) (VID 16700, PID 45166, version 1.1)
Max Lengths: Input 193, Output 193, Feature 0
Serial Ports:
Report Descriptor:
  06 DA FF 09 DA A1 01 09 DA 25 7F 35 00 45 00 65 00 55 00 75 08 95 01 81 02 15 00 25 01 45 01 75 01 96 F8 05 81 03 96 00 06 91 03 C1 00 (45 bytes)
  UsagePage 65498
  Usage 218
  Collection 1
    Usage 218
    LogicalMaximum 127
    PhysicalMinimum 0
    PhysicalMaximum 0
    Unit 0
    UnitExponent 0
    ReportSize 8
    ReportCount 1
    Input 2
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMaximum 1
    ReportSize 1
    ReportCount 1528
    Input 3
    ReportCount 1536
    Output 3
  EndCollection 0
Usage: FFDA00DA 4292477146
Input: ReportID=0, Length=193, Items=2
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: FFDA00DA 4292477146
  1528 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=0, Length=193, Items=1
  1536 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_04d8&pid_003f#e&24ba9f4d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microchip Technology Inc. Simple HID Device Demo (no serial number) (VID 1240, PID 63, version 0.2)
Max Lengths: Input 65, Output 65, Feature 0
Serial Ports:
Report Descriptor:
  06 00 FF 09 01 A1 01 19 01 29 40 15 00 25 01 35 00 45 01 65 00 55 00 75 01 95 40 81 00 96 C0 01 81 03 19 01 29 40 95 40 91 00 96 C0 01 91 03 C1 00 (49 bytes)
  UsagePage 65280
  Usage 1
  Collection 1
    UsageMinimum 1
    UsageMaximum 64
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 64
    Input 0
    ReportCount 448
    Input 3
    UsageMinimum 1
    UsageMaximum 64
    ReportCount 64
    Output 0
    ReportCount 448
    Output 3
  EndCollection 0
Usage: FF000001 4278190081
Input: ReportID=0, Length=65, Items=2
  64 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: None, Usages: FF000001 4278190081, FF000002 4278190082, FF000003 4278190083, FF000004 4278190084, FF000005 4278190085, FF000006 4278190086, FF000007 4278190087, FF000008 4278190088, FF000009 4278190089, FF00000A 4278190090, FF00000B 4278190091, FF00000C 4278190092, FF00000D 4278190093, FF00000E 4278190094, FF00000F 4278190095, FF000010 4278190096, FF000011 4278190097, FF000012 4278190098, FF000013 4278190099, FF000014 4278190100, FF000015 4278190101, FF000016 4278190102, FF000017 4278190103, FF000018 4278190104, FF000019 4278190105, FF00001A 4278190106, FF00001B 4278190107, FF00001C 4278190108, FF00001D 4278190109, FF00001E 4278190110, FF00001F 4278190111, FF000020 4278190112, FF000021 4278190113, FF000022 4278190114, FF000023 4278190115, FF000024 4278190116, FF000025 4278190117, FF000026 4278190118, FF000027 4278190119, FF000028 4278190120, FF000029 4278190121, FF00002A 4278190122, FF00002B 4278190123, FF00002C 4278190124, FF00002D 4278190125, FF00002E 4278190126, FF00002F 4278190127, FF000030 4278190128, FF000031 4278190129, FF000032 4278190130, FF000033 4278190131, FF000034 4278190132, FF000035 4278190133, FF000036 4278190134, FF000037 4278190135, FF000038 4278190136, FF000039 4278190137, FF00003A 4278190138, FF00003B 4278190139, FF00003C 4278190140, FF00003D 4278190141, FF00003E 4278190142, FF00003F 4278190143, FF000040 4278190144
  448 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=0, Length=65, Items=2
  64 Elements x 1 Bits, Units: None, Expected Usage Type: PushButton, Flags: None, Usages: FF000001 4278190081, FF000002 4278190082, FF000003 4278190083, FF000004 4278190084, FF000005 4278190085, FF000006 4278190086, FF000007 4278190087, FF000008 4278190088, FF000009 4278190089, FF00000A 4278190090, FF00000B 4278190091, FF00000C 4278190092, FF00000D 4278190093, FF00000E 4278190094, FF00000F 4278190095, FF000010 4278190096, FF000011 4278190097, FF000012 4278190098, FF000013 4278190099, FF000014 4278190100, FF000015 4278190101, FF000016 4278190102, FF000017 4278190103, FF000018 4278190104, FF000019 4278190105, FF00001A 4278190106, FF00001B 4278190107, FF00001C 4278190108, FF00001D 4278190109, FF00001E 4278190110, FF00001F 4278190111, FF000020 4278190112, FF000021 4278190113, FF000022 4278190114, FF000023 4278190115, FF000024 4278190116, FF000025 4278190117, FF000026 4278190118, FF000027 4278190119, FF000028 4278190120, FF000029 4278190121, FF00002A 4278190122, FF00002B 4278190123, FF00002C 4278190124, FF00002D 4278190125, FF00002E 4278190126, FF00002F 4278190127, FF000030 4278190128, FF000031 4278190129, FF000032 4278190130, FF000033 4278190131, FF000034 4278190132, FF000035 4278190133, FF000036 4278190134, FF000037 4278190135, FF000038 4278190136, FF000039 4278190137, FF00003A 4278190138, FF00003B 4278190139, FF00003C 4278190140, FF00003D 4278190141, FF00003E 4278190142, FF00003F 4278190143, FF000040 4278190144
  448 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


\\?\hid#vid_413c&pid_b06f#d&3624b04c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
(unnamed manufacturer)  (no serial number) (VID 16700, PID 45167, version 1.1)
Max Lengths: Input 193, Output 193, Feature 0
Serial Ports:
Report Descriptor:
  06 DA FF 09 DA A1 01 09 DA 25 7F 35 00 45 00 65 00 55 00 75 08 95 01 81 02 15 00 25 01 45 01 75 01 96 F8 05 81 03 96 00 06 91 03 C1 00 (45 bytes)
  UsagePage 65498
  Usage 218
  Collection 1
    Usage 218
    LogicalMaximum 127
    PhysicalMinimum 0
    PhysicalMaximum 0
    Unit 0
    UnitExponent 0
    ReportSize 8
    ReportCount 1
    Input 2
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMaximum 1
    ReportSize 1
    ReportCount 1528
    Input 3
    ReportCount 1536
    Output 3
  EndCollection 0
Usage: FFDA00DA 4292477146
Input: ReportID=0, Length=193, Items=2
  1 Elements x 8 Bits, Units: None, Expected Usage Type: 0, Flags: Variable, Usages: FFDA00DA 4292477146
  1528 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=0, Length=193, Items=1
  1536 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.


Press a key to exit...

mcuee avatar Jun 17 '21 08:06 mcuee

mac-hid-dump output seems to be a bit too simple.

./mac-hid-dump 
mac-hid-dump:
0000 0000: Apple - Headset
DESCRIPTOR:
  05  0c  09  01  a1  01  05  0c  09  cd  09  ea  09  e9  15  00 
  25  01  95  03  75  01  81  02  95  05  81  05  c0  
  (29 bytes)
1915 1025: ZY.Ltd - ZY Control Mic
DESCRIPTOR:
  05  01  09  02  a1  01  85  04  09  01  a1  00  05  09  19  01 
  29  05  15  00  25  01  95  03  75  01  81  02  95  01  75  05 
  81  03  05  01  09  30  09  31  09  38  15  81  25  7f  75  08 
  95  03  81  06  c0  c0  05  0c  09  01  a1  01  85  01  75  10 
  95  01  15  00  26  ff  03  19  00  2a  ff  03  81  00  c0  05 
  01  09  80  a1  01  85  02  75  01  95  02  15  00  25  01  09 
  81  09  82  81  02  75  01  95  0e  81  03  c0  06  00  ff  09 
  00  a1  01  85  06  15  00  26  ff  00  75  08  95  1f  09  00 
  b1  02  c0  
  (131 bytes)
0000 0000: Apple - 
DESCRIPTOR:
  06  00  ff  0a  ff  00  a1  01  15  00  26  ff  00  75  08  95 
  01  81  02  c0  
  (20 bytes)
046D C52B: Logitech - USB Receiver
DESCRIPTOR:
  06  00  ff  09  01  a1  01  85  10  75  08  95  06  15  00  26 
  ff  00  09  01  81  00  09  01  91  00  c0  06  00  ff  09  02 
  a1  01  85  11  75  08  95  13  15  00  26  ff  00  09  02  81 
  00  09  02  91  00  c0  06  00  ff  09  04  a1  01  85  20  75 
  08  95  0e  15  00  26  ff  00  09  41  81  00  09  41  91  00 
  85  21  95  1f  15  00  26  ff  00  09  42  81  00  09  42  91 
  00  c0  
  (98 bytes)
046D C52B: Logitech - USB Receiver
DESCRIPTOR:
  05  01  09  02  a1  01  85  02  09  01  a1  00  05  09  19  01 
  29  10  15  00  25  01  95  10  75  01  81  02  05  01  16  01 
  f8  26  ff  07  75  0c  95  02  09  30  09  31  81  06  15  81 
  25  7f  75  08  95  01  09  38  81  06  05  0c  0a  38  02  95 
  01  81  06  c0  c0  05  0c  09  01  a1  01  85  03  75  10  95 
  02  15  01  26  ff  02  19  01  2a  ff  02  81  00  c0  05  01 
  09  80  a1  01  85  04  75  02  95  01  15  01  25  03  09  82 
  09  81  09  83  81  60  75  06  81  03  c0  06  bc  ff  09  88 
  a1  01  85  08  19  01  29  ff  15  01  26  ff  00  75  08  95 
  01  81  00  c0  
  (148 bytes)
046D C52B: Logitech - USB Receiver
DESCRIPTOR:
  05  01  09  06  a1  01  05  07  19  e0  29  e7  15  00  25  01 
  75  01  95  08  81  02  81  03  95  05  05  08  19  01  29  05 
  91  02  95  01  75  03  91  01  95  06  75  08  15  00  26  a4 
  00  05  07  19  00  2a  a4  00  81  00  c0  
  (59 bytes)
0000 0000: APPL - BTM
DESCRIPTOR:
  06  00  ff  0a  48  00  a1  01  06  29  ff  85  01  25  7f  95 
  01  75  08  09  01  b1  02  09  02  b1  02  09  25  a1  03  85 
  02  24  76  98  3e  09  03  81  22  09  04  76  38  02  b1  02 
  c0  c0  
  (50 bytes)
1915 1025: ZY.Ltd - ZY Control Mic
DESCRIPTOR:
  05  01  09  06  a1  01  05  07  19  e0  29  e7  15  00  25  01 
  75  01  95  08  81  02  95  01  75  08  81  01  95  03  75  01 
  05  08  19  01  29  03  91  02  95  05  75  01  91  01  95  06 
  75  08  15  00  26  ff  00  05  07  19  00  2a  ff  00  81  00 
  c0  
  (65 bytes)

Edit to add: but external tools can parse the output. Example mentioned by #262 https://eleccelerator.com/usbdescreqparser/

Raw HID reports (part of Logitech USB Receiver):

  05  01  09  02  a1  01  85  02  09  01  a1  00  05  09  19  01 
  29  10  15  00  25  01  95  10  75  01  81  02  05  01  16  01 
  f8  26  ff  07  75  0c  95  02  09  30  09  31  81  06  15  81 
  25  7f  75  08  95  01  09  38  81  06  05  0c  0a  38  02  95 
  01  81  06  c0  c0  05  0c  09  01  a1  01  85  03  75  10  95 
  02  15  01  26  ff  02  19  01  2a  ff  02  81  00  c0  05  01 
  09  80  a1  01  85  04  75  02  95  01  15  01  25  03  09  82 
  09  81  09  83  81  60  75  06  81  03  c0  06  bc  ff  09  88 
  a1  01  85  08  19  01  29  ff  15  01  26  ff  00  75  08  95 
  01  81  00  c0 

Parsed output from the above website.

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x02,        // Usage (Mouse)
0xA1, 0x01,        // Collection (Application)
0x85, 0x02,        //   Report ID (2)
0x09, 0x01,        //   Usage (Pointer)
0xA1, 0x00,        //   Collection (Physical)
0x05, 0x09,        //     Usage Page (Button)
0x19, 0x01,        //     Usage Minimum (0x01)
0x29, 0x10,        //     Usage Maximum (0x10)
0x15, 0x00,        //     Logical Minimum (0)
0x25, 0x01,        //     Logical Maximum (1)
0x95, 0x10,        //     Report Count (16)
0x75, 0x01,        //     Report Size (1)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)
0x16, 0x01, 0xF8,  //     Logical Minimum (-2047)
0x26, 0xFF, 0x07,  //     Logical Maximum (2047)
0x75, 0x0C,        //     Report Size (12)
0x95, 0x02,        //     Report Count (2)
0x09, 0x30,        //     Usage (X)
0x09, 0x31,        //     Usage (Y)
0x81, 0x06,        //     Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x81,        //     Logical Minimum (-127)
0x25, 0x7F,        //     Logical Maximum (127)
0x75, 0x08,        //     Report Size (8)
0x95, 0x01,        //     Report Count (1)
0x09, 0x38,        //     Usage (Wheel)
0x81, 0x06,        //     Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x0C,        //     Usage Page (Consumer)
0x0A, 0x38, 0x02,  //     Usage (AC Pan)
0x95, 0x01,        //     Report Count (1)
0x81, 0x06,        //     Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //   End Collection
0xC0,              // End Collection
0x05, 0x0C,        // Usage Page (Consumer)
0x09, 0x01,        // Usage (Consumer Control)
0xA1, 0x01,        // Collection (Application)
0x85, 0x03,        //   Report ID (3)
0x75, 0x10,        //   Report Size (16)
0x95, 0x02,        //   Report Count (2)
0x15, 0x01,        //   Logical Minimum (1)
0x26, 0xFF, 0x02,  //   Logical Maximum (767)
0x19, 0x01,        //   Usage Minimum (Consumer Control)
0x2A, 0xFF, 0x02,  //   Usage Maximum (0x02FF)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection
0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x80,        // Usage (Sys Control)
0xA1, 0x01,        // Collection (Application)
0x85, 0x04,        //   Report ID (4)
0x75, 0x02,        //   Report Size (2)
0x95, 0x01,        //   Report Count (1)
0x15, 0x01,        //   Logical Minimum (1)
0x25, 0x03,        //   Logical Maximum (3)
0x09, 0x82,        //   Usage (Sys Sleep)
0x09, 0x81,        //   Usage (Sys Power Down)
0x09, 0x83,        //   Usage (Sys Wake Up)
0x81, 0x60,        //   Input (Data,Array,Abs,No Wrap,Linear,No Preferred State,Null State)
0x75, 0x06,        //   Report Size (6)
0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection
0x06, 0xBC, 0xFF,  // Usage Page (Vendor Defined 0xFFBC)
0x09, 0x88,        // Usage (0x88)
0xA1, 0x01,        // Collection (Application)
0x85, 0x08,        //   Report ID (8)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0xFF,        //   Usage Maximum (0xFF)
0x15, 0x01,        //   Logical Minimum (1)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x01,        //   Report Count (1)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection

// 148 bytes

mcuee avatar Jun 17 '21 13:06 mcuee

@DJm00n I have rewritten my code that is trying to get HID Report Descriptor from USB devices. Can you give it a try? https://github.com/DJm00n/RawInputDemo/tree/hid_report_descriptor_dump It successfully dumps descriptor from my keyboard, dualshock4, dualsense, stadia controller etc into debug output in MSVS. > > Now without memleaks and crashes :) Cannot dump descriptor from my mouse because it supports only Boot Interface Subclass (see 4.2 Subclass in HID spec).

It uses IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION under the hood.

PS: Bluetooth and Bluetooth LE another story that I'll try to investigate.

I tested your new code, on my Windows 7 system. unfortunateley it always fails with:

'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\psapi.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. 
[RawInputDevice::QueryDeviceInfo:34] Cannot get USB device info from '\\?\USB#VID_17CC&PID_1130#C86013EA#{a5dcbf10-6530-11d2-901f-00c04fb951ed}' interface.
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:0000,PID:0000][UP:0000,U:0000]: Manufacturer: '(Standardsystemgeräte)', Product: 'HID-konformes Gerät', Interface: `\\?\HID#VID_17CC&PID_1130&MI_04#9&11d406cd&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:0000,PID:0000,VER:0000]: Manufacturer: '', Product: '', Serial Number: ``, Interface: `\\?\USB#VID_17CC&PID_1130#C86013EA#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceManager::RawInputManagerImpl::OnInputDeviceChange:309] Invalid device: '255270837'
[RawInputDeviceHid::~RawInputDeviceHid:42] Removed HID device: 'HID-konformes Gerät', Interface: `\\?\HID#VID_17CC&PID_1130&MI_04#9&11d406cd&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
Debug Error!

Program: ...oerg\source\repos\RawInputDemo\bin\x64\Debug\RawInputDemo.exe

abort() has been called

(Press Retry to debug the application)
[RawInputDeviceManager::RawInputManagerImpl::OnInput:355] Device 0xb0039 not found
[RawInputDeviceManager::RawInputManagerImpl::OnInput:355] Device 0xb0039 not found
[RawInputDeviceManager::RawInputManagerImpl::OnInput:355] Device 0xb0039 not found

I would be glad if your approach would work, because gather the real Report Descriptor would be better than any reconstruction.

JoergAtGithub avatar Jun 17 '21 17:06 JoergAtGithub

@DJm00n I tried RawInputDemo under Windows 10 using VS2019, no problem running it but the RawInputDemo.exe does not seem to do anything. How do I use it?

mcuee avatar Jun 18 '21 01:06 mcuee

@JoergAtGithub #262 seems to running fine at my Dell Windows 10 laptop with a docking edition and quite some HID devices. The only problem is that I do not know the original HID report descriptor of the devices other than the device I have access to the FW (say Microchip based Simple HID Demo, PICkit 2, Lakeview Research HID demo) and they are on the simpler side.

mcuee avatar Jun 18 '21 03:06 mcuee

But HIDSharp seems to work. I have a long list of HID device in the system (Windows 10, Dell Laptop with a docking station).

Further test shows that HIDSharp is not so stable for my system, sometime it hangs.

Pull request #262 seems to be pretty stable and product consistent results (but I need to check whether it is correct or not).

mcuee avatar Jun 18 '21 04:06 mcuee

@mcuee sorry. I forgot to mention - it outputs info to debug console window in msvs.

DJm00n avatar Jun 18 '21 05:06 DJm00n

@mcuee sorry. I forgot to mention - it outputs info to debug console window in msvs.

This is what I got in the VS2019 output window. Where can I see the debug console? Sorry but I seldom use VS.

'RawInputDemo.exe' (Win32): Loaded 'C:\work\libusb\RawInputDemo\bin\x64\Debug\RawInputDemo.exe'. Symbols loaded.
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\apphelp.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\hid.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. 
'RawInputDemo.exe' (Win32): Unloaded 'C:\Windows\System32\ucrtbased.dll'
'RawInputDemo.exe' (Win32): Unloaded 'C:\Windows\System32\ucrtbased.dll'
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\umppc13702.dll'. 
'RawInputDemo.exe' (Win32): Unloaded 'C:\Windows\System32\umppc13702.dll'
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\umppc13702.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\TextShaping.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. 
'RawInputDemo.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:047F,PID:C056][UP:000B,U:0005]: Manufacturer: 'Plantronics', Product: 'Plantronics Blackwire 3220 Series', Interface: `\\?\HID#VID_047F&PID_C056&MI_03&Col02#f&39e6f119&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:047F,PID:C056,VER:0210]: Manufacturer: 'Plantronics', Product: 'Plantronics Blackwire 3220 Series', Serial Number: `D1CEC32927974D5F9BD6B2AEBF2EA8E3`, Interface: `\\?\USB#VID_047F&PID_C056#D1CEC32927974D5F9BD6B2AEBF2EA8E3#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:047F,PID:C056][UP:FFA0,U:0003]: Manufacturer: 'Plantronics', Product: 'Plantronics Blackwire 3220 Series', Interface: `\\?\HID#VID_047F&PID_C056&MI_03&Col03#f&39e6f119&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:047F,PID:C056,VER:0210]: Manufacturer: 'Plantronics', Product: 'Plantronics Blackwire 3220 Series', Serial Number: `D1CEC32927974D5F9BD6B2AEBF2EA8E3`, Interface: `\\?\USB#VID_047F&PID_C056#D1CEC32927974D5F9BD6B2AEBF2EA8E3#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:047F,PID:C056][UP:000C,U:0001]: Manufacturer: 'Plantronics', Product: 'Plantronics Blackwire 3220 Series', Interface: `\\?\HID#VID_047F&PID_C056&MI_03&Col01#f&39e6f119&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:047F,PID:C056,VER:0210]: Manufacturer: 'Plantronics', Product: 'Plantronics Blackwire 3220 Series', Serial Number: `D1CEC32927974D5F9BD6B2AEBF2EA8E3`, Interface: `\\?\USB#VID_047F&PID_C056#D1CEC32927974D5F9BD6B2AEBF2EA8E3#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:04D8,PID:0033][UP:FF00,U:0001]: Manufacturer: 'Microchip Technology Inc.', Product: 'PICkit 2 Microcontroller Programmer', Interface: `\\?\HID#VID_04D8&PID_0033#e&bd5b18b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:04D8,PID:0033,VER:0002]: Manufacturer: 'Microchip Technology Inc.', Product: 'PICkit 2 Microcontroller Programmer', Serial Number: `pk2new`, Interface: `\\?\USB#VID_04D8&PID_0033#pk2new#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:046D,PID:C534][UP:000C,U:0001]: Manufacturer: 'Logitech', Product: 'USB Receiver', Interface: `\\?\HID#VID_046D&PID_C534&MI_01&Col02#7&1ebb799e&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:046D,PID:C534,VER:2901]: Manufacturer: 'Logitech', Product: 'USB Receiver', Serial Number: ``, Interface: `\\?\USB#VID_046D&PID_C534#5&e9f3e45&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:413C,PID:B06F][UP:FFDA,U:00DA]: Manufacturer: '(Standard system devices)', Product: 'Dell dock', Interface: `\\?\HID#VID_413C&PID_B06F#d&3624b04c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:413C,PID:B06F,VER:0101]: Manufacturer: '', Product: 'Dellﴠ﷽���', Serial Number: ``, Interface: `\\?\USB#VID_413C&PID_B06F#c&1f76a113&0&5#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceManager::RawInputManagerImpl::CreateRawInputDevice:374] Unknown device type 3.
[RawInputDeviceManager::RawInputManagerImpl::OnInputDeviceChange:309] Invalid device: '131153'
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:0488,PID:121F][UP:FF01,U:0001]: Manufacturer: 'Microsoft', Product: 'HIDI2C Device', Interface: `\\?\HID#DELL091A&Col03#5&99b72d3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:045E,PID:0000][UP:000C,U:0001]: Manufacturer: 'Microsoft', Product: 'HID-compliant consumer control device', Interface: `\\?\HID#ConvertedDevice&Col02#5&379854aa&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:413C,PID:B06E][UP:FFDA,U:00DA]: Manufacturer: '(Standard system devices)', Product: 'Dell dock', Interface: `\\?\HID#VID_413C&PID_B06E#c&37ff1248&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:413C,PID:B06E,VER:0101]: Manufacturer: '', Product: 'Dellﴠ﷽���', Serial Number: ``, Interface: `\\?\USB#VID_413C&PID_B06E#b&2eaf716d&0&5#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:0488,PID:121F][UP:000D,U:0005]: Manufacturer: 'Microsoft', Product: 'HIDI2C Device', Interface: `\\?\HID#DELL091A&Col02#5&99b72d3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:8087,PID:0A1E][UP:0001,U:000D]: Manufacturer: 'Microsoft', Product: 'Portable Device Control device', Interface: `\\?\HID#INTC816&Col02#3&36a7043c&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:8087,PID:0A1E][UP:0001,U:000C]: Manufacturer: '(Standard system devices)', Product: 'HID-compliant wireless radio controls', Interface: `\\?\HID#INTC816&Col01#3&36a7043c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:046D,PID:C534][UP:FF00,U:0002]: Manufacturer: 'Logitech', Product: 'USB Receiver', Interface: `\\?\HID#VID_046D&PID_C534&MI_01&Col05#7&1ebb799e&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:046D,PID:C534,VER:2901]: Manufacturer: 'Logitech', Product: 'USB Receiver', Serial Number: ``, Interface: `\\?\USB#VID_046D&PID_C534#5&e9f3e45&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceHid::RawInputDeviceHid:25] New HID device[VID:046D,PID:C534][UP:FF00,U:0001]: Manufacturer: 'Logitech', Product: 'USB Receiver', Interface: `\\?\HID#VID_046D&PID_C534&MI_01&Col04#7&1ebb799e&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceHid::RawInputDeviceHid:37]   ->Its USB Device[VID:046D,PID:C534,VER:2901]: Manufacturer: 'Logitech', Product: 'USB Receiver', Serial Number: ``, Interface: `\\?\USB#VID_046D&PID_C534#5&e9f3e45&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:18] New Keyboard device: 'HID Keyboard Device', Interface: `\\?\HID#ConvertedDevice&Col01#5&379854aa&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:21]   ->Its HID Device[VID:045E,PID:0000]: Interface: `\\?\HID#ConvertedDevice&Col01#5&379854aa&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:18] New Keyboard device: '', Interface: `\\?\HID#Vid_044E&Pid_1212&Col01&Col02#7&290aacae&0&0001#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:21]   ->Its HID Device[VID:044E,PID:1212]: Interface: `\\?\HID#Vid_044E&Pid_1212&Col01&Col02#7&290aacae&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:18] New Keyboard device: 'Dell USB Entry Keyboard', Interface: `\\?\HID#VID_413C&PID_2107#e&11005b8d&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:21]   ->Its HID Device[VID:413C,PID:2107]: Interface: `\\?\HID#VID_413C&PID_2107#e&11005b8d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:24]   ->Its USB Device[VID:413C,PID:2107,VER:0178]: Manufacturer: 'DELL', Product: 'Dell USB Entry Keyboard', Serial Number: ``, Interface: `\\?\USB#VID_413C&PID_2107#d&3e263b&0&3#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:18] New Keyboard device: 'USB Receiver', Interface: `\\?\HID#VID_046D&PID_C534&MI_00#7&51bc424&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:21]   ->Its HID Device[VID:046D,PID:C534]: Interface: `\\?\HID#VID_046D&PID_C534&MI_00#7&51bc424&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:24]   ->Its USB Device[VID:046D,PID:C534,VER:2901]: Manufacturer: 'Logitech', Product: 'USB Receiver', Serial Number: ``, Interface: `\\?\USB#VID_046D&PID_C534#5&e9f3e45&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceKeyboard::RawInputDeviceKeyboard:18] New Keyboard device: 'Standard PS/2 Keyboard', Interface: `\\?\ACPI#DLLK091A#4&3864e190&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceMouse::RawInputDeviceMouse:15] New Mouse device: 'HIDI2C Device', Interface: `\\?\HID#DELL091A&Col01#5&99b72d3&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceMouse::RawInputDeviceMouse:18]   ->Its HID Device[VID:0488,PID:121F]: Interface: `\\?\HID#DELL091A&Col01#5&99b72d3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceMouse::RawInputDeviceMouse:15] New Mouse device: 'USB Receiver', Interface: `\\?\HID#VID_046D&PID_C534&MI_01&Col01#7&1ebb799e&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceMouse::RawInputDeviceMouse:18]   ->Its HID Device[VID:046D,PID:C534]: Interface: `\\?\HID#VID_046D&PID_C534&MI_01&Col01#7&1ebb799e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceMouse::RawInputDeviceMouse:21]   ->Its USB Device[VID:046D,PID:C534,VER:2901]: Manufacturer: 'Logitech', Product: 'USB Receiver', Serial Number: ``, Interface: `\\?\USB#VID_046D&PID_C534#5&e9f3e45&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceMouse::RawInputDeviceMouse:15] New Mouse device: 'USB Optical Mouse', Interface: `\\?\HID#VID_046D&PID_C077#e&113cd935&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceMouse::RawInputDeviceMouse:18]   ->Its HID Device[VID:046D,PID:C077]: Interface: `\\?\HID#VID_046D&PID_C077#e&113cd935&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`
[RawInputDeviceMouse::RawInputDeviceMouse:21]   ->Its USB Device[VID:046D,PID:C077,VER:7200]: Manufacturer: 'Logitech', Product: 'USB Optical Mouse', Serial Number: ``, Interface: `\\?\USB#VID_046D&PID_C077#d&3e263b&0&4#{a5dcbf10-6530-11d2-901f-00c04fb951ed}`
[RawInputDeviceMouse::RawInputDeviceMouse:15] New Mouse device: '', Interface: `\\?\HID#Vid_044E&Pid_1212&Col01&Col01#7&290aacae&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}`
[RawInputDeviceMouse::RawInputDeviceMouse:18]   ->Its HID Device[VID:044E,PID:1212]: Interface: `\\?\HID#Vid_044E&Pid_1212&Col01&Col01#7&290aacae&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}`

mcuee avatar Jun 18 '21 05:06 mcuee

I found that pull request #262 is not correct for Microchip PICKit 2 and then I run HIDSharp again and it is also not correct.

Original HID report descriptor

rom struct{byte report[29];}hid_rpt01={
    0x06, 0x00, 0xFF,       // Usage Page (Vendor Defined)
    0x09, 0x01,             // Usage (Vendor Usage)
    0xA1, 0x01,             // Collection (Application)
    0x19, 0x01,             //      Usage Minimum (Vendor Usage = 1)
//    0x29, 0x08,             //      Usage Maximum (Vendor Usage = 8)
    0x29, 0x40,             //      Usage Maximum (Vendor Usage = 64)
    0x15, 0x00,             //      Logical Minimum (Vendor Usage = 0)
    0x26, 0xFF, 0x00,       //      Logical Maximum (Vendor Usage = 255)
    0x75, 0x08,             //      Report Size (Vendor Usage = 8)
//    0x95, 0x08,             //      Report Count (Vendor Usage = 8)
    0x95, 0x40,             //      Report Count (Vendor Usage = 64)
    0x81, 0x02,             //      Input (Data, Var, Abs)
    0x19, 0x01,             //      Usage Minimum (Vendor Usage = 1)
//    0x29, 0x08,             //      Usage Maximum (Vendor Usage = 8)
    0x29, 0x40,             //      Usage Maximum (Vendor Usage = 64)
    0x91, 0x02,             //      Output (Data, Var, Ads)
    0xC0};                  // End Collection

Dumped by pull request #262

 06  00  FF  09  01  A1  01  19  01  29  40  15  00  26  FF  00  75  08  95  01  81  02  19  01  29  40  15  00  26  FF  00  75  08  95  01  91  02  C0 

https://eleccelerator.com/usbdescreqparser/ output.

0x06, 0x00, 0xFF,  // Usage Page (Vendor Defined 0xFF00)
0x09, 0x01,        // Usage (0x01)
0xA1, 0x01,        // Collection (Application)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x40,        //   Usage Maximum (0x40)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x01,        //   Report Count (1)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x40,        //   Usage Maximum (0x40)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x01,        //   Report Count (1)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

// 38 bytes

As a comparison, this is what I get from HIDSharp which is also not correct.

\\?\hid#vid_04d8&pid_0033#e&bd5b18b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Microchip Technology Inc. PICkit 2 Microcontroller Programmer pk2new (VID 1240, PID 51, version 0.2)
Max Lengths: Input 65, Output 65, Feature 0
Serial Ports:
Report Descriptor:
  06 00 FF 09 01 A1 01 15 00 25 01 35 00 45 01 65 00 55 00 75 01 96 00 02 81 03 91 03 C1 00 (30 bytes)
  UsagePage 65280
  Usage 1
  Collection 1
    LogicalMinimum 0
    LogicalMaximum 1
    PhysicalMinimum 0
    PhysicalMaximum 1
    Unit 0
    UnitExponent 0
    ReportSize 1
    ReportCount 512
    Input 3
    Output 3
  EndCollection 0
Usage: FF000001 4278190081
Input: ReportID=0, Length=65, Items=1
  512 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Output: ReportID=0, Length=65, Items=1
  512 Elements x 1 Bits, Units: None, Expected Usage Type: 0, Flags: Constant, Variable, Usages:
Opening device for 20 seconds...
Opened device.
Closed device.

mcuee avatar Jun 18 '21 05:06 mcuee

The HID Report Descriptors that HIDSharp (and win-hid-dump) emit are reconstructions based on what is available via Windows HID APIs, it is not the actual descriptor sent by the device, but rather a "consolation-of-a-parsed-data-structure".

It should be semantically (to the OS) the same, however. If it's not, it usually means the descriptor sent by the device is wrong in some subtle way. For vendor usages, this doesn't much matter, as then all that really matters is REPORT_ID, REPORT_COUNT, and REPORT_SIZE

todbot avatar Jun 18 '21 05:06 todbot

The HID Report Descriptors that HIDSharp (and win-hid-dump) emit are reconstructions based on what is available via Windows HID APIs, it is not the actual descriptor sent by the device, but rather a "consolation-of-a-parsed-data-structure".

I understand, but in this case, it is quite a bit OFF. It is totally different from what the device does. REPORT_COUNT and REPORT_SIZE are totally wrong.

#262 actually looks better in this case.

mcuee avatar Jun 18 '21 05:06 mcuee

@todbot Maybe this device is indeed strange, it has two USB configurations but that should not matter as Windows will ignore the second configuration.

Full USB Descriptor C source code for reference.

click to expand
/*********************************************************************
 *
 *                Microchip USB C18 Firmware Version 1.0
 *
 * This file is generated by Microchip USB Wizard Version 1.0, 2004
 *********************************************************************
 * FileName:        usbdsc.c
 * Dependencies:    See INCLUDES section below
 * Processor:       PIC18
 * Compiler:        C18 3.00
 * Company:         Microchip Technology, Inc.
 *
 * Software License Agreement
 *
 * The software supplied herewith by Microchip Technology Incorporated
 * (the “Company”) for its PICmicro® Microcontroller is intended and
 * supplied to you, the Company’s customer, for use solely and
 * exclusively on Microchip PICmicro Microcontroller products. The
 * software is owned by the Company and/or its supplier, and is
 * protected under applicable copyright laws. All rights are reserved.
 * Any use in violation of the foregoing restrictions may subject the
 * user to criminal sanctions under applicable laws, as well as to
 * civil liability for the breach of the terms and conditions of this
 * license.
 *
 * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
 * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
 * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
 * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *
 ********************************************************************/

/*********************************************************************
 * Descriptor specific type definitions are defined in:
 * system\usb\usbdefs\usbdefs_std_dsc.h
 *
 * Configuration information is defined in:
 * autofiles\usbcfg.h
 ********************************************************************/
 
/** I N C L U D E S *************************************************/
#include "system\typedefs.h"
#include "system\usb\usb.h"

/** C O N S T A N T S ************************************************/
#pragma romdata

/* Device Descriptor */
rom USB_DEV_DSC device_dsc=
{    
    sizeof(USB_DEV_DSC),    // Size of this descriptor in bytes
    DSC_DEV,                // DEVICE descriptor type
    0x0200,                 // USB Spec Release Number in BCD format
    0x00,                   // Class Code
    0x00,                   // Subclass code
    0x00,                   // Protocol code
    EP0_BUFF_SIZE,          // Max packet size for EP0, see usbcfg.h
    0x04D8,                 // Vendor ID = 1240
    0x0033,                 // Product ID = 51
    0x0002,                 // Device release number in BCD format
    0x01,                   // Manufacturer string index
    0x02,                   // Product string index
    SERIAL_UNITID_DSC,                   // Device serial number string index
    0x02                    // Number of possible configurations
};

/* Configuration 1 Descriptor */
CFG01={
    /* Configuration Descriptor */
    sizeof(USB_CFG_DSC),    // Size of this descriptor in bytes
    DSC_CFG,                // CONFIGURATION descriptor type
    sizeof(cfg01),          // Total length of data for this cfg
    1,                      // Number of interfaces in this cfg
    1,                      // Index value of this configuration
    2,                      // Configuration string index
    _DEFAULT,               // Attributes, see usbdefs_std_dsc.h
    50,                     // Max power consumption (2X mA)

    /* Interface Descriptor */
    sizeof(USB_INTF_DSC),   // Size of this descriptor in bytes
    DSC_INTF,               // INTERFACE descriptor type
    0,                      // Interface Number
    0,                      // Alternate Setting Number
    2,                      // Number of endpoints in this intf
    HID_INTF,               // Class code
    0,                      // Subclass code
    0,                      // Protocol code
    0,                      // Interface string index

    /* HID Class-Specific Descriptor */
    sizeof(USB_HID_DSC),    // Size of this descriptor in bytes
    DSC_HID,                // HID descriptor type
    0x0001,                 // HID Spec Release Number in BCD format
    0x00,                   // Country Code (0x00 for Not supported)
    1,                      // Number of class descriptors, see usbcfg.h
    DSC_RPT,                // Report descriptor type
    sizeof(hid_rpt01),      // Size of the report descriptor

    /* Endpoint Descriptor 1 in */
    sizeof(USB_EP_DSC),
    DSC_EP,
    _EP01_IN,
    _INT,
    HID_INT_IN_EP_SIZE,
    0x01,

    /* Endpoint Descriptor 1 out */
    sizeof(USB_EP_DSC),
    DSC_EP,
    _EP01_OUT,
    _INT,
    HID_INT_OUT_EP_SIZE,
    0x01
};

/* Configuration 2 Descriptor */
CFG02={
    /* Configuration Descriptor */
    sizeof(USB_CFG_DSC),    // Size of this descriptor in bytes
    DSC_CFG,                // CONFIGURATION descriptor type
    sizeof(cfg02),          // Total length of data for this cfg
    1,                      // Number of interfaces in this cfg
    2,                      // Index value of this configuration
    4,                      // Configuration string index
    _DEFAULT,               // Attributes, see usbdefs_std_dsc.h
    50,                     // Max power consumption (2X mA)

    /* Interface Descriptor */
    sizeof(USB_INTF_DSC),   // Size of this descriptor in bytes
    DSC_INTF,               // INTERFACE descriptor type
    0,                      // Interface Number
    0,                      // Alternate Setting Number
    2,                      // Number of endpoints in this intf
    0xFF,                   // Class code (vendor defined)
    0,                      // Subclass code
    0,                      // Protocol code
    0,                      // Interface string index

    /* Endpoint Descriptor 1 in */
    sizeof(USB_EP_DSC),
    DSC_EP,
    _EP01_IN,
    _INT,
    HID_INT_IN_EP_SIZE,
    0x01,

    /* Endpoint Descriptor 1 out */
    sizeof(USB_EP_DSC),
    DSC_EP,
    _EP01_OUT,
    _INT,
    HID_INT_OUT_EP_SIZE,
    0x01
};

rom struct{byte bLength;byte bDscType;word string[1];}sd000={
sizeof(sd000),DSC_STR,0x0409};

rom struct{byte bLength;byte bDscType;word string[25];}sd001={
sizeof(sd001),DSC_STR,
'M','i','c','r','o','c','h','i','p',' ','T','e','c','h','n','o','l','o','g','y',' ','I','n','c','.'};

rom struct{byte bLength;byte bDscType;word string[35];}sd002={
sizeof(sd002),DSC_STR,
'P','I','C','k','i','t',' ','2',' ','M','i','c','r','o','c','o','n','t','r','o','l','l','e','r',' ','P','r','o','g','r','a','m','m','e','r'};

//rom struct{byte bLength;byte bDscType;word string[10];}sd003={
//sizeof(sd003),DSC_STR,
//'O','l','H','o', 's', 's', 'X', 0, 0, 0};

//rom struct{byte bLength;byte bDscType;word string[24];}sd004={
//sizeof(sd004),DSC_STR,
//'P','I','C','k','i','t',' ','2',' ','C','o','n','f','i','g','u','r','a','t','i','o','n',' ','2'};

rom struct{byte report[29];}hid_rpt01={
    0x06, 0x00, 0xFF,       // Usage Page (Vendor Defined)
    0x09, 0x01,             // Usage (Vendor Usage)
    0xA1, 0x01,             // Collection (Application)
    0x19, 0x01,             //      Usage Minimum (Vendor Usage = 1)
//    0x29, 0x08,             //      Usage Maximum (Vendor Usage = 8)
    0x29, 0x40,             //      Usage Maximum (Vendor Usage = 64)
    0x15, 0x00,             //      Logical Minimum (Vendor Usage = 0)
    0x26, 0xFF, 0x00,       //      Logical Maximum (Vendor Usage = 255)
    0x75, 0x08,             //      Report Size (Vendor Usage = 8)
//    0x95, 0x08,             //      Report Count (Vendor Usage = 8)
    0x95, 0x40,             //      Report Count (Vendor Usage = 64)
    0x81, 0x02,             //      Input (Data, Var, Abs)
    0x19, 0x01,             //      Usage Minimum (Vendor Usage = 1)
//    0x29, 0x08,             //      Usage Maximum (Vendor Usage = 8)
    0x29, 0x40,             //      Usage Maximum (Vendor Usage = 64)
    0x91, 0x02,             //      Output (Data, Var, Ads)
    0xC0};                  // End Collection

rom const unsigned char *rom USB_CD_Ptr[]={&cfg01,&cfg02};
//rom const unsigned char *rom USB_SD_Ptr[]={&sd000,&sd001,&sd002,&sd003,&sd004};
rom const unsigned char *rom USB_SD_Ptr[]={&sd000,&sd001,&sd002};

rom pFunc ClassReqHandler[1]=
{
    &USBCheckHIDRequest
};

#pragma code

/** EOF usbdsc.c ****************************************************/

mcuee avatar Jun 18 '21 06:06 mcuee

Also, @mcuee since this is a PICkit2 and not your own device, have you uninstalled all the Microchip Windows drivers? Vendor drivers usually really mess up USB HID libraries. (Some even create fake HID devices that mask the real device. Not what's going on here I think)

todbot avatar Jun 18 '21 06:06 todbot

@todbot This is a standard HID device and no vendor driver is needed (ignore the second configuration, which was a legacy from PICkit 1, and meant for macOS last time). I know this Microchip PICKit 2 very well as I was helping Microchip to test the cross platform pk2cmd applications many years ago.

mcuee avatar Jun 18 '21 06:06 mcuee

The HID Report Descriptors that HIDSharp (and win-hid-dump) emit are reconstructions based on what is available via Windows HID APIs, it is not the actual descriptor sent by the device, but rather a "consolation-of-a-parsed-data-structure".

It should be semantically (to the OS) the same, however. If it's not, it usually means the descriptor sent by the device is wrong in some subtle way. For vendor usages, this doesn't much matter, as then all that really matters is REPORT_ID, REPORT_COUNT, and REPORT_SIZE

@todbot This is a good point. In that case, it seems #262 is actually okay for Microchip PICkit 2. Report size of 8 bytes is correct. Report count of 1 is actually correct as well. Report ID is in fact also correct (0, or no report ID).

mcuee avatar Jun 18 '21 06:06 mcuee