This is an automated email from Gerrit.

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

-- gerrit

commit 099c1c449c2070c3447346388edc51a79d995ce7
Author: Antonio Borneo <[email protected]>
Date:   Thu Oct 7 22:31:27 2021 +0200

    jtag/kitprog: switch to command 'adapter serial'
    
    The driver kitprog defines the command 'kitprog_serial' to specify
    the serial string of the adapter.
    
    Remove and deprecate the driver command, and use 'adapter serial'.
    
    Change-Id: I844cb815af01137392b6d12e1b5972fc77ac092d
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index dbad5deef..f990a6ff6 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2371,9 +2371,9 @@ This command is only available if your libusb1 is at 
least version 1.0.16.
 Specifies the @var{serial_string} of the adapter to use.
 If this command is not specified, serial strings are not considered.
 Only the following adapter drivers use the serial string from this command:
-cmsis_dap, ft232r, ftdi.
+cmsis_dap, ft232r, ftdi, kitprog.
 The following adapters have their own command to specify the serial string:
-hla, jlink, kitprog, presto, st-link, vsllink, xds110.
+hla, jlink, presto, st-link, vsllink, xds110.
 @end deffn
 
 @section Interface Drivers
@@ -2903,11 +2903,6 @@ Indicate that a PSoC acquisition sequence needs to be 
run during adapter init.
 Please be aware that the acquisition sequence hard-resets the target.
 @end deffn
 
-@deffn {Config Command} {kitprog_serial} serial
-Select a KitProg device by its @var{serial}. If left unspecified, the first
-device detected by OpenOCD will be used.
-@end deffn
-
 @deffn {Command} {kitprog acquire_psoc}
 Run a PSoC acquisition sequence immediately. Typically, this should not be used
 outside of the target-specific configuration scripts since it hard-resets the
diff --git a/src/jtag/drivers/kitprog.c b/src/jtag/drivers/kitprog.c
index 327bb572d..e1b03b13d 100644
--- a/src/jtag/drivers/kitprog.c
+++ b/src/jtag/drivers/kitprog.c
@@ -39,6 +39,7 @@
 
 #include <hidapi.h>
 
+#include <jtag/adapter.h>
 #include <jtag/interface.h>
 #include <jtag/swd.h>
 #include <jtag/commands.h>
@@ -114,7 +115,6 @@ struct pending_transfer_result {
        void *buffer;
 };
 
-static char *kitprog_serial;
 static bool kitprog_init_acquire_psoc;
 
 static int pending_transfer_count, pending_queue_len;
@@ -230,7 +230,6 @@ static int kitprog_quit(void)
        free(kitprog_handle->packet_buffer);
        free(kitprog_handle->serial);
        free(kitprog_handle);
-       free(kitprog_serial);
        free(pending_transfers);
 
        return ERROR_OK;
@@ -272,7 +271,7 @@ static int kitprog_usb_open(void)
        const uint16_t vids[] = { VID, 0 };
        const uint16_t pids[] = { PID, 0 };
 
-       if (jtag_libusb_open(vids, pids, kitprog_serial,
+       if (jtag_libusb_open(vids, pids, adapter_get_serial(),
                        &kitprog_handle->usb_handle, NULL) != ERROR_OK) {
                LOG_ERROR("Failed to open or find the device");
                return ERROR_FAIL;
@@ -851,22 +850,6 @@ COMMAND_HANDLER(kitprog_handle_acquire_psoc_command)
        return retval;
 }
 
-COMMAND_HANDLER(kitprog_handle_serial_command)
-{
-       if (CMD_ARGC == 1) {
-               kitprog_serial = strdup(CMD_ARGV[0]);
-               if (!kitprog_serial) {
-                       LOG_ERROR("Failed to allocate memory for the serial 
number");
-                       return ERROR_FAIL;
-               }
-       } else {
-               LOG_ERROR("expected exactly one argument to kitprog_serial 
<serial-number>");
-               return ERROR_FAIL;
-       }
-
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(kitprog_handle_init_acquire_psoc_command)
 {
        kitprog_init_acquire_psoc = true;
@@ -900,13 +883,6 @@ static const struct command_registration 
kitprog_command_handlers[] = {
                .usage = "<cmd>",
                .chain = kitprog_subcommand_handlers,
        },
-       {
-               .name = "kitprog_serial",
-               .handler = &kitprog_handle_serial_command,
-               .mode = COMMAND_CONFIG,
-               .help = "set the serial number of the adapter",
-               .usage = "serial_string",
-       },
        {
                .name = "kitprog_init_acquire_psoc",
                .handler = &kitprog_handle_init_acquire_psoc_command,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index b21ddc646..75b1bfbdf 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -759,4 +759,10 @@ proc "ftdi serial" {args} {
        eval adapter serial $args
 }
 
+lappend _telnet_autocomplete_skip kitprog_serial
+proc kitprog_serial args {
+       echo "DEPRECATED! use 'adapter serial' not 'kitprog_serial'"
+       eval adapter serial $args
+}
+
 # END MIGRATION AIDS
diff --git a/tcl/interface/kitprog.cfg b/tcl/interface/kitprog.cfg
index 29fce489b..933a05408 100644
--- a/tcl/interface/kitprog.cfg
+++ b/tcl/interface/kitprog.cfg
@@ -9,4 +9,4 @@
 adapter driver kitprog
 
 # Optionally specify the serial number of the KitProg you want to use.
-#kitprog_serial 1926402735485200
+# adapter serial 1926402735485200

-- 

Reply via email to