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: Harrison Marcks <hmarcks@xxxxxxxxxxxxxxxxxxxx>
To: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Cc: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 31 Aug 2023 08:40:44 +0100
Hi Thomas,

That is no issue what-so-ever.

Honestly I don't recall it was quite some time ago. I'm sure there's a reason - but that reason could also be not realising this function existed. Accept my pre-apologies if it takes a few days to get back to you on this.

Cheers,

HarryM

On Tue, 29 Aug 2023 at 16:45, Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> wrote:
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


--

Harrison James 'Harry' Marcks, Engineer

https://www.thegoodpenguin.co.uk

The Good Penguin Ltd is a company registered in England and Wales with company number 12374667 and VAT number 341687879. Registered office: The Good Penguin Ltd, Westcott, Glasllwch Lane, Newport, NP20 3PS.



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


Current Thread