Add quell command in terminal
Sets the quell_progress global variable that can be, and is, consulted by programmers. Setting quell_progress to a positive number also switches off progress bars. It is currently not possible to switch on progress bars again: that is enabled in main.c once at the start of AVRDUDE. That code in main should move to avr.c to enable report_update() to consult quell_progress directly. Will do at another time when touching main.c and avr.c. smr
This commit is contained in:
parent
d9cb9772d7
commit
1e8b56751e
src
38
src/term.c
38
src/term.c
|
@ -91,6 +91,9 @@ static int cmd_pgm (PROGRAMMER * pgm, struct avrpart * p,
|
||||||
static int cmd_verbose (PROGRAMMER * pgm, struct avrpart * p,
|
static int cmd_verbose (PROGRAMMER * pgm, struct avrpart * p,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
static int cmd_quell (PROGRAMMER * pgm, struct avrpart * p,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
|
||||||
struct command cmd[] = {
|
struct command cmd[] = {
|
||||||
{ "dump", cmd_dump, "%s <memory> [<addr> <len> | <addr> ... | <addr> | ...]" },
|
{ "dump", cmd_dump, "%s <memory> [<addr> <len> | <addr> ... | <addr> | ...]" },
|
||||||
{ "read", cmd_dump, "alias for dump" },
|
{ "read", cmd_dump, "alias for dump" },
|
||||||
|
@ -107,6 +110,7 @@ struct command cmd[] = {
|
||||||
{ "spi", cmd_spi, "enter direct SPI mode" },
|
{ "spi", cmd_spi, "enter direct SPI mode" },
|
||||||
{ "pgm", cmd_pgm, "return to programming mode" },
|
{ "pgm", cmd_pgm, "return to programming mode" },
|
||||||
{ "verbose", cmd_verbose, "change verbosity" },
|
{ "verbose", cmd_verbose, "change verbosity" },
|
||||||
|
{ "quell", cmd_quell, "set quell level for progress bars" },
|
||||||
{ "help", cmd_help, "help" },
|
{ "help", cmd_help, "help" },
|
||||||
{ "?", cmd_help, "help" },
|
{ "?", cmd_help, "help" },
|
||||||
{ "quit", cmd_quit, "quit" }
|
{ "quit", cmd_quit, "quit" }
|
||||||
|
@ -1257,6 +1261,40 @@ static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cmd_quell(PROGRAMMER * pgm, struct avrpart * p,
|
||||||
|
int argc, char * argv[])
|
||||||
|
{
|
||||||
|
int nquell;
|
||||||
|
char *endp;
|
||||||
|
|
||||||
|
if (argc != 1 && argc != 2) {
|
||||||
|
avrdude_message(MSG_INFO, "Usage: quell [<value>]\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (argc == 1) {
|
||||||
|
avrdude_message(MSG_INFO, "Quell level: %d\n", quell_progress);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
nquell = strtol(argv[1], &endp, 0);
|
||||||
|
if (endp == argv[1] || *endp) {
|
||||||
|
avrdude_message(MSG_INFO, "%s (quell): can't parse quell level %s\n",
|
||||||
|
progname, argv[1]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (nquell < 0) {
|
||||||
|
avrdude_message(MSG_INFO, "%s: quell level must not be negative: %d\n",
|
||||||
|
progname, nquell);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
quell_progress = nquell;
|
||||||
|
avrdude_message(MSG_INFO, "New quell level: %d\n", quell_progress);
|
||||||
|
|
||||||
|
if(quell_progress > 0)
|
||||||
|
update_progress = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tokenize(char * s, char *** argv)
|
static int tokenize(char * s, char *** argv)
|
||||||
{
|
{
|
||||||
int i, n, l, k, nargs, offset;
|
int i, n, l, k, nargs, offset;
|
||||||
|
|
Loading…
Reference in New Issue