|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:55:48
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via a41341bbf7f1e06910ce967b7e199cf64ab77c3a (commit)
from 2acd694e3c6d7e3fb11d4ad92b4440f2b51db2d3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a41341bbf7f1e06910ce967b7e199cf64ab77c3a
Author: Marc Schink <de...@za...>
Date: Mon Apr 27 07:55:19 2026 +0200
adapter: Implement USB product name handling
Multiple adapter drivers currently implement their own 'device_desc'
commands, leading to duplicated code. Move this functionality into the
adapter core, similar to how device serial handling is implemented.
Additionally, rename the command from 'device_desc' to 'product_name' to
more accurately describe its purpose and align with what it actually does.
Driver specific changes will follow in a separate patch series.
Change-Id: If4ef83e9e47e91c9b41dd98c49c074fcdd4ec497
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9608
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index b36e45254..76499deb7 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2517,6 +2517,11 @@ The USB bus topology can be queried with the command @emph{lsusb -t} or @emph{dm
This command is only available if your libusb1 is at least version 1.0.16.
@end deffn
+@deffn {Config Command} {adapter usb product_name} name
+Specifies the USB product name (the @emph{iProduct} string) of the adapter to use.
+If this is not set, the product name is not used during device selection.
+@end deffn
+
@deffn {Config Command} {adapter serial} serial_string
Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked.
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index b17331f88..dcdc047f3 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -45,6 +45,7 @@ static struct {
// vid = pid = 0 marks the end of the list.
uint16_t usb_vids[MAX_USB_IDS + 1];
uint16_t usb_pids[MAX_USB_IDS + 1];
+ char *product_name;
char *serial;
enum adapter_clk_mode clock_mode;
int speed_khz;
@@ -201,6 +202,7 @@ int adapter_quit(void)
free(adapter_config.serial);
free(adapter_config.usb_location);
+ free(adapter_config.product_name);
struct jtag_tap *t = jtag_all_taps();
while (t) {
@@ -345,6 +347,11 @@ const char *adapter_usb_get_location(void)
return adapter_config.usb_location;
}
+const char *adapter_usb_get_product_name(void)
+{
+ return adapter_config.product_name;
+}
+
bool adapter_usb_location_equal(uint8_t dev_bus, uint8_t *port_path, size_t path_len)
{
size_t path_step, string_length;
@@ -1145,6 +1152,20 @@ COMMAND_HANDLER(handle_usb_vid_pid_command)
return ERROR_OK;
}
+COMMAND_HANDLER(handle_usb_product_name_command)
+{
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ free(adapter_config.product_name);
+ adapter_config.product_name = NULL;
+
+ if (*CMD_ARGV[0])
+ adapter_config.product_name = strdup(CMD_ARGV[0]);
+
+ return ERROR_OK;
+}
+
static const struct command_registration adapter_usb_command_handlers[] = {
{
.name = "vid_pid",
@@ -1153,6 +1174,13 @@ static const struct command_registration adapter_usb_command_handlers[] = {
.help = "set the USB VID and PID of the USB device",
.usage = "(vid pid)*",
},
+ {
+ .name = "product_name",
+ .handler = &handle_usb_product_name_command,
+ .mode = COMMAND_CONFIG,
+ .help = "set the USB product name of the USB device",
+ .usage = "name",
+ },
#ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
{
.name = "location",
diff --git a/src/jtag/adapter.h b/src/jtag/adapter.h
index 4254ae96d..c22ac53fe 100644
--- a/src/jtag/adapter.h
+++ b/src/jtag/adapter.h
@@ -92,6 +92,9 @@ bool is_adapter_initialized(void);
/** @returns USB location string set with command 'adapter usb location' */
const char *adapter_usb_get_location(void);
+/** @returns USB product name set with command 'adapter usb product_name' */
+const char *adapter_usb_get_product_name(void);
+
/** @returns true if USB location string is "<dev_bus>-<port_path[0]>[.<port_path[1]>[...]]" */
bool adapter_usb_location_equal(uint8_t dev_bus, uint8_t *port_path, size_t path_len);
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 5 +++++
src/jtag/adapter.c | 28 ++++++++++++++++++++++++++++
src/jtag/adapter.h | 3 +++
3 files changed, 36 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|