diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-10-07 22:31:27 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-11-28 10:58:14 +0000 |
commit | d7b2313b5aec47e6a4a450fdf625644ca60d633d (patch) | |
tree | 3b1d0518618a89fe8df0477272a9488fa518f739 /src/jtag/drivers | |
parent | b1afd3dba4f046843d0c7c583c0b4ed56122d757 (diff) | |
download | riscv-openocd-d7b2313b5aec47e6a4a450fdf625644ca60d633d.zip riscv-openocd-d7b2313b5aec47e6a4a450fdf625644ca60d633d.tar.gz riscv-openocd-d7b2313b5aec47e6a4a450fdf625644ca60d633d.tar.bz2 |
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 <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6652
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Diffstat (limited to 'src/jtag/drivers')
-rw-r--r-- | src/jtag/drivers/kitprog.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/src/jtag/drivers/kitprog.c b/src/jtag/drivers/kitprog.c index 327bb57..0c5ccc6 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_required_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; @@ -901,13 +884,6 @@ static const struct command_registration kitprog_command_handlers[] = { .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, .mode = COMMAND_CONFIG, |