Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows report descriptor reconstructor unit test #343

Conversation

JoergAtGithub
Copy link
Contributor

This PR is based on #306 and implements a unit test, which allows to test the report descriptor reconstructor offline, whithout access to HID devices. It runs on GitHub build actions.
To allow this, I stored the preparsed data of the HID devices in text files. The test reads this data and executes the reconstructor code and compares the output with a reference file.
For each HID device, the unit test contains 3 files:
*.pp_data -> Text file with the Preparsed Data
_expected.rpt_desc -> The expected output of the reconstructor
_real.rpt_desc -> The real report descriptor of the device

JoergAtGithub and others added 30 commits April 10, 2021 14:03
- macOS implementation for it;
- stubs for all other platforms;
…ate to the hid_get_report_descriptor API function of PR libusb#303
- macOS implementation for it;
- stubs for all other platforms;
Added debug output for possible failure cases in button array code
…s_report_descriptor_reconstructor_reengineered_pp_struct
…ascending order (IsMultipleItemsForArray == 1)
…tton field

Restructured main item list helper functions for better readability
@mcuee
Copy link
Member

mcuee commented Oct 14, 2021

Cmake build is okay.

C:\work\hid\hidapi_test4\build\x64 [windows_preparsed_data_dump ≡ +1 ~0 -0 !]> .\pp_data_dump.exe
pp_data_dump tool. Compiled with hidapi version 0.11.0, runtime version 0.11.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col03#7&1ebb799e&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 80 (01)
Dumped Preparsed Data to 046D_C534_0080_0001.pp_data

Device Found
  type: 046d b010
  path: \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col06#8&1cf1c1b9&3&0005#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 34885dab0c12
  Manufacturer: Logitech
  Product:      Logitech Bluetooth Wireless Mouse
  Release:      0
  Interface:    -1
  Usage (page): 01 (0C)
Dumped Preparsed Data to 046D_B010_0001_000C.pp_data

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col04#7&1ebb799e&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 01 (FF00)
Dumped Preparsed Data to 046D_C534_0001_FF00.pp_data

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col05#7&1ebb799e&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 02 (FF00)
Dumped Preparsed Data to 046D_C534_0002_FF00.pp_data

Device Found
  type: 0488 121f
  path: \\?\hid#dell091a&col01#5&99b72d3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 9999
  Manufacturer: Microsoft
  Product:      HIDI2C Device
  Release:      40D
  Interface:    -1
  Usage (page): 02 (01)
Dumped Preparsed Data to 0488_121F_0002_0001.pp_data

Device Found
  type: 8087 0a1e
  path: \\?\hid#intc816&col01#3&36a7043c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      200
  Interface:    -1
  Usage (page): 0C (01)
Dumped Preparsed Data to 8087_0A1E_000C_0001.pp_data

Device Found
  type: 044e 1212
  path: \\?\hid#vid_044e&pid_1212&col01&col02#7&290aacae&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
  serial_number:
  Manufacturer:
  Product:
  Release:      0
  Interface:    -1
  Usage (page): 06 (01)
Dumped Preparsed Data to 044E_1212_0006_0001.pp_data

Device Found
  type: 8087 0a1e
  path: \\?\hid#intc816&col02#3&36a7043c&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      200
  Interface:    -1
  Usage (page): 0D (01)
Dumped Preparsed Data to 8087_0A1E_000D_0001.pp_data

Device Found
  type: 044e 1212
  path: \\?\hid#vid_044e&pid_1212&col01&col01#7&290aacae&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      0
  Interface:    -1
  Usage (page): 02 (01)
Dumped Preparsed Data to 044E_1212_0002_0001.pp_data

Device Found
  type: 0488 121f
  path: \\?\hid#dell091a&col02#5&99b72d3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 9999
  Manufacturer: Microsoft
  Product:      HIDI2C Device
  Release:      40D
  Interface:    -1
  Usage (page): 05 (0D)
Dumped Preparsed Data to 0488_121F_0005_000D.pp_data

Device Found
  type: 047f c056
  path: \\?\hid#vid_047f&pid_c056&mi_03&col01#f&39e6f119&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: D1CEC32927974D5F9BD6B2AEBF2EA8E3
  Manufacturer: Plantronics
  Product:      Plantronics Blackwire 3220 Series
  Release:      210
  Interface:    3
  Usage (page): 01 (0C)
Dumped Preparsed Data to 047F_C056_0001_000C.pp_data

Device Found
  type: 045e 0000
  path: \\?\hid#converteddevice&col02#5&379854aa&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      0
  Interface:    -1
  Usage (page): 01 (0C)
Dumped Preparsed Data to 045E_0000_0001_000C.pp_data

Device Found
  type: 047f c056
  path: \\?\hid#vid_047f&pid_c056&mi_03&col02#f&39e6f119&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: D1CEC32927974D5F9BD6B2AEBF2EA8E3
  Manufacturer: Plantronics
  Product:      Plantronics Blackwire 3220 Series
  Release:      210
  Interface:    3
  Usage (page): 05 (0B)
Dumped Preparsed Data to 047F_C056_0005_000B.pp_data

Device Found
  type: 045e 0000
  path: \\?\hid#converteddevice&col03#5&379854aa&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      0
  Interface:    -1
  Usage (page): 80 (01)
Dumped Preparsed Data to 045E_0000_0080_0001.pp_data

Device Found
  type: 047f c056
  path: \\?\hid#vid_047f&pid_c056&mi_03&col03#f&39e6f119&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: D1CEC32927974D5F9BD6B2AEBF2EA8E3
  Manufacturer: Plantronics
  Product:      Plantronics Blackwire 3220 Series
  Release:      210
  Interface:    3
  Usage (page): 03 (FFA0)
Dumped Preparsed Data to 047F_C056_0003_FFA0.pp_data

Device Found
  type: 0488 121f
  path: \\?\hid#dell091a&col03#5&99b72d3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 9999
  Manufacturer: Microsoft
  Product:      HIDI2C Device
  Release:      40D
  Interface:    -1
  Usage (page): 01 (FF01)
Dumped Preparsed Data to 0488_121F_0001_FF01.pp_data

Device Found
  type: 0488 121f
  path: \\?\hid#dell091a&col04#5&99b72d3&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 9999
  Manufacturer: Microsoft
  Product:      HIDI2C Device
  Release:      40D
  Interface:    -1
  Usage (page): 01 (FF02)
Dumped Preparsed Data to 0488_121F_0001_FF02.pp_data

Device Found
  type: 046d b010
  path: \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col05#8&1cf1c1b9&3&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
  serial_number: 34885dab0c12
  Manufacturer: Logitech
  Product:      Logitech Bluetooth Wireless Mouse
  Release:      0
  Interface:    -1
  Usage (page): 06 (01)
Dumped Preparsed Data to 046D_B010_0006_0001.pp_data

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_00#7&51bc424&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    0
  Usage (page): 06 (01)
Dumped Preparsed Data to 046D_C534_0006_0001.pp_data

Device Found
  type: 046d b010
  path: \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col01#8&1cf1c1b9&3&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 34885dab0c12
  Manufacturer: Logitech
  Product:      Logitech Bluetooth Wireless Mouse
  Release:      0
  Interface:    -1
  Usage (page): 02 (01)
Dumped Preparsed Data to 046D_B010_0002_0001.pp_data

Device Found
  type: 0488 121f
  path: \\?\hid#dell091a&col05#5&99b72d3&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 9999
  Manufacturer: Microsoft
  Product:      HIDI2C Device
  Release:      40D
  Interface:    -1
  Usage (page): 0E (0D)
Dumped Preparsed Data to 0488_121F_000E_000D.pp_data

Device Found
  type: 046d b010
  path: \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col02#8&1cf1c1b9&3&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 34885dab0c12
  Manufacturer: Logitech
  Product:      Logitech Bluetooth Wireless Mouse
  Release:      0
  Interface:    -1
  Usage (page): 01 (0C)
Dumped Preparsed Data to 046D_B010_0001_000C.pp_data

Device Found
  type: 046d b010
  path: \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col03#8&1cf1c1b9&3&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 34885dab0c12
  Manufacturer: Logitech
  Product:      Logitech Bluetooth Wireless Mouse
  Release:      0
  Interface:    -1
  Usage (page): 01 (FF00)
Dumped Preparsed Data to 046D_B010_0001_FF00.pp_data

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col01#7&1ebb799e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 02 (01)
Dumped Preparsed Data to 046D_C534_0002_0001.pp_data

Device Found
  type: 046d b010
  path: \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b010&col04#8&1cf1c1b9&3&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 34885dab0c12
  Manufacturer: Logitech
  Product:      Logitech Bluetooth Wireless Mouse
  Release:      0
  Interface:    -1
  Usage (page): 02 (FF00)
Dumped Preparsed Data to 046D_B010_0002_FF00.pp_data

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col02#7&1ebb799e&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 01 (0C)
Dumped Preparsed Data to 046D_C534_0001_000C.pp_data

Device Found
  type: 045e 0000
  path: \\?\hid#converteddevice&col01#5&379854aa&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
  serial_number:
  Manufacturer:
  Product:
  Release:      0
  Interface:    -1
  Usage (page): 06 (01)
Dumped Preparsed Data to 045E_0000_0006_0001.pp_data

@mcuee
Copy link
Member

mcuee commented Oct 14, 2021

Zip of the dump data
dump_windows10_dell_laptop.zip
.

@JoergAtGithub JoergAtGithub force-pushed the windows_report_descriptor_reconstructor_unit_test branch from 21135c4 to e327426 Compare October 14, 2021 19:59
@JoergAtGithub
Copy link
Contributor Author

@mcuee I added tests for your devices, where I could find the real report descriptor in the comments from #262/#306. Without the real report descriptor, I can't check the correctness of the generated data.
Could you please provide the real report descriptors also for:

  • Microsoft HIDI2C Device 0488 121f
  • 8087 0a1e
  • 044e 1212
  • Plantronics Blackwire 3220 Series 047f c056
  • 045e 0000

@mcuee mcuee added the Windows Related to Windows backend label Oct 19, 2021
@mcuee
Copy link
Member

mcuee commented Oct 19, 2021

I added tests for your devices, where I could find the real report descriptor in the comments from #262/#306. Without the real report descriptor, I can't check the correctness of the generated data. Could you please provide the real report descriptors also for:

  • Microsoft HIDI2C Device 0488 121f
  • 8087 0a1e
  • 044e 1212
  • Plantronics Blackwire 3220 Series 047f c056
  • 045e 0000

Unfortunately I do not know how to get the real report descriptor of the following built-in HID devices.

  • Microsoft HIDI2C Device 0488 121f
  • 8087 0a1e (Intel Bluetooth)
  • 044e 1212 (Alps touchpad)
  • 045e 0000 (Microsoft virtual HID device)

@mcuee
Copy link
Member

mcuee commented Oct 19, 2021

As for the Plantronics Blackwire 3220 Series 047f c056, I think I have posted it before, I get it from macOS USB Prober application. Let me check where I posted it.

Edit to add: sorry the following is for 047f:c025. I will get 047f:c056 later.

#306 (comment)
macOS USB Prober output for the Plantronics C320-M USB Headset (Blackwire 3220 Series USB Headset). This is a pretty complicated device.

click to expand
Full Speed device @ 11 (0x02112600): .............................................   Composite device: "Plantronics C320-M"
    Port Information:   0x0018
           Not Captive
           External Device
           Connected
           Enabled
    Number Of Endpoints (includes EP0):   
        Total Endpoints for Configuration 1 (current):   4
    Device Descriptor   
        Descriptor Version Number:   0x0200
        Device Class:   0   (Composite)
        Device Subclass:   0
        Device Protocol:   0
        Device MaxPacketSize:   64
        Device VendorID/ProductID:   0x047F/0xC025   (Plantronics, Inc.)
        Device Version Number:   0x0135
        Number of Configurations:   1
        Manufacturer String:   1 "Plantronics"
        Product String:   2 "Plantronics C320-M"
        Serial Number String:   3 "CB13A3E40E8E47D6A40769C27E90A38E"
    Configuration Descriptor (current config)   
        Length (and contents):   288
            Raw Descriptor (hex)    0000: 09 02 20 01 04 01 00 A0  32 09 04 00 00 00 01 01  
            Raw Descriptor (hex)    0010: 00 00 0A 24 01 00 01 72  00 02 01 02 0C 24 02 0A  
            Raw Descriptor (hex)    0020: 01 02 00 02 03 00 00 06  0A 24 06 0B 0A 01 03 00  
            Raw Descriptor (hex)    0030: 00 00 0C 24 02 01 02 04  06 02 03 00 00 00 0A 24  
            Raw Descriptor (hex)    0040: 06 02 01 01 03 00 00 00  07 24 05 08 01 02 00 09  
            Raw Descriptor (hex)    0050: 24 03 03 01 01 00 08 00  0C 24 02 04 01 01 00 02  
            Raw Descriptor (hex)    0060: 03 00 00 00 0A 24 06 05  0C 01 01 02 02 00 09 24  
            Raw Descriptor (hex)    0070: 03 06 02 04 01 05 00 0D  24 04 0C 02 04 0B 02 03  
            Raw Descriptor (hex)    0080: 00 00 00 00 09 04 01 00  00 01 02 00 00 09 04 01  
            Raw Descriptor (hex)    0090: 01 01 01 02 00 00 07 24  01 03 01 01 00 17 24 02  
            Raw Descriptor (hex)    00a0: 01 02 02 10 05 40 1F 00  80 3E 00 00 7D 00 44 AC  
            Raw Descriptor (hex)    00b0: 00 80 BB 00 09 05 81 05  C8 00 01 00 00 07 25 01  
            Raw Descriptor (hex)    00c0: 01 00 00 00 09 04 02 00  00 01 02 00 00 09 04 02  
            Raw Descriptor (hex)    00d0: 01 01 01 02 00 00 07 24  01 04 03 01 00 1A 24 02  
            Raw Descriptor (hex)    00e0: 01 02 02 10 06 40 1F 00  80 3E 00 C0 5D 00 00 7D  
            Raw Descriptor (hex)    00f0: 00 44 AC 00 80 BB 00 09  05 01 09 C0 00 01 00 00  
            Raw Descriptor (hex)    0100: 07 25 01 01 01 04 00 09  04 03 00 01 03 00 00 00  
            Raw Descriptor (hex)    0110: 09 21 11 01 00 01 22 6F  01 07 05 84 03 25 00 01  
            Unknown Descriptor   0120: 
        Number of Interfaces:   4
        Configuration Value:   1
        Attributes:   0xA0 (bus-powered, remote wakeup)
        MaxPower:   100 mA
        Interface #0 - Audio/Control   
            Alternate Setting   0
            Number of Endpoints   0
            Interface Class:   1   (Audio)
            Interface Subclass;   1   (Control)
            Interface Protocol:   0
            Audio Control Class Specific Header   
                Descriptor Version Number:   01.00
                Class Specific Size:   114
                Number of Audio Interfaces:   2
                Audio Interface Number:   1
                Audio Interface Number:   2
                Dump Contents (hex):   0A 24 01 00 01 72 00 02 01 02 
            Audio Class Specific Input Terminal   
                Terminal ID:   10
                Input Terminal Type:   0x201 (Microphone)
                OutTerminal ID:   0 [NONE]
                Number of Channels:   2
                Spatial config of channels:   0000000000000011
                                  ^.  Left Front
                                 ^..  Right Front
                String index for first logical channel:   0
                Terminal Name String Index:   6
            Audio Class Specific Feature   
                Unit ID:   11
                Source ID:   10
                Control Size:   1
                Number of Channels (ch):   2
                    Master Channel:......................... ( Volume, Mute )
                    Left Front:............................. (  )
                    Right Front:............................ (  )
                Feature Unit Name String Index:   0
                Dump Contents (hex):   0A 24 06 0B 0A 01 03 00 00 00 
            Audio Class Specific Input Terminal   
                Terminal ID:   1
                Input Terminal Type:   0x402 (Bi-directional Headset)
                OutTerminal ID:   6
                Number of Channels:   2
                Spatial config of channels:   0000000000000011
                                  ^.  Left Front
                                 ^..  Right Front
                String index for first logical channel:   0
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Feature   
                Unit ID:   2
                Source ID:   1
                Control Size:   1
                Number of Channels (ch):   2
                    Master Channel:......................... ( Volume, Mute )
                    Left Front:............................. (  )
                    Right Front:............................ (  )
                Feature Unit Name String Index:   0
                Dump Contents (hex):   0A 24 06 02 01 01 03 00 00 00 
            Audio Class Specific Selector Unit   
                Unit ID:   8
                Number of pins:   1
                Source ID Pin[0]:   2
                Dump Contents (hex):   07 24 05 08 01 02 00 
            Audio Class Specific Output Terminal   
                Terminal ID:   3
                Output Terminal Type:   0x101 (USB Isochronous Stream)
                InTerminal ID:   0 [NONE]
                Source ID:   8
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Input Terminal   
                Terminal ID:   4
                Input Terminal Type:   0x101 (USB streaming)
                OutTerminal ID:   0 [NONE]
                Number of Channels:   2
                Spatial config of channels:   0000000000000011
                                  ^.  Left Front
                                 ^..  Right Front
                String index for first logical channel:   0
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Feature   
                Unit ID:   5
                Source ID:   12
                Control Size:   1
                Number of Channels (ch):   2
                    Master Channel:......................... ( Mute )
                    Left Front:............................. ( Volume )
                    Right Front:............................ ( Volume )
                Feature Unit Name String Index:   0
                Dump Contents (hex):   0A 24 06 05 0C 01 01 02 02 00 
            Audio Class Specific Output Terminal   
                Terminal ID:   6
                Output Terminal Type:   0x402 (Bi-directional Headset)
                InTerminal ID:   1
                Source ID:   5
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Mixer Unit   
                Unit ID:   12
                Number of pins:   2
                Source ID Pin[1]:   4
                Source ID Pin[2]:   11
                Dump Contents (hex):   0D 24 04 0C 02 04 0B 02 03 00 00 00 00 
        Interface #1 - Audio/Streaming   
            Alternate Setting   0
            Number of Endpoints   0
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
        Interface #1 - Audio/Streaming (#1)   
            Alternate Setting   1
            Number of Endpoints   1
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
            Audio Control Class Specific Header   
                Audio Stream General   
                    Endpoint Terminal ID:   3
                    Delay:   1 frames     
                    Format Tag:   0x0001 (PCM)
            Audio Class Specific Audio Data Format   
                Audio Stream Format Type Desc.   
                    Format Type:   1 PCM
                    Number Of Channels:   2 STEREO
                    Sub Frame Size:   2
                    Bit Resolution:   16
                    Sample Frequency Type:   0x05 (Discrete)
                    Sample Frequency:    8000 Hz
                    Sample Frequency:   16000 Hz
                    Sample Frequency:   32000 Hz
                    Sample Frequency:   44100 Hz
                    Sample Frequency:   48000 Hz
            Endpoint 0x81 - Isochronous Input   
                Address:   0x81  (IN)
                Attributes:   0x05  (Isochronous asynchronous data endpoint)
                Max Packet Size:   200
                Polling Interval:   1 ms
            Class-Specific AS Audio EndPoint   
                Attributes:   0x01  Sample Frequency,  
                bLockDelayUnits:   0x00  (UNDEFINED)
                wLockDelay:   0 
        Interface #2 - Audio/Streaming   
            Alternate Setting   0
            Number of Endpoints   0
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
        Interface #2 - Audio/Streaming (#1)   
            Alternate Setting   1
            Number of Endpoints   1
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
            Audio Control Class Specific Header   
                Audio Stream General   
                    Endpoint Terminal ID:   4
                    Delay:   3 frames     
                    Format Tag:   0x0001 (PCM)
            Audio Class Specific Audio Data Format   
                Audio Stream Format Type Desc.   
                    Format Type:   1 PCM
                    Number Of Channels:   2 STEREO
                    Sub Frame Size:   2
                    Bit Resolution:   16
                    Sample Frequency Type:   0x06 (Discrete)
                    Sample Frequency:    8000 Hz
                    Sample Frequency:   16000 Hz
                    Sample Frequency:   24000 Hz
                    Sample Frequency:   32000 Hz
                    Sample Frequency:   44100 Hz
                    Sample Frequency:   48000 Hz
            Endpoint 0x01 - Isochronous Output   
                Address:   0x01  (OUT)
                Attributes:   0x09  (Isochronous adaptive data endpoint)
                Max Packet Size:   192
                Polling Interval:   1 ms
            Class-Specific AS Audio EndPoint   
                Attributes:   0x01  Sample Frequency,  
                bLockDelayUnits:   0x01  (Milliseconds)
                wLockDelay:   4 ms
        Interface #3 - HID   
            Alternate Setting   0
            Number of Endpoints   1
            Interface Class:   3   (HID)
            Interface Subclass;   0
            Interface Protocol:   0
            HID Descriptor   
                Descriptor Version Number:   0x0111
                Country Code:   0
                Descriptor Count:   1
                Descriptor 1   
                    Type:   0x22  (Report Descriptor)
                    Length (and contents):   367
                        Raw Descriptor (hex)    0000: 05 0C 09 01 A1 01 85 01  15 00 25 01 09 E9 09 EA  
                        Raw Descriptor (hex)    0010: 75 01 95 02 81 06 95 06  81 01 85 02 05 0C 09 00  
                        Raw Descriptor (hex)    0020: 95 10 81 02 85 04 09 00  75 08 95 24 91 02 85 05  
                        Raw Descriptor (hex)    0030: 09 00 95 20 81 02 85 06  09 00 95 24 91 02 85 07  
                        Raw Descriptor (hex)    0040: 09 00 95 20 81 02 C0 05  0B 09 05 A1 01 85 08 15  
                        Raw Descriptor (hex)    0050: 00 25 01 09 2F 75 01 95  01 81 06 09 20 09 21 75  
                        Raw Descriptor (hex)    0060: 01 95 02 81 22 95 05 81  01 05 08 85 09 09 09 95  
                        Raw Descriptor (hex)    0070: 01 91 22 95 07 91 01 85  17 09 17 95 01 91 22 95  
                        Raw Descriptor (hex)    0080: 07 91 01 85 18 09 18 95  01 91 22 95 07 91 01 85  
                        Raw Descriptor (hex)    0090: 1E 09 1E 95 01 91 22 95  07 91 01 85 20 09 20 95  
                        Raw Descriptor (hex)    00a0: 01 91 22 95 07 91 01 85  2A 09 2A 95 01 91 22 95  
                        Raw Descriptor (hex)    00b0: 07 91 01 C0 06 A0 FF 09  01 A1 01 85 03 09 30 75  
                        Raw Descriptor (hex)    00c0: 08 95 20 91 02 85 03 09  30 75 08 95 20 81 02 85  
                        Raw Descriptor (hex)    00d0: 14 09 B1 09 B2 09 B5 09  B7 09 B3 15 00 25 01 75  
                        Raw Descriptor (hex)    00e0: 01 95 05 81 06 95 03 81  01 85 15 09 8C 15 00 27  
                        Raw Descriptor (hex)    00f0: FF FF 00 00 75 10 95 01  81 22 85 19 09 8D 09 8F  
                        Raw Descriptor (hex)    0100: 09 9E 09 DC 15 00 25 01  75 01 95 04 91 22 09 D2  
                        Raw Descriptor (hex)    0110: 09 D9 15 00 25 01 75 01  95 02 91 06 95 02 91 01  
                        Raw Descriptor (hex)    0120: 85 1A 09 B5 15 00 25 01  75 01 95 01 91 22 95 07  
                        Raw Descriptor (hex)    0130: 91 01 85 1B 09 CF 09 B5  09 DE 75 01 95 03 B1 22  
                        Raw Descriptor (hex)    0140: 09 D8 95 01 B1 23 95 04  B1 01 09 09 09 17 09 18  
                        Raw Descriptor (hex)    0150: 09 1E 09 20 09 2A 75 01  95 06 B1 22 95 02 B1 01  
                        Raw Descriptor (hex)    0160: 85 1F 09 9C 75 01 95 01  81 06 95 07 81 01 C0 
                    Parsed Report Descriptor:   
                          Usage Page    (Consumer) 
                          Usage 1 (0x1)    
                              Collection (Application)    
                                ReportID................    (1)  
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Usage 233 (0xe9)    
                                Usage 234 (0xea)    
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Report Count............    (6)  
                                Input...................   (Constant, Array, Absolute) 
                                ReportID................    (2)  
                                Usage Page    (Consumer) 
                                Usage 0 (0x0)    
                                Report Count............    (16)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                ReportID................    (4)  
                                Usage 0 (0x0)    
                                Report Size.............    (8)  
                                Report Count............    (36)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (5)  
                                Usage 0 (0x0)    
                                Report Count............    (32)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                ReportID................    (6)  
                                Usage 0 (0x0)    
                                Report Count............    (36)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (7)  
                                Usage 0 (0x0)    
                                Report Count............    (32)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                              End Collection     
                          Usage Page    (Telephony Device) 
                          Usage 5 (0x5)    
                              Collection (Application)    
                                ReportID................    (8)  
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Usage 47 (0x2f)    
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Usage 32 (0x20)    
                                Usage 33 (0x21)    
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield) 
                                Report Count............    (5)  
                                Input...................   (Constant, Array, Absolute) 
                                Usage Page    (LED) 
                                ReportID................    (9)  
                                Usage 9 (0x9)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (23)  
                                Usage 23 (0x17)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (24)  
                                Usage 24 (0x18)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (30)  
                                Usage 30 (0x1e)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (32)  
                                Usage 32 (0x20)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (42)  
                                Usage 42 (0x2a)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                              End Collection     
                          Usage Page    (Vendor defined 160) 
                          Usage 1 (0x1)    
                              Collection (Application)    
                                ReportID................    (3)  
                                Usage 48 (0x30)    
                                Report Size.............    (8)  
                                Report Count............    (32)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (3)  
                                Usage 48 (0x30)    
                                Report Size.............    (8)  
                                Report Count............    (32)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                ReportID................    (20)  
                                Usage 177 (0xb1)    
                                Usage 178 (0xb2)    
                                Usage 181 (0xb5)    
                                Usage 183 (0xb7)    
                                Usage 179 (0xb3)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (5)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Report Count............    (3)  
                                Input...................   (Constant, Array, Absolute) 
                                ReportID................    (21)  
                                Usage 140 (0x8c)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (65535)  
                                Report Size.............    (16)  
                                Report Count............    (1)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield) 
                                ReportID................    (25)  
                                Usage 141 (0x8d)    
                                Usage 143 (0x8f)    
                                Usage 158 (0x9e)    
                                Usage 220 (0xdc)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (4)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Usage 210 (0xd2)    
                                Usage 217 (0xd9)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Output..................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (2)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (26)  
                                Usage 181 (0xb5)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (27)  
                                Usage 207 (0xcf)    
                                Usage 181 (0xb5)    
                                Usage 222 (0xde)    
                                Report Size.............    (1)  
                                Report Count............    (3)  
                                Feature.................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Usage 216 (0xd8)    
                                Report Count............    (1)  
                                Feature.................   (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (4)  
                                Feature.................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                Usage 9 (0x9)    
                                Usage 23 (0x17)    
                                Usage 24 (0x18)    
                                Usage 30 (0x1e)    
                                Usage 32 (0x20)    
                                Usage 42 (0x2a)    
                                Report Size.............    (1)  
                                Report Count............    (6)  
                                Feature.................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (2)  
                                Feature.................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (31)  
                                Usage 156 (0x9c)    
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Report Count............    (7)  
                                Input...................   (Constant, Array, Absolute) 
                              End Collection     
            Endpoint 0x84 - Interrupt Input   
                Address:   0x84  (IN)
                Attributes:   0x03  (Interrupt)
                Max Packet Size:   37
                Polling Interval:   1 ms```

</details>

@mcuee
Copy link
Member

mcuee commented Oct 20, 2021

@JoergAtGithub
Here is the output from macOS USB Prober about 0x047F/0xC056 Plantronics headset.

Full Speed device @ 11 (0x02212200): .............................................   Composite device: "Plantronics Blackwire 3220 Series"
    Port Information:   0x0018
           Not Captive
           External Device
           Connected
           Enabled
    Number Of Endpoints (includes EP0):   
        Total Endpoints for Configuration 1 (current):   4
    Device Descriptor   
        Descriptor Version Number:   0x0200
        Device Class:   0   (Composite)
        Device Subclass:   0
        Device Protocol:   0
        Device MaxPacketSize:   64
        Device VendorID/ProductID:   0x047F/0xC056   (Plantronics, Inc.)
        Device Version Number:   0x0210
        Number of Configurations:   1
        Manufacturer String:   1 "Plantronics"
        Product String:   2 "Plantronics Blackwire 3220 Series"
        Serial Number String:   3 "D1CEC32927974D5F9BD6B2AEBF2EA8E3"
    Configuration Descriptor (current config)   
        Length (and contents):   288
            Raw Descriptor (hex)    0000: 09 02 20 01 04 01 00 A0  32 09 04 00 00 00 01 01  
            Raw Descriptor (hex)    0010: 00 00 0A 24 01 00 01 72  00 02 01 02 0C 24 02 0A  
            Raw Descriptor (hex)    0020: 01 02 00 02 03 00 00 06  0A 24 06 0B 0A 01 03 00  
            Raw Descriptor (hex)    0030: 00 00 0C 24 02 01 02 04  06 02 03 00 00 00 0A 24  
            Raw Descriptor (hex)    0040: 06 02 01 01 03 00 00 00  07 24 05 08 01 02 00 09  
            Raw Descriptor (hex)    0050: 24 03 03 01 01 00 08 00  0C 24 02 04 01 01 00 02  
            Raw Descriptor (hex)    0060: 03 00 00 00 0A 24 06 05  0C 01 01 02 02 00 09 24  
            Raw Descriptor (hex)    0070: 03 06 02 04 01 05 00 0D  24 04 0C 02 04 0B 02 03  
            Raw Descriptor (hex)    0080: 00 00 00 00 09 04 01 00  00 01 02 00 00 09 04 01  
            Raw Descriptor (hex)    0090: 01 01 01 02 00 00 07 24  01 03 01 01 00 17 24 02  
            Raw Descriptor (hex)    00a0: 01 02 02 10 05 40 1F 00  80 3E 00 00 7D 00 44 AC  
            Raw Descriptor (hex)    00b0: 00 80 BB 00 09 05 81 05  C8 00 01 00 00 07 25 01  
            Raw Descriptor (hex)    00c0: 01 00 00 00 09 04 02 00  00 01 02 00 00 09 04 02  
            Raw Descriptor (hex)    00d0: 01 01 01 02 00 00 07 24  01 04 03 01 00 1A 24 02  
            Raw Descriptor (hex)    00e0: 01 02 02 10 06 40 1F 00  80 3E 00 C0 5D 00 00 7D  
            Raw Descriptor (hex)    00f0: 00 44 AC 00 80 BB 00 09  05 01 09 C0 00 01 00 00  
            Raw Descriptor (hex)    0100: 07 25 01 01 01 04 00 09  04 03 00 01 03 00 00 00  
            Raw Descriptor (hex)    0110: 09 21 11 01 00 01 22 75  01 07 05 84 03 25 00 01  
            Unknown Descriptor   0120: 
        Number of Interfaces:   4
        Configuration Value:   1
        Attributes:   0xA0 (bus-powered, remote wakeup)
        MaxPower:   100 mA
        Interface #0 - Audio/Control   
            Alternate Setting   0
            Number of Endpoints   0
            Interface Class:   1   (Audio)
            Interface Subclass;   1   (Control)
            Interface Protocol:   0
            Audio Control Class Specific Header   
                Descriptor Version Number:   01.00
                Class Specific Size:   114
                Number of Audio Interfaces:   2
                Audio Interface Number:   1
                Audio Interface Number:   2
                Dump Contents (hex):   0A 24 01 00 01 72 00 02 01 02 
            Audio Class Specific Input Terminal   
                Terminal ID:   10
                Input Terminal Type:   0x201 (Microphone)
                OutTerminal ID:   0 [NONE]
                Number of Channels:   2
                Spatial config of channels:   0000000000000011
                                  ^.  Left Front
                                 ^..  Right Front
                String index for first logical channel:   0
                Terminal Name String Index:   6
            Audio Class Specific Feature   
                Unit ID:   11
                Source ID:   10
                Control Size:   1
                Number of Channels (ch):   2
                    Master Channel:......................... ( Volume, Mute )
                    Left Front:............................. (  )
                    Right Front:............................ (  )
                Feature Unit Name String Index:   0
                Dump Contents (hex):   0A 24 06 0B 0A 01 03 00 00 00 
            Audio Class Specific Input Terminal   
                Terminal ID:   1
                Input Terminal Type:   0x402 (Bi-directional Headset)
                OutTerminal ID:   6
                Number of Channels:   2
                Spatial config of channels:   0000000000000011
                                  ^.  Left Front
                                 ^..  Right Front
                String index for first logical channel:   0
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Feature   
                Unit ID:   2
                Source ID:   1
                Control Size:   1
                Number of Channels (ch):   2
                    Master Channel:......................... ( Volume, Mute )
                    Left Front:............................. (  )
                    Right Front:............................ (  )
                Feature Unit Name String Index:   0
                Dump Contents (hex):   0A 24 06 02 01 01 03 00 00 00 
            Audio Class Specific Selector Unit   
                Unit ID:   8
                Number of pins:   1
                Source ID Pin[0]:   2
                Dump Contents (hex):   07 24 05 08 01 02 00 
            Audio Class Specific Output Terminal   
                Terminal ID:   3
                Output Terminal Type:   0x101 (USB Isochronous Stream)
                InTerminal ID:   0 [NONE]
                Source ID:   8
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Input Terminal   
                Terminal ID:   4
                Input Terminal Type:   0x101 (USB streaming)
                OutTerminal ID:   0 [NONE]
                Number of Channels:   2
                Spatial config of channels:   0000000000000011
                                  ^.  Left Front
                                 ^..  Right Front
                String index for first logical channel:   0
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Feature   
                Unit ID:   5
                Source ID:   12
                Control Size:   1
                Number of Channels (ch):   2
                    Master Channel:......................... ( Mute )
                    Left Front:............................. ( Volume )
                    Right Front:............................ ( Volume )
                Feature Unit Name String Index:   0
                Dump Contents (hex):   0A 24 06 05 0C 01 01 02 02 00 
            Audio Class Specific Output Terminal   
                Terminal ID:   6
                Output Terminal Type:   0x402 (Bi-directional Headset)
                InTerminal ID:   1
                Source ID:   5
                Terminal Name String Index:   0 [NONE]
            Audio Class Specific Mixer Unit   
                Unit ID:   12
                Number of pins:   2
                Source ID Pin[1]:   4
                Source ID Pin[2]:   11
                Dump Contents (hex):   0D 24 04 0C 02 04 0B 02 03 00 00 00 00 
        Interface #1 - Audio/Streaming   
            Alternate Setting   0
            Number of Endpoints   0
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
        Interface #1 - Audio/Streaming (#1)   
            Alternate Setting   1
            Number of Endpoints   1
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
            Audio Control Class Specific Header   
                Audio Stream General   
                    Endpoint Terminal ID:   3
                    Delay:   1 frames     
                    Format Tag:   0x0001 (PCM)
            Audio Class Specific Audio Data Format   
                Audio Stream Format Type Desc.   
                    Format Type:   1 PCM
                    Number Of Channels:   2 STEREO
                    Sub Frame Size:   2
                    Bit Resolution:   16
                    Sample Frequency Type:   0x05 (Discrete)
                    Sample Frequency:    8000 Hz
                    Sample Frequency:   16000 Hz
                    Sample Frequency:   32000 Hz
                    Sample Frequency:   44100 Hz
                    Sample Frequency:   48000 Hz
            Endpoint 0x81 - Isochronous Input   
                Address:   0x81  (IN)
                Attributes:   0x05  (Isochronous asynchronous data endpoint)
                Max Packet Size:   200
                Polling Interval:   1 ms
            Class-Specific AS Audio EndPoint   
                Attributes:   0x01  Sample Frequency,  
                bLockDelayUnits:   0x00  (UNDEFINED)
                wLockDelay:   0 
        Interface #2 - Audio/Streaming   
            Alternate Setting   0
            Number of Endpoints   0
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
        Interface #2 - Audio/Streaming (#1)   
            Alternate Setting   1
            Number of Endpoints   1
            Interface Class:   1   (Audio)
            Interface Subclass;   2   (Streaming)
            Interface Protocol:   0
            Audio Control Class Specific Header   
                Audio Stream General   
                    Endpoint Terminal ID:   4
                    Delay:   3 frames     
                    Format Tag:   0x0001 (PCM)
            Audio Class Specific Audio Data Format   
                Audio Stream Format Type Desc.   
                    Format Type:   1 PCM
                    Number Of Channels:   2 STEREO
                    Sub Frame Size:   2
                    Bit Resolution:   16
                    Sample Frequency Type:   0x06 (Discrete)
                    Sample Frequency:    8000 Hz
                    Sample Frequency:   16000 Hz
                    Sample Frequency:   24000 Hz
                    Sample Frequency:   32000 Hz
                    Sample Frequency:   44100 Hz
                    Sample Frequency:   48000 Hz
            Endpoint 0x01 - Isochronous Output   
                Address:   0x01  (OUT)
                Attributes:   0x09  (Isochronous adaptive data endpoint)
                Max Packet Size:   192
                Polling Interval:   1 ms
            Class-Specific AS Audio EndPoint   
                Attributes:   0x01  Sample Frequency,  
                bLockDelayUnits:   0x01  (Milliseconds)
                wLockDelay:   4 ms
        Interface #3 - HID   
            Alternate Setting   0
            Number of Endpoints   1
            Interface Class:   3   (HID)
            Interface Subclass;   0
            Interface Protocol:   0
            HID Descriptor   
                Descriptor Version Number:   0x0111
                Country Code:   0
                Descriptor Count:   1
                Descriptor 1   
                    Type:   0x22  (Report Descriptor)
                    Length (and contents):   373
                        Raw Descriptor (hex)    0000: 05 0C 09 01 A1 01 85 01  15 00 25 01 09 E9 09 EA  
                        Raw Descriptor (hex)    0010: 75 01 95 02 81 06 95 06  81 01 85 02 05 0C 09 00  
                        Raw Descriptor (hex)    0020: 95 10 81 02 85 04 09 00  75 08 95 24 91 02 85 05  
                        Raw Descriptor (hex)    0030: 09 00 95 20 81 02 85 06  09 00 95 24 91 02 85 07  
                        Raw Descriptor (hex)    0040: 09 00 95 20 81 02 C0 05  0B 09 05 A1 01 85 08 15  
                        Raw Descriptor (hex)    0050: 00 25 01 09 2F 75 01 95  01 81 06 09 20 09 21 75  
                        Raw Descriptor (hex)    0060: 01 95 02 81 22 95 05 81  01 05 08 85 09 09 09 95  
                        Raw Descriptor (hex)    0070: 01 91 22 95 07 91 01 85  17 09 17 95 01 91 22 95  
                        Raw Descriptor (hex)    0080: 07 91 01 85 18 09 18 95  01 91 22 95 07 91 01 85  
                        Raw Descriptor (hex)    0090: 1E 09 1E 95 01 91 22 95  07 91 01 85 20 09 20 95  
                        Raw Descriptor (hex)    00a0: 01 91 22 95 07 91 01 85  2A 09 2A 95 01 91 22 95  
                        Raw Descriptor (hex)    00b0: 07 91 01 C0 06 A0 FF 09  03 A1 01 85 03 09 30 75  
                        Raw Descriptor (hex)    00c0: 08 95 20 91 02 85 03 09  30 75 08 95 20 81 02 85  
                        Raw Descriptor (hex)    00d0: 14 09 B1 09 B2 09 B5 09  B7 09 B3 15 00 25 01 75  
                        Raw Descriptor (hex)    00e0: 01 95 05 81 06 95 03 81  01 85 15 09 8C 15 00 27  
                        Raw Descriptor (hex)    00f0: FF FF 00 00 75 10 95 01  81 22 85 19 09 8D 09 8F  
                        Raw Descriptor (hex)    0100: 09 9E 09 DC 15 00 25 01  75 01 95 04 91 22 09 D2  
                        Raw Descriptor (hex)    0110: 09 D9 15 00 25 01 75 01  95 02 91 06 95 02 91 01  
                        Raw Descriptor (hex)    0120: 85 1A 09 B5 15 00 25 01  75 01 95 01 91 22 95 07  
                        Raw Descriptor (hex)    0130: 91 01 85 1B 09 CF 09 B5  75 01 95 02 B1 22 09 DE  
                        Raw Descriptor (hex)    0140: 75 01 95 01 B1 23 09 D8  95 01 B1 22 95 04 B1 01  
                        Raw Descriptor (hex)    0150: 09 09 09 17 09 18 09 1E  09 20 09 2A 75 01 95 06  
                        Raw Descriptor (hex)    0160: B1 22 95 02 B1 01 85 1F  09 9C 75 01 95 01 81 06  
                        Raw Descriptor (hex)    0170: 95 07 81 01 C0 
                    Parsed Report Descriptor:   
                          Usage Page    (Consumer) 
                          Usage 1 (0x1)    
                              Collection (Application)    
                                ReportID................    (1)  
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Usage 233 (0xe9)    
                                Usage 234 (0xea)    
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Report Count............    (6)  
                                Input...................   (Constant, Array, Absolute) 
                                ReportID................    (2)  
                                Usage Page    (Consumer) 
                                Usage 0 (0x0)    
                                Report Count............    (16)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                ReportID................    (4)  
                                Usage 0 (0x0)    
                                Report Size.............    (8)  
                                Report Count............    (36)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (5)  
                                Usage 0 (0x0)    
                                Report Count............    (32)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                ReportID................    (6)  
                                Usage 0 (0x0)    
                                Report Count............    (36)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (7)  
                                Usage 0 (0x0)    
                                Report Count............    (32)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                              End Collection     
                          Usage Page    (Telephony Device) 
                          Usage 5 (0x5)    
                              Collection (Application)    
                                ReportID................    (8)  
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Usage 47 (0x2f)    
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Usage 32 (0x20)    
                                Usage 33 (0x21)    
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield) 
                                Report Count............    (5)  
                                Input...................   (Constant, Array, Absolute) 
                                Usage Page    (LED) 
                                ReportID................    (9)  
                                Usage 9 (0x9)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (23)  
                                Usage 23 (0x17)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (24)  
                                Usage 24 (0x18)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (30)  
                                Usage 30 (0x1e)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (32)  
                                Usage 32 (0x20)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (42)  
                                Usage 42 (0x2a)    
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                              End Collection     
                          Usage Page    (Vendor defined 160) 
                          Usage 3 (0x3)    
                              Collection (Application)    
                                ReportID................    (3)  
                                Usage 48 (0x30)    
                                Report Size.............    (8)  
                                Report Count............    (32)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (3)  
                                Usage 48 (0x30)    
                                Report Size.............    (8)  
                                Report Count............    (32)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                ReportID................    (20)  
                                Usage 177 (0xb1)    
                                Usage 178 (0xb2)    
                                Usage 181 (0xb5)    
                                Usage 183 (0xb7)    
                                Usage 179 (0xb3)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (5)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Report Count............    (3)  
                                Input...................   (Constant, Array, Absolute) 
                                ReportID................    (21)  
                                Usage 140 (0x8c)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (65535)  
                                Report Size.............    (16)  
                                Report Count............    (1)  
                                Input...................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield) 
                                ReportID................    (25)  
                                Usage 141 (0x8d)    
                                Usage 143 (0x8f)    
                                Usage 158 (0x9e)    
                                Usage 220 (0xdc)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (4)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Usage 210 (0xd2)    
                                Usage 217 (0xd9)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Output..................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (2)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (26)  
                                Usage 181 (0xb5)    
                                Logical Minimum.........    (0)  
                                Logical Maximum.........    (1)  
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Output..................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (7)  
                                Output..................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (27)  
                                Usage 207 (0xcf)    
                                Usage 181 (0xb5)    
                                Report Size.............    (1)  
                                Report Count............    (2)  
                                Feature.................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Usage 222 (0xde)    
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Feature.................   (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Usage 216 (0xd8)    
                                Report Count............    (1)  
                                Feature.................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (4)  
                                Feature.................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                Usage 9 (0x9)    
                                Usage 23 (0x17)    
                                Usage 24 (0x18)    
                                Usage 30 (0x1e)    
                                Usage 32 (0x20)    
                                Usage 42 (0x2a)    
                                Report Size.............    (1)  
                                Report Count............    (6)  
                                Feature.................   (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield) 
                                Report Count............    (2)  
                                Feature.................   (Constant, Array, Absolute, No Wrap, Linear, Preferred State, No Null Position, Nonvolatile, Bitfield) 
                                ReportID................    (31)  
                                Usage 156 (0x9c)    
                                Report Size.............    (1)  
                                Report Count............    (1)  
                                Input...................   (Data, Variable, Relative, No Wrap, Linear, Preferred State, No Null Position, Bitfield) 
                                Report Count............    (7)  
                                Input...................   (Constant, Array, Absolute) 
                              End Collection     
            Endpoint 0x84 - Interrupt Input   
                Address:   0x84  (IN)
                Attributes:   0x03  (Interrupt)
                Max Packet Size:   37
                Polling Interval:   1 ms

@JoergAtGithub
Copy link
Contributor Author

hut1_12v1_apendixB_delimiter_example.txt

@mcuee: I attached a file hut1_12v1_apendixB_delimiter_example.txt , where I typed manually the report descriptor for the the Delimiter Example from the USB HID Usage table specification 12v2.
The delimiter feature, where a device (or control) can have multiple alternative usage pages/usages is not used in any of the real example devices. And the official example covers several edge cases.
Could you try to program this report descriptor to your Microchip PICkit device, and than read the Report Descriptor using MacOS and pp_data_dump.exe on Windows?

@mcuee
Copy link
Member

mcuee commented Nov 13, 2021

This may take some time. I have not really touched the PIC FW development for a long time.

But let me try during the holiday period. I have long holiday in December and I can not go anywhere anyway.

@JoergAtGithub
Copy link
Contributor Author

If you can do this, it would really help. Because this functionality is quite complex, and I've no data to test the code.

@JoergAtGithub JoergAtGithub force-pushed the windows_report_descriptor_reconstructor_unit_test branch from e73dedc to 5a80a0d Compare November 20, 2021 08:13
@JoergAtGithub
Copy link
Contributor Author

This may take some time. I have not really touched the PIC FW development for a long time.

But let me try during the holiday period. I have long holiday in December and I can not go anywhere anyway.

Do you see a chance to program the hand coded ReportDescriptor from https://github.com/libusb/hidapi/files/7528936/hut1_12v1_apendixB_delimiter_example.txt ? This would cover the last untested feature of the report descriptor syntax.

@todbot
Copy link
Contributor

todbot commented Dec 28, 2021

If it helps, I can create physical devices that return arbitrary HID Report Descriptors and test what Windows hidapi is returning.

I've been making a small collection of descriptors useful to me in descriptors.h of this test_hardware sketch that runs on any MCU supported by TInyUSB: https://github.com/todbot/hidapitester/tree/master/test_hardware/hidtest_tinyusb

@JoergAtGithub
Copy link
Contributor Author

@todbot : That would be great!
What I need, to complete the coverage of the test case, is the report descriptor from https://github.com/libusb/hidapi/files/7528936/hut1_12v1_apendixB_delimiter_example.txt
This is the hand encoded descriptor of the "Delimiter Example" from the "USB HID Usage table specification 12v2".

You need to connect the device to a Windows PC and execute pp_data_dump.exe which dumps the preparsed data into a text file.
pp_data_dump.exe is a quick and dirty helper program, which I created in https://github.com/JoergAtGithub/hidapi/tree/windows_preparsed_data_dump
Just build it like hidapi. It's similar to the hidapi example program.

If you want to try the report descriptor reconstructor itself, execute the 'hidtest.exe' example program from #306

@Youw
Copy link
Member

Youw commented Jan 3, 2022

I'm actively reworking this one (test infrastructure and implementation).
Expect this one to be completely updated (in a separate branch) in a few days.

@JoergAtGithub
Copy link
Contributor Author

JoergAtGithub commented Jan 31, 2022

If it helps, I can create physical devices that return arbitrary HID Report Descriptors and test what Windows hidapi is returning.

@todbot Are you still intend to program the Report Descriptor with the missing test case to your TinyUSB device? It would be of great help!

@Youw Youw force-pushed the get-descriptor branch 3 times, most recently from 7cd7533 to 676c7e6 Compare February 6, 2022 00:42
@Youw
Copy link
Member

Youw commented Feb 6, 2022

All of these changes are now in https://github.com/libusb/hidapi/tree/get-descriptor .
I still have too many questions to the implementation, and I intend to refer to those before making a PR to master.

One of the items to work on - include pp_data_dump so the dumper is a part of this repo too.

In any case, at least now the get-descriptor is in sync with master and with separated implementation, which should minimize a chance of a conflict.

@Youw Youw closed this Feb 6, 2022
@mcuee
Copy link
Member

mcuee commented Feb 6, 2022

Great. At least now we can test using the get-descriptor branch which is in sync with the master.

@JoergAtGithub
Copy link
Contributor Author

@Youw Great work! Thank you! If I should do some tasks, please tell me. Otherwise I wait, to prevent conflicting work.

I never intended to include pp_data_dump into the main repo. Therefore it's just a quick and dirty implementation, where I never started a Pull-Request for. But if you want, I could clean this up and start a Pull-Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Related to Windows backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants