From 1297098eae5ee4a22c1139497c97ef21eac83cba Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Sun, 9 Jan 2022 11:50:35 +0100 Subject: [PATCH 1/2] When the specified part has a matching signature, print the specified part instead of one from the parts list --- src/main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 6fd432ec..1bc1d90f 100644 --- a/src/main.c +++ b/src/main.c @@ -1218,12 +1218,19 @@ int main(int argc, char * argv []) if (sig->buf[i] != 0x00) zz = 0; } + + bool signature_matches = + sig->size == 3 && + sig->buf[0] == p->signature[0] && + sig->buf[1] == p->signature[1] && + sig->buf[2] == p->signature[2]; + if (quell_progress < 2) { AVRPART * part; part = locate_part_by_signature(part_list, sig->buf, sig->size); if (part) { - avrdude_message(MSG_INFO, " (probably %s)", part->id); + avrdude_message(MSG_INFO, " (probably %s)", signature_matches ? p->id : part->id); } } if (ff || zz) { @@ -1252,10 +1259,7 @@ int main(int argc, char * argv []) } } - if (sig->size != 3 || - sig->buf[0] != p->signature[0] || - sig->buf[1] != p->signature[1] || - sig->buf[2] != p->signature[2]) { + if (!signature_matches) { avrdude_message(MSG_INFO, "%s: Expected signature for %s is %02X %02X %02X\n", progname, p->desc, p->signature[0], p->signature[1], p->signature[2]); From f67cb3c2247a540d02855b77cb9902ad9b6642fe Mon Sep 17 00:00:00 2001 From: Marius Greuel Date: Sun, 9 Jan 2022 11:51:36 +0100 Subject: [PATCH 2/2] Preserve the insertion order of programmers and parts when parsing the avrdude.conf file --- src/config_gram.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config_gram.y b/src/config_gram.y index d82fae9e..e2a935cf 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -294,7 +294,7 @@ prog_def : lrmv_d(programmers, existing_prog); pgm_free(existing_prog); } - PUSH(programmers, current_prog); + LISTADD(programmers, current_prog); // pgm_fill_old_pins(current_prog); // TODO to be removed if old pin data no longer needed // pgm_display_generic(current_prog, id); current_prog = NULL; @@ -387,7 +387,7 @@ part_def : lrmv_d(part_list, existing_part); avr_free_part(existing_part); } - PUSH(part_list, current_part); + LISTADD(part_list, current_part); current_part = NULL; } ;