Skip to content

Commit ada3ee8

Browse files
authored
Merge pull request #2061 from stefanrueger/libavrdude_exit
Differentiate `LIBAVRDUDE_EXIT_FAIL` and `..._EXIT_OK`
2 parents 6350272 + 59ec3f1 commit ada3ee8

30 files changed

+123
-99
lines changed

src/arduino.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static int arduino_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
5656

5757
if(str_eq(extended_param, "help")) {
5858
help = true;
59-
rv = LIBAVRDUDE_EXIT;
59+
rv = LIBAVRDUDE_EXIT_OK;
6060
}
6161

6262
if(!help) {

src/avr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ int avr_read_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, con
471471
if(pgm->read_sig_bytes) {
472472
int rc = pgm->read_sig_bytes(pgm, p, mem);
473473

474-
if(rc < 0 && rc != LIBAVRDUDE_EXIT)
474+
if(rc < 0 && rc != LIBAVRDUDE_EXIT_OK)
475475
led_set(pgm, LED_ERR);
476476
led_clr(pgm, LED_PGM);
477477
return rc;
@@ -1216,13 +1216,13 @@ int avr_signature(const PROGRAMMER *pgm, const AVRPART *p) {
12161216
if(verbose > 1)
12171217
report_progress(0, 1, "Reading");
12181218
rc = avr_read(pgm, p, "signature", 0);
1219-
if(rc < LIBAVRDUDE_SUCCESS && rc != LIBAVRDUDE_EXIT) {
1219+
if(rc < LIBAVRDUDE_SUCCESS && rc != LIBAVRDUDE_EXIT_OK) {
12201220
pmsg_error("unable to read signature data for part %s (rc = %d)\n", p->desc, rc);
12211221
return rc;
12221222
}
12231223
report_progress(1, 1, NULL);
12241224

1225-
return rc < LIBAVRDUDE_SUCCESS? LIBAVRDUDE_EXIT: LIBAVRDUDE_SUCCESS;
1225+
return rc < LIBAVRDUDE_SUCCESS? LIBAVRDUDE_EXIT_OK: LIBAVRDUDE_SUCCESS;
12261226
}
12271227

12281228
// Obtain bitmask for byte in memory (classic, TPI, PDI and UPDI parts)

src/avr910.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static int avr910_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
303303
}
304304
if(str_eq(extended_param, "help")) {
305305
help = true;
306-
rv = LIBAVRDUDE_EXIT;
306+
rv = LIBAVRDUDE_EXIT_OK;
307307
}
308308

309309
if(!help) {

src/avrdude.1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,15 +1665,18 @@ Show help menu and exit.
16651665
.It Ar PICkit 4
16661666
.It Ar MPLAB SNAP
16671667
.Bl -tag -offset indent -width indent
1668-
.It Ar mode=avr,pic
1669-
Switch programmer to AVR or PIC mode, then exit: the PICkit 4 and MPLAB SNAP
1670-
programmer can only be utilised by
1668+
.It Ar mode=avr
1669+
Switch programmer to AVR mode, then exit if not already in AVR mode
1670+
.It Ar mode=<mplab|pic>
1671+
Switch programmer to MPLAB aka PIC mode, then exit
1672+
.Pp
1673+
The PICkit 4 and MPLAB SNAP programmer can only be utilised by
16711674
.Nm
16721675
when in AVR mode. Use
16731676
.Ar -x mode=avr
16741677
for switching to AVR mode, or
1675-
.Ar -x mode=pic
1676-
for switching to PIC mode.
1678+
.Ar -x mode=mplab
1679+
for switching (back) to MPLAB mode.
16771680
.It Ar help
16781681
Show help menu and exit.
16791682
.El

src/avrftdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ static int avrftdi_jtag_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
13481348

13491349
pmsg_error("programmer type %s is known not to work for %s\n", pgm->type, p->desc);
13501350
pmsg_error("exiting, use -F to carry on regardless\n");
1351-
return LIBAVRDUDE_EXIT;
1351+
return LIBAVRDUDE_EXIT_FAIL;
13521352
}
13531353
}
13541354

src/buspirate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static int buspirate_parseextparms(const PROGRAMMER *pgm, const LISTID extparms)
395395

396396
if(str_eq(extended_param, "help")) {
397397
help = true;
398-
rv = LIBAVRDUDE_EXIT;
398+
rv = LIBAVRDUDE_EXIT_OK;
399399
}
400400

401401
if(!help) {

src/butterfly.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ static int butterfly_parseextparms(const PROGRAMMER *pgm, const LISTID extparms)
640640

641641
if(str_eq(extended_param, "help")) {
642642
help = true;
643-
rv = LIBAVRDUDE_EXIT;
643+
rv = LIBAVRDUDE_EXIT_OK;
644644
}
645645

646646
if(!help) {

src/doc/avrdude.texi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,13 +1422,16 @@ The current set-voltage can be read by @code{-x vtarg} alone.
14221422

14231423
The PICkit 4 and MPLAB(R) SNAP programmers accept the following extended parameters:
14241424
@table @code
1425-
@item mode=avr,mplab/pic
1426-
Switch programmer to AVR or MPLAB mode, then exit: the PICkit 4 and MPLAB(R) SNAP
1427-
programmer can only be utilised by Avrdude when in AVR mode.
1428-
Use @code{-x mode=avr} for switching to AVR mode, or @code{-x mode=mplab}
1429-
for switching to MPLAB mode.
1425+
@item mode=avr
1426+
Switch programmer to AVR mode, then exit unless it was already in AVR mode
1427+
@item mode=<mplab|pic>
1428+
Switch programmer to MPLAB aka PIC mode, then exit
14301429
@end table
14311430

1431+
The PICkit 4 and MPLAB(R) SNAP programmer can only be utilised by AVRDUDE
1432+
when in AVR mode. Use @code{-x mode=avr} for switching to AVR mode, or
1433+
@code{-x mode=mplab} for switching (back) to MPLAB mode.
1434+
14321435
@cindex Option @code{-x} PICkit 5
14331436
@cindex @code{-x} PICkit 5
14341437
@cindex MPLAB(R) PICkit 4

src/dryrun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static int dryrun_parseextparams(const PROGRAMMER *pgm, const LISTID extparms) {
10161016
}
10171017
if(str_eq(xpara, "help")) {
10181018
help = true;
1019-
rc = LIBAVRDUDE_EXIT;
1019+
rc = LIBAVRDUDE_EXIT_OK;
10201020
}
10211021

10221022
if(!help) {

src/flip2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static int flip2_parseexitspecs(PROGRAMMER *pgm, const char *sp) {
484484
}
485485
if(str_eq(cp, "help")) {
486486
help = true;
487-
rv = LIBAVRDUDE_EXIT;
487+
rv = LIBAVRDUDE_EXIT_OK;
488488
}
489489

490490
if(!help) {

0 commit comments

Comments
 (0)