You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no "official" way. You're expected to use fields of hid_device_info do distinguish your devices (all, but path), and serial_number is primary for this purpose.
Unofficial way: if you know exactly the version of hidapi library you use (and not relying on a system-installed instance), you may try to parse the path. See https://github.com/libusb/hidapi/blob/master/libusb/hid.c#L487
But I strongly do not recommend doing so, if you could use serial_numbers instead. path is platform/backend - specific, and it won't work, for instance, if you choose to switch from libusb to hidraw backend.
Activity
Youw commentedon Mar 10, 2021
There is no "official" way. You're expected to use fields of
hid_device_infodo distinguish your devices (all, butpath), andserial_numberis primary for this purpose.Unofficial way: if you know exactly the version of hidapi library you use (and not relying on a system-installed instance), you may try to parse the
path. See https://github.com/libusb/hidapi/blob/master/libusb/hid.c#L487But I strongly do not recommend doing so, if you could use
serial_numbers instead.pathis platform/backend - specific, and it won't work, for instance, if you choose to switch from libusb to hidraw backend.Also, see #117.
nxpfrankli commentedon Mar 10, 2021
Our ROM have not provided serial_number info.
Our software work well with libusb at windows and linux.
we need a better solution cross windows, linux and macos.
Youw commentedon Mar 10, 2021
If you need a reliable cross-platform solution - update your ROM to provide a
serial_number.Using
pathis not reliable nor easy to implement.I cannot suggest you anything else.
If you wan't to continue a discussion, please use https://github.com/libusb/hidapi/discussions/categories/q-a instead.