On Sun, Jun 13, 2010 at 8:22 AM, Stacey Sheldon <[email protected]> wrote:
> Some ft2232 based devices (such as the FLOSS-JTAG) do
> not include an on-board eeprom.  Without an eeprom, the
> devices do not have a unique serial number.  When you
> have multiple of these devices plugged into the same
> PC, openocd has no way to distinguish between them.
>
> This commit adds the 'ft2232_bus_addr' configuration
> command which allows the user to specify the fully
> qualified bus address of the ft2232 device.  The
> format of the address is the same as for the
> equivalent -s option in lsusb for selecting the device:
>  <bus>:<devnum>
>
> For example, if lsusb reports something like this:
>  Bus 002 Device 084: ID 0403:6010 Future Technology Devices
>                                   International, Ltd FT2232C
>                                   Dual USB-UART/FIFO IC
>
> Then this configuration command will select this device in
> openocd:
>  ft2232_bus_addr 002:084
>
> Hint: You can use 'lsusb -tv' to display your devices in
> tree format to find the device address associated with a
> specific port on a USB hub.
>
> Signed-off-by: Stacey Sheldon <[email protected]>

> +       if (ft2232_bus_addr)
> +       {
> +               struct ftdi_device_list *ftdi_list;
> +               struct ftdi_device_list *ftdi_dev;
> +
> +               if (ftdi_usb_find_all(&ftdic, &ftdi_list, vid, pid) < 0)
> +               {
> +                       LOG_ERROR("unable to scan for FT2232 devices: %s", 
> ftdic.error_str);
> +                       return ERROR_JTAG_INIT_FAILED;
> +               }
> +
> +               /* got the list of devices, look for a match */
> +               for (ftdi_dev = ftdi_list; ftdi_dev != NULL; ftdi_dev = 
> ftdi_dev->next)
> +               {
> +                       char path[PATH_MAX + 1] = { 0 };

Ok, this breaks MinGW where PATH_MAX is not defined.

Similar problems cause libftdi-0.17 to fail to build under MinGW. libftdi
git has already fixed this and not using PATH_MAX.
Reference:
http://www.mail-archive.com/[email protected]/msg00370.html

> +                       if(ftdi_dev->dev->bus)
> +                       {
> +                               strncat(path, ftdi_dev->dev->bus->dirname, 
> sizeof(path)-1);
> +                               strncat(path, ":", sizeof(path)-1);
> +                       }
> +                       strncat(path, ftdi_dev->dev->filename, 
> sizeof(path)-1);
> +                       /* check if we have a match on bus address */
> +                       LOG_DEBUG ("Considering ftdi device at bus addr: %s", 
> path);
> +                       if (strcmp(ft2232_bus_addr, path) == 0)
> +                       {
> +                               /* found a match, break out */
> +                               LOG_DEBUG ("Matched ftdi device at bus addr: 
> %s", path);
> +                               break;
> +                       }
> +               }
> +



-- 
Xiaofan http://mcuee.blogspot.com
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to