RFC: Bluetooth LE device info on Windows #309

Merged
DJm00n merged 1 commit from ble_device_info into master 2021-09-06 11:16:15 -05:00
DJm00n commented 2021-07-22 06:28:41 -05:00 (Migrated from github.com)

This PR fixes issue with empty manufacturer_string/product_string/serial_number in hid_device_info struct with Bluetooth LE devices on Windows systems.

Fixes: #282

This PR fixes issue with empty `manufacturer_string`/`product_string`/`serial_number` in `hid_device_info` struct with Bluetooth LE devices on Windows systems. Fixes: #282
DJm00n commented 2021-07-22 08:36:10 -05:00 (Migrated from github.com)

BLE Controllers example: Amazon Luna and Xbox One Model Model 1914.

Before:

Device Found
  type: 0171 0419
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col01#9&261ae24b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      100
  Interface:    -1
  Usage (page): 0x5 (0x1)

Device Found
  type: 0171 0419
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col02#9&261ae24b&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      100
  Interface:    -1
  Usage (page): 0x20 (0xff00)
  
Device Found
  type: 045e 0b13
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}&dev&vid_5e&pid_0b13&rev_0505&987a14b7e3a7&ig_00#9&10a6f04f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      505
  Interface:    -1
  Usage (page): 0x5 (0x1)

After:

Device Found
  type: 0171 0419
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col01#9&261ae24b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 0cee99d33b5b
  Manufacturer: Amazon
  Product:      Luna Gamepad
  Release:      100
  Interface:    -1
  Usage (page): 0x5 (0x1)

Device Found
  type: 0171 0419
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col02#9&261ae24b&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 0cee99d33b5b
  Manufacturer: Amazon
  Product:      Luna Gamepad
  Release:      100
  Interface:    -1
  Usage (page): 0x20 (0xff00)
  
Device Found
  type: 045e 0b13
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}&dev&vid_5e&pid_0b13&rev_0505&987a14b7e3a7&ig_00#9&10a6f04f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 987a14b7e3a7
  Manufacturer: Microsoft
  Product:      Xbox Wireless Controller 987A14B7E3A7
  Release:      505
  Interface:    -1
  Usage (page): 0x5 (0x1)
BLE Controllers example: Amazon Luna and Xbox One Model Model 1914. Before: ``` Device Found type: 0171 0419 path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col01#9&261ae24b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Product: Release: 100 Interface: -1 Usage (page): 0x5 (0x1) Device Found type: 0171 0419 path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col02#9&261ae24b&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Product: Release: 100 Interface: -1 Usage (page): 0x20 (0xff00) Device Found type: 045e 0b13 path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}&dev&vid_5e&pid_0b13&rev_0505&987a14b7e3a7&ig_00#9&10a6f04f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Product: Release: 505 Interface: -1 Usage (page): 0x5 (0x1) ``` After: ``` Device Found type: 0171 0419 path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col01#9&261ae24b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 0cee99d33b5b Manufacturer: Amazon Product: Luna Gamepad Release: 100 Interface: -1 Usage (page): 0x5 (0x1) Device Found type: 0171 0419 path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&010171_pid&0419_rev&0100_0cee99d33b5b&col02#9&261ae24b&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 0cee99d33b5b Manufacturer: Amazon Product: Luna Gamepad Release: 100 Interface: -1 Usage (page): 0x20 (0xff00) Device Found type: 045e 0b13 path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}&dev&vid_5e&pid_0b13&rev_0505&987a14b7e3a7&ig_00#9&10a6f04f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 987a14b7e3a7 Manufacturer: Microsoft Product: Xbox Wireless Controller 987A14B7E3A7 Release: 505 Interface: -1 Usage (page): 0x5 (0x1) ```
mcuee commented 2021-07-25 01:03:43 -05:00 (Migrated from github.com)

This seems to work.

Before (mainline git)

Device Found
  type: 16c0 05df
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&38bb9e5a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      100
  Interface:    -1
  Usage (page): 0x100 (0xff00)

Device Found
  type: 16c0 05df
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&f97cf65&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer:
  Product:
  Release:      100
  Interface:    -1
  Usage (page): 0x1 (0xc)

#309 output

Device Found
  type: 16c0 05df
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&38bb9e5a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 30aea44c4efa
  Manufacturer: Espressif
  Product:      ESP BLE HID2
  Release:      100
  Interface:    -1
  Usage (page): 0x100 (0xff00)
  Bus type: 2

Device Found
  type: 16c0 05df
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&f97cf65&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 30aea44c4efa
  Manufacturer: Espressif
  Product:      ESP BLE HID2
  Release:      100
  Interface:    -1
  Usage (page): 0x1 (0xc)
  Bus type: 2
This seems to work. Before (mainline git) ``` Device Found type: 16c0 05df path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&38bb9e5a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Product: Release: 100 Interface: -1 Usage (page): 0x100 (0xff00) Device Found type: 16c0 05df path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&f97cf65&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Product: Release: 100 Interface: -1 Usage (page): 0x1 (0xc) ``` #309 output ``` Device Found type: 16c0 05df path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&38bb9e5a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 30aea44c4efa Manufacturer: Espressif Product: ESP BLE HID2 Release: 100 Interface: -1 Usage (page): 0x100 (0xff00) Bus type: 2 Device Found type: 16c0 05df path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&f97cf65&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 30aea44c4efa Manufacturer: Espressif Product: ESP BLE HID2 Release: 100 Interface: -1 Usage (page): 0x1 (0xc) Bus type: 2 ```
mcuee commented 2021-07-26 22:09:26 -05:00 (Migrated from github.com)

Yes the latest git is good.


C:\work\hid\hidapi_ble\windows\x64\Release [ble_device_info ≡]> .\hidtest.exe
hidapi test/example 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&col01#7&383a3a17&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 0x2 (0x1)
  Bus type: 1

Device Found
  type: 16c0 05df
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&38bb9e5a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 30aea44c4efa
  Manufacturer: Espressif
  Product:      ESP BLE HID2
  Release:      100
  Interface:    -1
  Usage (page): 0x100 (0xff00)
  Bus type: 2

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col02#7&383a3a17&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 0x1 (0xc)
  Bus type: 1

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col03#7&383a3a17&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 0x80 (0x1)
  Bus type: 1

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col04#7&383a3a17&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 0x1 (0xff00)
  Bus type: 1

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): 0x2 (0x1)
  Bus type: 3

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): 0xc (0x1)
  Bus type: 255

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): 0x6 (0x1)
  Bus type: 255

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_01&col05#7&383a3a17&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 0x2 (0xff00)
  Bus type: 1

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): 0xd (0x1)
  Bus type: 255

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): 0x2 (0x1)
  Bus type: 255

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): 0x5 (0xd)
  Bus type: 3

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): 0x1 (0xc)
  Bus type: 1

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): 0x1 (0xc)
  Bus type: 255

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): 0x5 (0xb)
  Bus type: 1

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): 0x80 (0x1)
  Bus type: 255

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): 0x3 (0xffa0)
  Bus type: 1

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): 0x1 (0xff01)
  Bus type: 3

Device Found
  type: 046d c534
  path: \\?\hid#vid_046d&pid_c534&mi_00#7&1c54b96&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
  serial_number:
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    0
  Usage (page): 0x6 (0x1)
  Bus type: 1

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): 0x1 (0xff02)
  Bus type: 3

Device Found
  type: 16c0 05df
  path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&f97cf65&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: 30aea44c4efa
  Manufacturer: Espressif
  Product:      ESP BLE HID2
  Release:      100
  Interface:    -1
  Usage (page): 0x1 (0xc)
  Bus type: 2

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): 0xe (0xd)
  Bus type: 3

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): 0x6 (0x1)
  Bus type: 255

unable to open device
Yes the latest git is good. ``` C:\work\hid\hidapi_ble\windows\x64\Release [ble_device_info ≡]> .\hidtest.exe hidapi test/example 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&col01#7&383a3a17&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Logitech Product: USB Receiver Release: 2901 Interface: 1 Usage (page): 0x2 (0x1) Bus type: 1 Device Found type: 16c0 05df path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&38bb9e5a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 30aea44c4efa Manufacturer: Espressif Product: ESP BLE HID2 Release: 100 Interface: -1 Usage (page): 0x100 (0xff00) Bus type: 2 Device Found type: 046d c534 path: \\?\hid#vid_046d&pid_c534&mi_01&col02#7&383a3a17&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Logitech Product: USB Receiver Release: 2901 Interface: 1 Usage (page): 0x1 (0xc) Bus type: 1 Device Found type: 046d c534 path: \\?\hid#vid_046d&pid_c534&mi_01&col03#7&383a3a17&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Logitech Product: USB Receiver Release: 2901 Interface: 1 Usage (page): 0x80 (0x1) Bus type: 1 Device Found type: 046d c534 path: \\?\hid#vid_046d&pid_c534&mi_01&col04#7&383a3a17&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Logitech Product: USB Receiver Release: 2901 Interface: 1 Usage (page): 0x1 (0xff00) Bus type: 1 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): 0x2 (0x1) Bus type: 3 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): 0xc (0x1) Bus type: 255 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): 0x6 (0x1) Bus type: 255 Device Found type: 046d c534 path: \\?\hid#vid_046d&pid_c534&mi_01&col05#7&383a3a17&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: Manufacturer: Logitech Product: USB Receiver Release: 2901 Interface: 1 Usage (page): 0x2 (0xff00) Bus type: 1 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): 0xd (0x1) Bus type: 255 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): 0x2 (0x1) Bus type: 255 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): 0x5 (0xd) Bus type: 3 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): 0x1 (0xc) Bus type: 1 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): 0x1 (0xc) Bus type: 255 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): 0x5 (0xb) Bus type: 1 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): 0x80 (0x1) Bus type: 255 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): 0x3 (0xffa0) Bus type: 1 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): 0x1 (0xff01) Bus type: 3 Device Found type: 046d c534 path: \\?\hid#vid_046d&pid_c534&mi_00#7&1c54b96&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd serial_number: Manufacturer: Logitech Product: USB Receiver Release: 2901 Interface: 0 Usage (page): 0x6 (0x1) Bus type: 1 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): 0x1 (0xff02) Bus type: 3 Device Found type: 16c0 05df path: \\?\hid#{00001812-0000-1000-8000-00805f9b34fb}_dev_vid&0216c0_pid&05df_rev&0100_30aea44c4efa#9&f97cf65&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} serial_number: 30aea44c4efa Manufacturer: Espressif Product: ESP BLE HID2 Release: 100 Interface: -1 Usage (page): 0x1 (0xc) Bus type: 2 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): 0xe (0xd) Bus type: 3 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): 0x6 (0x1) Bus type: 255 unable to open device ```
Youw commented 2021-07-28 06:35:01 -05:00 (Migrated from github.com)

@DJm00n could you make a BLE fix only?
With that part only I'd like to finally release a 0.11.0 version.

BUS_TYPE isn't finished for all platforms, and even when it is done - let's have it in master for some time, before releaseing it.

@DJm00n could you make a BLE fix only? With that part only I'd like to finally release a 0.11.0 version. BUS_TYPE isn't finished for all platforms, and even when it is done - let's have it in master for some time, before releaseing it.
DJm00n commented 2021-08-03 08:18:07 -05:00 (Migrated from github.com)

@Youw I rebased this PR without #308 changes.

@Youw I rebased this PR without #308 changes.
mcuee commented 2021-08-06 00:47:06 -05:00 (Migrated from github.com)

@DJm00n You may want to disable the following warning for VS.

1>C:\work\hid\hidapi_ble\windows\hid.c(421,6): warning C4996: 'mbstowcs': This function or variable may be unsafe. Consider using mbstowcs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>C:\work\hid\hidapi_ble\windows\hid.c(1126,2): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>C:\work\hid\hidapi_ble\windows\hid.c(1136,2): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>C:\work\hid\hidapi_ble\windows\hid.c(1146,2): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
@DJm00n You may want to disable the following warning for VS. ``` 1>C:\work\hid\hidapi_ble\windows\hid.c(421,6): warning C4996: 'mbstowcs': This function or variable may be unsafe. Consider using mbstowcs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 1>C:\work\hid\hidapi_ble\windows\hid.c(1126,2): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 1>C:\work\hid\hidapi_ble\windows\hid.c(1136,2): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 1>C:\work\hid\hidapi_ble\windows\hid.c(1146,2): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. ```
Youw (Migrated from github.com) reviewed 2021-08-12 04:08:44 -05:00
Youw (Migrated from github.com) left a comment

maybe the warning is valid after all

maybe the warning is valid after all
Youw (Migrated from github.com) commented 2021-08-12 04:08:33 -05:00

If count is reached before the entire string src was copied, the resulting wide character array is not null-terminated.

> If count is reached before the entire string src was copied, the resulting wide character array is not null-terminated.
DJm00n (Migrated from github.com) reviewed 2021-08-12 06:59:50 -05:00
DJm00n (Migrated from github.com) commented 2021-08-12 06:59:50 -05:00

added string[maxlen] = L'\0'; after wcsncpy calls

added `string[maxlen] = L'\0';` after `wcsncpy` calls
Youw (Migrated from github.com) approved these changes 2021-08-16 03:08:32 -05:00
Youw (Migrated from github.com) left a comment

I don't have a BLE device, so I can't really try this myself, but I've reviewed the implementation and it looks good, with regards to my last comments.
As soon as those are referred, I'll merge this.

I don't have a BLE device, so I can't really try this myself, but I've reviewed the implementation and it looks good, with regards to my last comments. As soon as those are referred, I'll merge this.
Youw (Migrated from github.com) commented 2021-08-16 02:45:10 -05:00

let's use mbsrtowcs, to be safe

let's use `mbsrtowcs`, to be safe
Youw (Migrated from github.com) commented 2021-08-16 02:51:00 -05:00

just a code-style consistency

	for (wchar_t* compatible_id = compatible_ids; *compatible_id; compatible_id += wcslen(compatible_id) + 1) {
just a code-style consistency ```suggestion for (wchar_t* compatible_id = compatible_ids; *compatible_id; compatible_id += wcslen(compatible_id) + 1) { ```
@ -307,0 +372,4 @@
ULONG len;
CONFIGRET cr;
DEVPROPTYPE property_type;
Youw (Migrated from github.com) commented 2021-08-16 02:47:38 -05:00

else initialize functions with NULL, as you have code that checks for it

`else` initialize functions with `NULL`, as you have code that checks for it
DJm00n (Migrated from github.com) reviewed 2021-09-06 07:49:30 -05:00
DJm00n (Migrated from github.com) commented 2021-09-06 07:49:30 -05:00

done. I have to add s new tmp var because mbsrtowcs changes src pointer.

done. I have to add s new tmp var because `mbsrtowcs` changes `src` pointer.
DJm00n (Migrated from github.com) reviewed 2021-09-06 07:50:16 -05:00
@ -307,0 +372,4 @@
ULONG len;
CONFIGRET cr;
DEVPROPTYPE property_type;
DJm00n (Migrated from github.com) commented 2021-09-06 07:50:15 -05:00

I initialized those function pointers as NULL instead.

I initialized those function pointers as `NULL` instead.
DJm00n (Migrated from github.com) reviewed 2021-09-06 07:50:27 -05:00
DJm00n (Migrated from github.com) commented 2021-09-06 07:50:27 -05:00

done

done
Youw (Migrated from github.com) reviewed 2021-09-06 08:09:14 -05:00
Youw (Migrated from github.com) commented 2021-09-06 08:09:14 -05:00

that's fine

that's fine
Youw (Migrated from github.com) reviewed 2021-09-06 08:11:09 -05:00
@ -307,0 +372,4 @@
ULONG len;
CONFIGRET cr;
DEVPROPTYPE property_type;
Youw (Migrated from github.com) commented 2021-09-06 08:11:09 -05:00

strictly speaking, that's not enough:

There is a possible/impossible scenario where it can fail:

  1. hid_init - cfgmgr32 is OK;
  2. hid_deinit
  3. Maybe the runtime env has changed
  4. hid_init - cfgmgr32 didn't load, but CM_... pointers are dangling from last hid_init
_strictly_ speaking, that's not enough: There is a possible/impossible scenario where it can fail: 1) hid_init - cfgmgr32 is OK; 2) hid_deinit 3) Maybe the runtime env has changed 4) hid_init - cfgmgr32 didn't load, but `CM_...` pointers are dangling from last hid_init
Youw (Migrated from github.com) reviewed 2021-09-06 08:14:41 -05:00
@ -20,6 +20,12 @@
https://github.com/libusb/hidapi .
Youw (Migrated from github.com) commented 2021-09-06 08:14:41 -05:00

otherwise a "macro redefinition" warning may occure

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
otherwise a "macro redefinition" warning may occure ```suggestion #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) ```
DJm00n (Migrated from github.com) reviewed 2021-09-06 10:19:09 -05:00
@ -20,6 +20,12 @@
https://github.com/libusb/hidapi .
DJm00n (Migrated from github.com) commented 2021-09-06 10:19:09 -05:00

done

done
Youw (Migrated from github.com) reviewed 2021-09-06 10:33:08 -05:00
@ -307,0 +372,4 @@
ULONG len;
CONFIGRET cr;
DEVPROPTYPE property_type;
Youw (Migrated from github.com) commented 2021-09-06 10:33:08 -05:00

What I suggest is:

if (cfgmgr32_lib_handle) {
    RESOLVE(CM_Locate_DevNodeW);
    // ...
}
else {
    CM_Locate_DevNodeW = NULL;
    // ...
}
What I suggest is: ```c if (cfgmgr32_lib_handle) { RESOLVE(CM_Locate_DevNodeW); // ... } else { CM_Locate_DevNodeW = NULL; // ... } ```
DJm00n (Migrated from github.com) reviewed 2021-09-06 10:56:42 -05:00
@ -307,0 +372,4 @@
ULONG len;
CONFIGRET cr;
DEVPROPTYPE property_type;
DJm00n (Migrated from github.com) commented 2021-09-06 10:56:42 -05:00

done

done
Youw (Migrated from github.com) approved these changes 2021-09-06 11:07:34 -05:00
Youw (Migrated from github.com) left a comment

Awsome, thanks!

Awsome, thanks!
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!309
No description provided.