Hi Fahrzin, Am 26.01.2016 um 09:12 schrieb Fahrzin Hemmati: > In 1.2, ftdi_usb_get_strings stops opening a device if it's already > open. But it still closes the device, even if it didn't open it. So if I > have an open device, there's no way to just get the string info without > having to reopen it. > > The following simple patch changes the behavior to only close the > usb_dev if it was opened, so now the open and close functions are > matched internally.
thanks for the patch. I certainly see your point with the change. There's one issue: Existing code might rely on the "bad" behavior of libftdi. If we change they code now, the "client code" might stop working as it expects libftdi to close the device. -> leaked device pointer etc. I'm not sure how we can fix this in a backward compatible way. Any idea? We could add a flag to ftdi_context, but that API design would be even more bad :o) Unfortunately we don't have function overloading in C or optional parameters with default arguments. What we *could* do is a ftdi_usb_get_strings2() function and add a compat wrapper for the old one. Once we do a major API revision (nothing planned though), we could remove the old version. Cheers, Thomas -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
