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/+/9596

-- gerrit

commit caa8a30dc4cb0017dee6f44af0cf0bafaeeac10c
Author: Marc Schink <[email protected]>
Date:   Thu Apr 23 21:43:55 2026 +0200

    adapter/esp-usb-jtag: 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 'espusbjtag vid_pid' command for backwards compatibility,
    but mark it as deprecated.
    
    Change-Id: Ib02795607ab44d4d4da04068a16eb508892c42ad
    Signed-off-by: Marc Schink <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 211d76d8f1..b030d8d212 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3776,13 +3776,6 @@ espusbjtag setio 0 1 0 1 0
 @end example
 @end deffn
 
-@deffn {Config Command} {espusbjtag vid_pid} vid_pid
-Set vendor ID and product ID for the ESP usb jtag driver
-@example
-espusbjtag vid_pid 0x303a 0x1001
-@end example
-@end deffn
-
 @deffn {Config Command} {espusbjtag caps_descriptor} caps_descriptor
 Set the jtag descriptor to read capabilities of ESP usb jtag driver
 @example
diff --git a/src/jtag/drivers/esp_usb_jtag.c b/src/jtag/drivers/esp_usb_jtag.c
index a133035110..20794e9ef8 100644
--- a/src/jtag/drivers/esp_usb_jtag.c
+++ b/src/jtag/drivers/esp_usb_jtag.c
@@ -218,8 +218,6 @@ struct esp_usb_jtag {
 static struct esp_usb_jtag esp_usb_jtag_priv;
 static struct esp_usb_jtag *priv = &esp_usb_jtag_priv;
 
-static int esp_usb_vid;
-static int esp_usb_pid;
 static int esp_usb_jtag_caps;
 static int esp_usb_target_chip_id;
 
@@ -476,9 +474,6 @@ static int esp_usb_jtag_init(void)
 {
        memset(priv, 0, sizeof(struct esp_usb_jtag));
 
-       const uint16_t vids[] = { esp_usb_vid, 0 };             /* must be null 
terminated */
-       const uint16_t pids[] = { esp_usb_pid, 0 };             /* must be null 
terminated */
-
        bitq_interface = &priv->bitq_interface;
        bitq_interface->out = esp_usb_jtag_out;
        bitq_interface->flush = esp_usb_jtag_flush;
@@ -487,7 +482,8 @@ static int esp_usb_jtag_init(void)
        bitq_interface->in_rdy = esp_usb_jtag_in_rdy;
        bitq_interface->in = esp_usb_jtag_in;
 
-       int r = jtag_libusb_open(vids, pids, NULL, &priv->usb_device, NULL);
+       int r = jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(),
+               NULL, &priv->usb_device, NULL);
        if (r != ERROR_OK) {
                LOG_ERROR("esp_usb_jtag: could not find or open device!");
                goto out;
@@ -693,18 +689,6 @@ COMMAND_HANDLER(esp_usb_jtag_setio_cmd)
        return ERROR_OK;
 }
 
-COMMAND_HANDLER(esp_usb_jtag_vid_pid)
-{
-       if (CMD_ARGC != 2)
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], esp_usb_vid);
-       COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], esp_usb_pid);
-       LOG_INFO("esp_usb_jtag: VID set to 0x%x and PID to 0x%x", esp_usb_vid, 
esp_usb_pid);
-
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(esp_usb_jtag_caps_descriptor)
 {
        if (CMD_ARGC != 1)
@@ -742,13 +726,6 @@ static const struct command_registration 
esp_usb_jtag_subcommands[] = {
                .help = "Manually set the status of the output lines",
                .usage = "tdi tms tck trst srst"
        },
-       {
-               .name = "vid_pid",
-               .handler = &esp_usb_jtag_vid_pid,
-               .mode = COMMAND_CONFIG,
-               .help = "set vendor ID and product ID for ESP usb jtag driver",
-               .usage = "vid pid",
-       },
        {
                .name = "caps_descriptor",
                .handler = &esp_usb_jtag_caps_descriptor,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 24a5bdda78..dede6d5018 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -241,6 +241,13 @@ proc  interface_list args {
        eval adapter list $args
 }
 
+lappend _telnet_autocomplete_skip "espusbjtag vid_pid"
+proc "espusbjtag vid_pid" args {
+       echo "DEPRECATED! use 'adapter usb vid_pid' not 'espusbjtag vid_pid'"
+       eval adapter usb vid_pid $args
+}
+
+
 lappend _telnet_autocomplete_skip ftdi_location
 proc ftdi_location args {
        echo "DEPRECATED! use 'adapter usb location' not 'ftdi_location'"
diff --git a/tcl/interface/esp_usb_bridge.cfg b/tcl/interface/esp_usb_bridge.cfg
index 9342239e77..9354855bad 100644
--- a/tcl/interface/esp_usb_bridge.cfg
+++ b/tcl/interface/esp_usb_bridge.cfg
@@ -5,5 +5,5 @@
 
 adapter driver esp_usb_jtag
 
-espusbjtag vid_pid 0x303a 0x1002
+adapter usb vid_pid 0x303a 0x1002
 espusbjtag caps_descriptor 0x030A  # string descriptor index:10
diff --git a/tcl/interface/esp_usb_jtag.cfg b/tcl/interface/esp_usb_jtag.cfg
index 583a92d6a6..eff1224a85 100644
--- a/tcl/interface/esp_usb_jtag.cfg
+++ b/tcl/interface/esp_usb_jtag.cfg
@@ -5,7 +5,7 @@
 
 adapter driver esp_usb_jtag
 
-espusbjtag vid_pid 0x303a 0x1001
+adapter usb vid_pid 0x303a 0x1001
 espusbjtag caps_descriptor 0x2000
 
 transport select jtag

-- 

Reply via email to