mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-13 01:14:56 +00:00
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:
@@ -733,19 +733,27 @@ static int cmd_help(PROGRAMMER * pgm, struct avrpart * p,
|
|||||||
static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p,
|
static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p,
|
||||||
int argc, char * argv[])
|
int argc, char * argv[])
|
||||||
{
|
{
|
||||||
|
if (pgm->setpin != NULL) {
|
||||||
pgm->setpin(pgm, PIN_AVR_RESET, 1);
|
pgm->setpin(pgm, PIN_AVR_RESET, 1);
|
||||||
spi_mode = 1;
|
spi_mode = 1;
|
||||||
return 0;
|
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,
|
static int cmd_pgm(PROGRAMMER * pgm, struct avrpart * p,
|
||||||
int argc, char * argv[])
|
int argc, char * argv[])
|
||||||
{
|
{
|
||||||
|
if (pgm->setpin != NULL) {
|
||||||
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
||||||
spi_mode = 0;
|
spi_mode = 0;
|
||||||
pgm->initialize(pgm, p);
|
pgm->initialize(pgm, p);
|
||||||
return 0;
|
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,
|
static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p,
|
||||||
int argc, char * argv[])
|
int argc, char * argv[])
|
||||||
|
|||||||
Reference in New Issue
Block a user