This is an automated email from Gerrit.

"zapb <[email protected]>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/9597

-- gerrit

commit 00e2e4f34aa25a1d1444f98ffe5f6ed2cd97669f
Author: Marc Schink <[email protected]>
Date:   Thu Apr 23 22:10:42 2026 +0200

    adapter/hla: Delegate USB VID/PID parsing to adapter core
    
    Use the USB VID/PIDs provided by the adapter core instead of parsing
    them in the driver code.
    
    Keep the legacy 'hla_vid_pid' command for backwards compatibility, but
    mark it as deprecated.
    
    Change-Id: Ie3dc8333f5fb863ff68537b803a0b6e96cf35b09
    Signed-off-by: Marc Schink <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index b030d8d212..5b33328525 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3327,10 +3327,6 @@ Currently Not Supported.
 Specifies the adapter layout to use.
 @end deffn
 
-@deffn {Config Command} {hla vid_pid} [vid pid]+
-Pairs of vendor IDs and product IDs of the device.
-@end deffn
-
 @deffn {Config Command} {hla stlink_backend} (usb | tcp [port])
 @emph{ST-Link only:} Choose between 'exclusive' USB communication (the default 
backend) or
 'shared' mode using ST-Link TCP server (the default port is 7184).
diff --git a/src/jtag/drivers/nulink_usb.c b/src/jtag/drivers/nulink_usb.c
index 66cf25a6d1..df140ba58d 100644
--- a/src/jtag/drivers/nulink_usb.c
+++ b/src/jtag/drivers/nulink_usb.c
@@ -1030,7 +1030,7 @@ static int nulink_usb_open(struct hl_interface_param 
*param, void **fd)
        if (param->transport != HL_TRANSPORT_SWD)
                return TARGET_UNKNOWN;
 
-       if (!param->vid[0] && !param->pid[0]) {
+       if (!adapter_usb_get_vids()[0] && !adapter_usb_get_pids()[0]) {
                LOG_ERROR("Missing vid/pid");
                return ERROR_FAIL;
        }
@@ -1068,8 +1068,9 @@ static int nulink_usb_open(struct hl_interface_param 
*param, void **fd)
        while (cur_dev) {
                bool found = false;
 
-               for (unsigned int i = 0; param->vid[i] || param->pid[i]; i++) {
-                       if (param->vid[i] == cur_dev->vendor_id && 
param->pid[i] == cur_dev->product_id) {
+               for (unsigned int i = 0; adapter_usb_get_vids()[i] != 0; i++) {
+                       if (cur_dev->vendor_id == adapter_usb_get_vids()[i] &&
+                                       cur_dev->product_id == 
adapter_usb_get_pids()[i]) {
                                found = true;
                                break;
                        }
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index bac9c26cb5..c64e149cbb 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -3642,8 +3642,9 @@ static int stlink_tcp_open(void *handle, struct 
hl_interface_param *param)
                stlink_used = h->tcp_backend_priv.recv_buf[44];
 
                /* check the vid:pid */
-               for (int i = 0; param->vid[i]; i++) {
-                       if (param->vid[i] == h->vid && param->pid[i] == h->pid) 
{
+               for (unsigned int i = 0; adapter_usb_get_vids()[i]; i++) {
+                       if (h->vid == adapter_usb_get_vids()[i] &&
+                                       h->pid == adapter_usb_get_pids()[i]) {
                                stlink_id_matched = true;
                                break;
                        }
diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c
index 5bac659c48..cd740b296d 100644
--- a/src/jtag/drivers/ti_icdi_usb.c
+++ b/src/jtag/drivers/ti_icdi_usb.c
@@ -665,13 +665,14 @@ static int icdi_usb_open(struct hl_interface_param 
*param, void **fd)
                return ERROR_FAIL;
        }
 
-       for (uint8_t i = 0; param->vid[i] && param->pid[i]; ++i)
-               LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", 
param->transport,
-                       param->vid[i], param->pid[i], 
adapter_get_required_serial() ? adapter_get_required_serial() : "");
+       for (unsigned int i = 0; adapter_usb_get_vids()[i]; ++i)
+               LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
+                       param->transport, adapter_usb_get_vids()[i], 
adapter_usb_get_pids()[i],
+                       adapter_get_required_serial() ? 
adapter_get_required_serial() : "");
 
        /* TI (Stellaris) ICDI provides its serial number in the USB descriptor;
           no need to provide a callback here. */
-       jtag_libusb_open(param->vid, param->pid, NULL, &h->usb_dev, NULL);
+       jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(), NULL, 
&h->usb_dev, NULL);
 
        if (!h->usb_dev) {
                LOG_ERROR("open failed");
diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c
index a9d196ccec..9fa1df92ca 100644
--- a/src/jtag/hla/hla_interface.c
+++ b/src/jtag/hla/hla_interface.c
@@ -26,8 +26,6 @@
 static struct hl_interface hl_if = {
        .param = {
                .device_desc = NULL,
-               .vid = { 0 },
-               .pid = { 0 },
                .transport = HL_TRANSPORT_UNKNOWN,
                .connect_under_reset = false,
                .use_stlink_tcp = false,
@@ -248,33 +246,6 @@ COMMAND_HANDLER(hl_interface_handle_layout_command)
        return ERROR_FAIL;
 }
 
-COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
-{
-       if (CMD_ARGC > HLA_MAX_USB_IDS * 2) {
-               LOG_WARNING("ignoring extra IDs in hla_vid_pid "
-                       "(maximum is %d pairs)", HLA_MAX_USB_IDS);
-               CMD_ARGC = HLA_MAX_USB_IDS * 2;
-       }
-       if (CMD_ARGC < 2 || (CMD_ARGC & 1)) {
-               LOG_WARNING("incomplete hla_vid_pid configuration directive");
-               return ERROR_COMMAND_SYNTAX_ERROR;
-       }
-
-       unsigned int i;
-       for (i = 0; i < CMD_ARGC; i += 2) {
-               COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], hl_if.param.vid[i / 2]);
-               COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], hl_if.param.pid[i / 
2]);
-       }
-
-       /*
-        * Explicitly terminate, in case there are multiple instances of
-        * hla_vid_pid.
-        */
-       hl_if.param.vid[i / 2] = hl_if.param.pid[i / 2] = 0;
-
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(hl_interface_handle_stlink_backend_command)
 {
        /* default values */
@@ -330,13 +301,6 @@ static const struct command_registration 
hl_interface_subcommand_handlers[] = {
         .help = "set the layout of the adapter",
         .usage = "layout_name",
         },
-       {
-        .name = "vid_pid",
-        .handler = &hl_interface_handle_vid_pid_command,
-        .mode = COMMAND_CONFIG,
-        .help = "the vendor and product ID of the adapter",
-        .usage = "(vid pid)*",
-        },
        {
         .name = "stlink_backend",
         .handler = &hl_interface_handle_stlink_backend_command,
diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h
index c0ee05498d..8701c033ab 100644
--- a/src/jtag/hla/hla_interface.h
+++ b/src/jtag/hla/hla_interface.h
@@ -21,10 +21,6 @@ enum e_hl_transports;
 struct hl_interface_param {
        /** */
        const char *device_desc;
-       /** List of recognised VIDs */
-       uint16_t vid[HLA_MAX_USB_IDS + 1];
-       /** List of recognised PIDs */
-       uint16_t pid[HLA_MAX_USB_IDS + 1];
        /** */
        enum hl_transports transport;
        /** */
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index dede6d5018..482eb86da7 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -1174,8 +1174,8 @@ proc "hla_device_desc" {desc} {
 
 lappend _telnet_autocomplete_skip "hla_vid_pid"
 proc "hla_vid_pid" {args} {
-       echo "DEPRECATED! use 'hla vid_pid', not 'hla_vid_pid'"
-       eval hla vid_pid $args
+       echo "DEPRECATED! use 'adapter usb vid_pid', not 'hla_vid_pid'"
+       eval adapter usb vid_pid $args
 }
 
 lappend _telnet_autocomplete_skip "hla_command"
diff --git a/tcl/interface/hpmicro/hpmicro_evk.cfg 
b/tcl/interface/hpmicro/hpmicro_evk.cfg
index 2d8e04fca0..c106505ac4 100644
--- a/tcl/interface/hpmicro/hpmicro_evk.cfg
+++ b/tcl/interface/hpmicro/hpmicro_evk.cfg
@@ -2,7 +2,7 @@
 # Copyright (c) 2021 HPMicro
 
 adapter driver ftdi
-ftdi_vid_pid 0x0403 0x6010
+adapter usb vid_pid 0x0403 0x6010
 
 ftdi_layout_init 0x0208 0x020b
 ftdi_layout_signal nTRST -data 0x0200 -noe 0x0400
diff --git a/tcl/interface/nulink.cfg b/tcl/interface/nulink.cfg
index be68347e73..86b0a421af 100644
--- a/tcl/interface/nulink.cfg
+++ b/tcl/interface/nulink.cfg
@@ -7,7 +7,7 @@
 adapter driver hla
 hla layout nulink
 hla device_desc "Nu-Link"
-hla vid_pid 0x0416 0x511b 0x0416 0x511c 0x0416 0x511d 0x0416 0x5200 0x0416 
0x5201
+adapter usb vid_pid 0x0416 0x511b 0x0416 0x511c 0x0416 0x511d 0x0416 0x5200 
0x0416 0x5201
 
 # Only swd is supported
 transport select swd
diff --git a/tcl/interface/stlink-hla.cfg b/tcl/interface/stlink-hla.cfg
index 5c4adb8973..adbfda8e20 100644
--- a/tcl/interface/stlink-hla.cfg
+++ b/tcl/interface/stlink-hla.cfg
@@ -11,7 +11,9 @@ echo "Consider updating your ST-Link firmware to a version >= 
V2J24 (2015)"
 adapter driver hla
 hla layout stlink
 hla device_desc "ST-LINK"
-hla vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 
0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754 0x0483 0x3755 
0x0483 0x3757
+adapter usb vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d \
+       0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 \
+       0x0483 0x3754 0x0483 0x3755 0x0483 0x3757
 
 # Optionally specify the serial number of ST-LINK/V2 usb device.  ST-LINK/V2
 # devices seem to have serial numbers with unreadable characters.  ST-LINK/V2
diff --git a/tcl/interface/ti-icdi.cfg b/tcl/interface/ti-icdi.cfg
index c13d27e8b1..fdd879a7e9 100644
--- a/tcl/interface/ti-icdi.cfg
+++ b/tcl/interface/ti-icdi.cfg
@@ -11,7 +11,7 @@
 
 adapter driver hla
 hla layout ti-icdi
-hla vid_pid 0x1cbe 0x00fd
+adapter usb vid_pid 0x1cbe 0x00fd
 
 # Optionally specify the serial number of TI-ICDI devices, for when using
 # multiple devices. Serial numbers can be obtained using lsusb -v

-- 

Reply via email to