From c7e0040689db1fc2673c117e038ffb3a88f6562b Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Mon, 6 Mar 2023 15:31:08 +0100 Subject: [PATCH] drivers/libusb_helper: allow external use of jtag_libusb_match_ids() Can be employed by a driver with custom libusb open. Change-Id: I00c8a01df8780891a8b7c30e2e34ab191acdf9a8 Signed-off-by: Tomas Vanek Reviewed-on: https://review.openocd.org/c/openocd/+/7528 Tested-by: jenkins Reviewed-by: Wolfram Sang Reviewed-by: Antonio Borneo --- src/jtag/drivers/libusb_helper.c | 2 +- src/jtag/drivers/libusb_helper.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jtag/drivers/libusb_helper.c b/src/jtag/drivers/libusb_helper.c index 53dfd502d..4b098b482 100644 --- a/src/jtag/drivers/libusb_helper.c +++ b/src/jtag/drivers/libusb_helper.c @@ -50,7 +50,7 @@ static int jtag_libusb_error(int err) } } -static bool jtag_libusb_match_ids(struct libusb_device_descriptor *dev_desc, +bool jtag_libusb_match_ids(struct libusb_device_descriptor *dev_desc, const uint16_t vids[], const uint16_t pids[]) { for (unsigned i = 0; vids[i]; i++) { diff --git a/src/jtag/drivers/libusb_helper.h b/src/jtag/drivers/libusb_helper.h index 172c34598..799e3e6a9 100644 --- a/src/jtag/drivers/libusb_helper.h +++ b/src/jtag/drivers/libusb_helper.h @@ -30,6 +30,8 @@ typedef char * (*adapter_get_alternate_serial_fn)(struct libusb_device_handle *device, struct libusb_device_descriptor *dev_desc); +bool jtag_libusb_match_ids(struct libusb_device_descriptor *dev_desc, + const uint16_t vids[], const uint16_t pids[]); int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], struct libusb_device_handle **out, adapter_get_alternate_serial_fn adapter_get_alternate_serial);