add means to set cable index from command line

This commit is contained in:
Rengifo, Rodrigo
2022-06-01 07:17:38 -07:00
parent 610a495898
commit dec1a0920f
3 changed files with 11 additions and 3 deletions
+6 -1
View File
@@ -64,6 +64,7 @@ struct arguments {
int16_t altsetting;
uint16_t vid;
uint16_t pid;
uint16_t cable_index;
string ip_adr;
uint32_t protect_flash;
bool unprotect_flash;
@@ -85,7 +86,7 @@ int main(int argc, char **argv)
/* command line args. */
struct arguments args = {0, false, false, false, 0, "", "", "-", "", -1,
0, false, "-", false, false, false, false, Device::PRG_NONE, false,
false, false, "", "", "", -1, 0, false, -1, 0, 0, "127.0.0.1",
false, false, "", "", "", -1, 0, false, -1, 0, 0, 0, "127.0.0.1",
0, false, "", false, false};
/* parse arguments */
try {
@@ -198,6 +199,9 @@ int main(int argc, char **argv)
cable.config.pid = args.pid;
}
// always set this
cable.config.index = args.cable_index;
/* FLASH direct access */
if (args.spi || (board && board->mode == COMM_SPI)) {
/* if no instruction from user -> select flash mode */
@@ -590,6 +594,7 @@ int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *p
cxxopts::value<bool>(args->invert_read_edge))
("vid", "probe Vendor ID", cxxopts::value<uint16_t>(args->vid))
("pid", "probe Product ID", cxxopts::value<uint16_t>(args->pid))
("cable-index", "probe index", cxxopts::value<uint16_t>(args->cable_index))
("ftdi-serial", "FTDI chip serial number", cxxopts::value<string>(args->ftdi_serial))
("ftdi-channel", "FTDI chip channel number (channels 0-3 map to A-D)", cxxopts::value<int>(args->ftdi_channel))