This is an automated email from Gerrit. Karl Kurbjun (kkurb...@gmail.com) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/916
-- gerrit commit 4e8367db9ff8c8038a91a63f3c8b7b2f8487dfc2 Author: Karl Kurbjun <kkurb...@gmail.com> Date: Mon Oct 22 16:06:59 2012 -0600 FTDI 2232 Driver: Add debug information when connection fails. When adding new configurations for FTDI devices where the device description is unknown this information helps to quickly find the failure and correct the configuration file. Change-Id: I1f9f4f14ae03037f96f643c1f1183812d096f2ab Signed-off-by: Karl Kurbjun <kkurb...@gmail.com> diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index 6758dc7..06c3ccd 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -2234,14 +2234,60 @@ static int ft2232_init_libftdi(uint16_t vid, uint16_t pid, int more, int *try_mo return ERROR_JTAG_INIT_FAILED; } + LOG_DEBUG("Attempting to open FTDI device with the following parameters " + "from cfg:\n" + " VID: %04x, PID: %04x, Description: %s", + vid, pid, ft2232_device_desc); + /* context, vendor id, product id */ if (ftdi_usb_open_desc(&ftdic, vid, pid, ft2232_device_desc, ft2232_serial) < 0) { + struct ftdi_device_list *device_list, *curdev; + int ret; if (more) LOG_WARNING("unable to open ftdi device (trying more): %s", ftdic.error_str); else LOG_ERROR("unable to open ftdi device: %s", ftdic.error_str); *try_more = 1; + + /* We were unable to open the device, so list some useful information + * about what we found. This section of code is based on the find_all.c + * example in libftdi. + */ + ret = ftdi_usb_find_all(&ftdic, &device_list, vid, pid); + if (ret < 0) { + LOG_ERROR("ftdi_usb_find_all failed: %d (%s)", + ret, ftdi_get_error_string(&ftdic)); + goto device_fail; + } + + LOG_ERROR("Found %d ftdi device(s) with VID: %04x, PID: %04x:", + ret, vid, pid); + + for (curdev = device_list; curdev != NULL; curdev = curdev->next) { + /* Limit the scope of these variables */ + char manufacturer[128], description[128]; + int i = 0; + + i++; + + ret = ftdi_usb_get_strings(&ftdic, curdev->dev, manufacturer, 128, + description, 128, NULL, 0); + /* Try reading strings from the found device */ + if (ret < 0) { + LOG_ERROR("ftdi_usb_get_strings failed: %d (%s)\n", + ret, ftdi_get_error_string(&ftdic)); + goto device_fail; + } + + /* Show the device description */ + LOG_ERROR(" Device %d Description: %s", i, description); + + } + + /* Cleanup the device list and exit */ +device_fail: + ftdi_list_free(&device_list); return ERROR_JTAG_INIT_FAILED; } -- ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel