From 487c57d9a27244b6a916cce253d8aaaec5e22604 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Wed, 1 Oct 2014 10:36:02 +0400 Subject: libusb: introduce jtag_libusb_choose_interface() and use it for JLink This introduces a new common function that allows auto-discovery of a suitable USB interface based on class, subclass and protocol matching. It claims the interface and returns the corresponding endpoints number to the caller. The need for this arised due to nRF51822 USB dongle which comes with an "on-board Segger J-link debugger" having 3 interfaces, so the current code can't work at all with it (in this particular case the last interface needs to be choosen). This also removes special handling of JLink-OB endpoint numbers as it's now possible to autodetect them as well as the standard JLink endpoints. Change-Id: I4d990a7a3b373efdd2949a394b32d855a168e138 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2327 Tested-by: jenkins Reviewed-by: Spencer Oliver --- src/jtag/aice/aice_usb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/jtag/aice') diff --git a/src/jtag/aice/aice_usb.c b/src/jtag/aice/aice_usb.c index d933845..50b3b9a 100644 --- a/src/jtag/aice/aice_usb.c +++ b/src/jtag/aice/aice_usb.c @@ -2136,13 +2136,11 @@ static int aice_usb_open(struct aice_port_param_s *param) #endif /* usb_set_configuration required under win32 */ - struct jtag_libusb_device *udev = jtag_libusb_get_device(devh); jtag_libusb_set_configuration(devh, 0); - jtag_libusb_claim_interface(devh, 0); unsigned int aice_read_ep; unsigned int aice_write_ep; - jtag_libusb_get_endpoints(udev, &aice_read_ep, &aice_write_ep); + jtag_libusb_choose_interface(devh, &aice_read_ep, &aice_write_ep, -1, -1, -1); aice_handler.usb_read_ep = aice_read_ep; aice_handler.usb_write_ep = aice_write_ep; -- cgit v1.1