ziutek / ftdi

Go binding for libFTDI
Other
25 stars 14 forks source link

Avoid erroring out for failed getStrings #19

Closed rasky closed 2 years ago

rasky commented 2 years ago

When running FindAll on a system that contains FTDI devices for which no driver has been installed, the function would return an error, propagated from the call to libusb_open needed for getStrings. It does make sense that libusb_open fails, but the way the error is propagated means that FindAll will always return an error, which is more surprising given that it is just an enumeration function.

This commit changes the behavior so that FindAll will not fail, but simply return an empty USBDev structure for those devices, so that the caller can realize that a device is present but cannot be queried or accessed.