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/+/9585
-- gerrit commit cc15f48a37609e3d23b144f04a6d7a4a9de09057 Author: Marc Schink <[email protected]> Date: Wed Apr 22 17:09:02 2026 +0200 adapter/stlink: 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 'st-link vid_pid' command for backwards compatibility, but mark it as deprecated. Checkpatch-ignore: LONG_LINE Change-Id: Ibd56adda044845148f0b130dcaf5e98b412be3be Signed-off-by: Marc Schink <[email protected]> diff --git a/doc/openocd.texi b/doc/openocd.texi index ee97868508..7dcb0be176 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3410,10 +3410,6 @@ ST-LINK server software module}. @emph{Note:} ST-Link TCP server does not support the SWIM transport. @end deffn -@deffn {Config Command} {st-link vid_pid} [vid pid]+ -Pairs of vendor IDs and product IDs of the device. -@end deffn - @deffn {Command} {st-link cmd} rx_n (tx_byte)+ Sends an arbitrary command composed by the sequence of bytes @var{tx_byte} and receives @var{rx_n} bytes. diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index b4d21100cc..bac9c26cb5 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -3406,7 +3406,7 @@ static int stlink_usb_usb_open(void *handle, struct hl_interface_param *param) in order to become operational. */ do { - if (jtag_libusb_open(param->vid, param->pid, NULL, + if (jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(), NULL, &h->usb_backend_priv.fd, stlink_usb_get_alternate_serial) != ERROR_OK) { LOG_ERROR("open failed"); return ERROR_FAIL; @@ -3740,9 +3740,9 @@ static int stlink_open(struct hl_interface_param *param, enum stlink_mode mode, h->st_mode = mode; - for (unsigned int i = 0; param->vid[i]; i++) { + for (unsigned int i = 0; adapter_usb_get_vids()[i]; i++) { LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", - h->st_mode, param->vid[i], param->pid[i], + h->st_mode, adapter_usb_get_vids()[i], adapter_usb_get_pids()[i], adapter_get_required_serial() ? adapter_get_required_serial() : ""); } @@ -4984,31 +4984,6 @@ static int stlink_dap_trace_read(uint8_t *buf, size_t *size) return stlink_usb_trace_read(stlink_dap_handle, buf, size); } -/** */ -COMMAND_HANDLER(stlink_dap_vid_pid) -{ - unsigned int i, max_usb_ids = HLA_MAX_USB_IDS; - - if (CMD_ARGC > max_usb_ids * 2) { - LOG_WARNING("ignoring extra IDs in vid_pid " - "(maximum is %d pairs)", max_usb_ids); - CMD_ARGC = max_usb_ids * 2; - } - if (CMD_ARGC < 2 || (CMD_ARGC & 1)) { - LOG_WARNING("incomplete vid_pid configuration directive"); - return ERROR_COMMAND_SYNTAX_ERROR; - } - for (i = 0; i < CMD_ARGC; i += 2) { - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], stlink_dap_param.vid[i / 2]); - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], stlink_dap_param.pid[i / 2]); - } - - /* null termination */ - stlink_dap_param.vid[i / 2] = stlink_dap_param.pid[i / 2] = 0; - - return ERROR_OK; -} - /** */ COMMAND_HANDLER(stlink_dap_backend_command) { @@ -5074,13 +5049,6 @@ COMMAND_HANDLER(stlink_dap_cmd_command) /** */ static const struct command_registration stlink_dap_subcommand_handlers[] = { - { - .name = "vid_pid", - .handler = stlink_dap_vid_pid, - .mode = COMMAND_CONFIG, - .help = "USB VID and PID of the adapter", - .usage = "(vid pid)+", - }, { .name = "backend", .handler = &stlink_dap_backend_command, diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl index f24e57ab06..441f2cccb1 100644 --- a/src/jtag/startup.tcl +++ b/src/jtag/startup.tcl @@ -1183,6 +1183,12 @@ proc "hla_stlink_backend" {args} { eval hla stlink_backend $args } +lappend _telnet_autocomplete_skip "st-link vid_pid" +proc "st-link vid_pid" {args} { + echo "DEPRECATED! use 'adapter usb vid_pid', not 'st-link vid_pid'" + eval adapter usb vid_pid $args +} + lappend _telnet_autocomplete_skip "kitprog_init_acquire_psoc" proc "kitprog_init_acquire_psoc" {} { echo "DEPRECATED! use 'kitprog init_acquire_psoc', not 'kitprog_init_acquire_psoc'" diff --git a/tcl/interface/stlink.cfg b/tcl/interface/stlink.cfg index 48c5656615..2cea18f20a 100644 --- a/tcl/interface/stlink.cfg +++ b/tcl/interface/stlink.cfg @@ -17,7 +17,7 @@ if { [adapter name] == "hla" } { } adapter driver st-link -st-link 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 # transport select jtag # transport select swd --
