libftdi Archives

Subject: Re: [Resent/Corrected] Interface can not be changed on an already open device

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 4 Oct 2011 18:29:38 +0200
Uwe,

On Tuesday, 4. October 2011 14:37:48 Uwe Bonnes wrote:
> +    if (ftdi->usb_dev != NULL)
> +    {
> +        if ((ftdi->index != interface) && ((ftdi->index == INTERFACE_A)
> && (interface !=  INTERFACE_ANY))) +
> +            ftdi_error_return(-3, "Interface can not be changed on an
> already open device"); +    }

Hmm,  what about this:

- ftdi_set_interface(INTERFACE_B);
- ftdi_usb_open()
- ftdi_set_interface(INTERFACE_A);

That won't be caught by the code above.

What about simplifying it to:

"if (ftdi->usb_dev && ftdi->index != interface)"

or does that break a valid use case?

Cheers,
Thomas

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

Current Thread