libftdi Archives

Subject: Re: [PATCH Fixed first device failure in open_desc function v3 1/2] Fixed first device failure in open_desc function

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Harrison Marcks <hmarcks@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Aug 2023 17:45:38 +0200
Hi Harrison,

You wrote on Thu, Oct 13, 2022 at 01:18:14PM +0100:
> The ftdi_usb_open_desc_index function would fail immediately in the case of a
> first failed device which is undesireable if several devices are present
> that share ids but might not be accessible. This specific edge case fixes an 
> issue
> in containers that sees devices not passed through but still being seen by 
> libusb
> failing when they can't be accessed in the container by moving onto the next 
> device
> until a device is found it can open and check correctly.
> 
> This should replace the previous patch attempt. I've addressed some mistakes I
> tried to send (whitespace and some debug lines in another function)

thanks for the updated patch and sorry for taking so long to inspect it in 
close detail.

I've squashed the two patches into one and looked at the code. I'm wondering
if one can't achieve the same outcome by using:

* ftdi_usb_find_all() to find all matching devices

* open them via ftdi_usb_open_dev() and just go to the
  next device until one opens inside your container environment
  
?
  
If we fiddle with the ftdi_usb_open_desc_index() return code logic
to either return -3 or -4 depending on a specific situation,
we write "client code" depending on an internal implementation detail.

IMHO using ftdi_usb_find_all() is much safer in the long run?

Cheers,
Thomas

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread