Sharpen warning messages

pgm->type is an internal string that is unknown to users; in fact, even
developers don't necessarily know it well. This commit replaces references
to pgm->type to the more specific -c programmer (that the user provided).
This commit is contained in:
stefanrueger
2025-05-09 16:21:13 +02:00
parent 53375f4b1a
commit 46893bed3d
20 changed files with 21 additions and 22 deletions

View File

@@ -113,7 +113,7 @@ static int arduino_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const
static int arduino_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
pgm->port = port;
union pinfo pinfo;

View File

@@ -322,7 +322,7 @@ static int avr910_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
static int avr910_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
union pinfo pinfo;
if(pgm->baudrate == 0)

View File

@@ -443,9 +443,9 @@ static int buspirate_verifyconfig(const PROGRAMMER *pgm) {
static int buspirate_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock) {
if(str_caseeq(pgm->type, "BusPirate_BB"))
pmsg_warning("programmer type %s does not support adjustable bitclock speed using -B; use -i instead\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed using -B; use -i instead\n", pgmid);
else {
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
imsg_warning("use -x help to view alternative SPI clock options\n");
}
}

View File

@@ -322,7 +322,7 @@ static void butterfly_enable(PROGRAMMER *pgm, const AVRPART *p) {
static int butterfly_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
pgm->port = port;

View File

@@ -252,7 +252,7 @@ static int ch341a_open(PROGRAMMER *pgm, const char *port) {
}
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
return 0;
}

View File

@@ -729,7 +729,7 @@ static void dryrun_disable(const PROGRAMMER *pgm) {
static int dryrun_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
pmsg_debug("%s(%s)\n", __func__, port? port: "NULL");

View File

@@ -181,7 +181,7 @@ void flip1_initpgm(PROGRAMMER *pgm) {
static int flip1_open(PROGRAMMER *pgm, const char *port_spec) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
FLIP1(pgm)->dfu = dfu_open(port_spec);
return (FLIP1(pgm)->dfu != NULL)? 0: -1;

View File

@@ -179,7 +179,7 @@ void flip2_initpgm(PROGRAMMER *pgm) {
static int flip2_open(PROGRAMMER *pgm, const char *port_spec) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
FLIP2(pgm)->dfu = dfu_open(port_spec);
return (FLIP2(pgm)->dfu != NULL)? 0: -1;

View File

@@ -1205,7 +1205,7 @@ static int jtagmkII_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
if(jtagmkII_set_sck_period(pgm, pgm->bitclock) != 0)
return -1;
} else {
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s is not known to support adjustable bitclock speed; ignoring -B\n", pgmid);
}
}

View File

@@ -562,7 +562,7 @@ static void linuxgpio_libgpiod_display(const PROGRAMMER *pgm, const char *p) {
static int linuxgpio_libgpiod_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
if(bitbang_check_prerequisites(pgm) < 0)
return -1;

View File

@@ -580,7 +580,7 @@ static int micronucleus_open(PROGRAMMER *pgm, const char *port) {
pmsg_debug("micronucleus_open(\"%s\")\n", port);
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
struct pdata *pdata = &my;
const char *bus_name = NULL;

View File

@@ -226,9 +226,8 @@ static void par_enable(PROGRAMMER *pgm, const AVRPART *p) {
}
static int par_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed using -B. Use -i instead\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed using -B; use -i instead\n", pgmid);
if(bitbang_check_prerequisites(pgm) < 0)
return -1;

View File

@@ -221,7 +221,7 @@ static int serbb_open(PROGRAMMER *pgm, const char *port) {
int r;
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed using -B. Use -i instead\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed using -B; use -i instead\n", pgmid);
if(bitbang_check_prerequisites(pgm) < 0)
return -1;

View File

@@ -230,7 +230,7 @@ static int serbb_open(PROGRAMMER *pgm, const char *port) {
HANDLE hComPort = INVALID_HANDLE_VALUE;
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed using -B. Use -i instead\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed using -B; use -i instead\n", pgmid);
if(bitbang_check_prerequisites(pgm) < 0)
return -1;

View File

@@ -59,7 +59,7 @@ static void serialupdi_teardown(PROGRAMMER *pgm) {
static int serialupdi_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s sets its UPDI speed using -b [baudrate]. Ignoring -B\n", pgm->type);
pmsg_warning("-c %s sets its UPDI speed using -b baudrate; ignoring -B\n", pgmid);
pgm->port = port;
return updi_link_open(pgm);

View File

@@ -861,7 +861,7 @@ static int stk500_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock) {
if(str_eq(pgm->type, "arduino_as_isp")) // The Arduino as ISP will crash if we change the bitclock
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
else {
if(!(pgm->extra_features & HAS_BITCLOCK_ADJ))
pmsg_warning("setting bitclock despite HAS_BITCLOCK_ADJ missing in pgm->extra_features\n");

View File

@@ -308,7 +308,7 @@ static int teensy_open(PROGRAMMER *pgm, const char *port) {
pmsg_debug("teensy_open(\"%s\")\n", port);
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
struct pdata *pdata = &my;
const char *bus_name = NULL;

View File

@@ -2228,7 +2228,7 @@ static void urclock_disable(const PROGRAMMER *pgm) {
static int urclock_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
union pinfo pinfo;
pgm->port = port;

View File

@@ -136,7 +136,7 @@ static int wiring_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
static int wiring_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
int timetosnooze;
union pinfo pinfo;

View File

@@ -1417,7 +1417,7 @@ static int xbee_getsync(const PROGRAMMER *pgm) {
static int xbee_open(PROGRAMMER *pgm, const char *port) {
if(pgm->bitclock)
pmsg_warning("programmer type %s does not support adjustable bitclock speed; ignoring -B\n", pgm->type);
pmsg_warning("-c %s does not support adjustable bitclock speed; ignoring -B\n", pgmid);
union pinfo pinfo;