Prevent `spi' and `pgm' commands from crashing terminal mode
These commands are been meaningful only on direct bitbang programming adapters which implement a pgm->setpin method. Disable these commands for all other programmers, and issue an informational message. This is a partial fix for bug #790.
This commit is contained in:
parent
69231d7ad0
commit
a6a06f47f6
22
src/term.c
22
src/term.c
|
@ -733,18 +733,26 @@ static int cmd_help(PROGRAMMER * pgm, struct avrpart * p,
|
|||
static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, 1);
|
||||
spi_mode = 1;
|
||||
return 0;
|
||||
if (pgm->setpin != NULL) {
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, 1);
|
||||
spi_mode = 1;
|
||||
return 0;
|
||||
}
|
||||
avrdude_message(MSG_INFO, "`spi' command unavailable for this programmer type\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int cmd_pgm(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
||||
spi_mode = 0;
|
||||
pgm->initialize(pgm, p);
|
||||
return 0;
|
||||
if (pgm->setpin != NULL) {
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
||||
spi_mode = 0;
|
||||
pgm->initialize(pgm, p);
|
||||
return 0;
|
||||
}
|
||||
avrdude_message(MSG_INFO, "`pgm' command unavailable for this programmer type\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p,
|
||||
|
|
Loading…
Reference in New Issue