libftdi Archives

Subject: Re: [PATCH 2/2] action review comments

From: Harrison Marcks <hmarcks@xxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 31 Aug 2022 09:03:47 +0100
Hello,

I've finally gotten gmail to behave and can say: Yes, all very good
points! I will submit a proper V3 patch shortly, I'm new to
contributing; so was just trying to use `git send-email` in anger.
Thank you for the input, though!

Cheers,


HarryM

On Tue, 30 Aug 2022 at 17:23, Harrison Marcks
<hmarcks@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> remove diagnostic buf
> remove open_counter and open_fail_counter
>
> ---
>  src/ftdi.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/src/ftdi.c b/src/ftdi.c
> index c64fd8e..5854f49 100644
> --- a/src/ftdi.c
> +++ b/src/ftdi.c
> @@ -781,7 +781,6 @@ int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, 
> int vendor, int product,
>      char string[256];
>      int i = 0;
>      int error_code = -3;
> -    int open_counter = 0, open_fail_counter = 0;
>
>      if (ftdi == NULL)
>          ftdi_error_return(-11, "ftdi context invalid");
> @@ -799,10 +798,8 @@ int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, 
> int vendor, int product,
>
>          if (desc.idVendor == vendor && desc.idProduct == product)
>          {
> -            open_counter++;
>              if (libusb_open(dev, &ftdi->usb_dev) < 0)
>              {
> -                open_fail_counter++;
>                  error_code = -4;
>                  continue;
>              }
> @@ -858,9 +855,7 @@ int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, 
> int vendor, int product,
>          case -4:
>          {
>              // Failure to open any devices. We made at least one match and 
> it failed to open.
> -            char buf [256];
> -            sprintf(buf, "usb_open() ran %d times and failed %d times.", 
> open_counter, open_fail_counter);
> -            ftdi_error_return_free_device_list(-4, buf, devs);
> +            ftdi_error_return_free_device_list(-4, "usb_open() has failed to 
> open devices", devs);
>          }
>          break;
>      }
> --
> 2.34.1
>


-- 

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