Hello Vladimir,
On Thursday, 23. December 2010 14:05:42 Vladimir Yakovlev wrote:
> @@ -133,10 +133,7 @@ int ftdi_init(struct ftdi_context *ftdi)
> ftdi->writebuffer_chunksize = 4096;
> ftdi->max_packet_size = 0;
>
> - ftdi->interface = 0;
> - ftdi->index = 0;
> - ftdi->in_ep = 0x02;
> - ftdi->out_ep = 0x81;
> + ftdi_set_interface(ftdi, INTERFACE_ANY);
> ftdi->bitbang_mode = 1; /* when bitbang is enabled this holds the
> number of the mode */
>
> ftdi->error_str = NULL;
> @@ -202,7 +199,10 @@ int ftdi_set_interface(struct ftdi_context *ftdi,
> enum ftdi_interface interface) {
> case INTERFACE_ANY:
> case INTERFACE_A:
> - /* ftdi_usb_open_desc cares to set the right index,
> depending on the found chip */ + ftdi->interface = 0;
> + ftdi->index = INTERFACE_A;
> + ftdi->in_ep = 0x02;
> + ftdi->out_ep = 0x81;
> break;
> case INTERFACE_B:
> ftdi->interface = 1;
Thanks for your patch, applied!
Small remark about the older BM type chips: It will also set the
ftdi->index to "1" for the old chips.
According to my very ancient documentation, an index of zero (=default
interface) will be remapped to one (=SIOA). I verified it works by modifying
libftdi 0.x with "ftdi->index = 1" and run it on old hardware.
There's also code in ftdi_usb_open_dev() to set interface A,
maybe we can get rid of that?
Cheers,
Thomas
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|