This is an automated email from Gerrit. John Pham ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/2527
-- gerrit commit 70ba1e037b15afb545088f5884dd9d6ce5259800 Author: John Pham <[email protected]> Date: Mon Feb 2 05:23:32 2015 -0500 Allow selecting by serial for TI ICDI devices Used jtag_libusb_open from libusb_common.h instead of libusb_open_device_with_vid_pid to get device handle, as well as managing context, i.e. similar to stlink_usb. Direct calls to libusb1 are left in since jtag_libusb_* wrappers don't return error condition. Change-Id: I71e9a366356c125444d4813e58ddd9b6c6498bf0 Signed-off-by: John Pham <[email protected]> diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c index 53abbfb..3d786f1 100644 --- a/src/jtag/drivers/ti_icdi_usb.c +++ b/src/jtag/drivers/ti_icdi_usb.c @@ -33,7 +33,7 @@ #include <target/cortex_m.h> -#include <libusb.h> +#include "libusb_common.h" #define ICDI_WRITE_ENDPOINT 0x02 #define ICDI_READ_ENDPOINT 0x83 @@ -46,8 +46,7 @@ #define PACKET_END "#" struct icdi_usb_handle_s { - libusb_context *usb_ctx; - libusb_device_handle *usb_dev; + jtag_libusb_device_handle *usb_dev; char *read_buffer; char *write_buffer; @@ -655,10 +654,7 @@ static int icdi_usb_close(void *handle) struct icdi_usb_handle_s *h = handle; if (h->usb_dev) - libusb_close(h->usb_dev); - - if (h->usb_ctx) - libusb_exit(h->usb_ctx); + jtag_libusb_close(h->usb_dev); if (h->read_buffer) free(h->read_buffer); @@ -685,15 +681,17 @@ static int icdi_usb_open(struct hl_interface_param_s *param, void **fd) return ERROR_FAIL; } - LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x", param->transport, - param->vid, param->pid); + LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", param->transport, + param->vid, param->pid, param->serial ? param->serial : ""); - if (libusb_init(&h->usb_ctx) != 0) { - LOG_ERROR("libusb init failed"); - goto error_open; - } - h->usb_dev = libusb_open_device_with_vid_pid(h->usb_ctx, param->vid, param->pid); + /* Derived from stlink_usb.c */ + const uint16_t vids[] = { param->vid, 0 }; + const uint16_t pids[] = { param->pid, 0 }; + const char *serial = param->serial; + + jtag_libusb_open(vids, pids, serial, &h->usb_dev); + if (!h->usb_dev) { LOG_ERROR("open failed"); goto error_open; -- ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
