From f2263e71bb81f561a385d3a983b1b9b8a7bcdd92 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Wed, 9 Aug 2023 23:13:33 +0100 Subject: [PATCH] Check part-programmer compatibility early on --- src/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 0254ac14..e84e5ea4 100644 --- a/src/main.c +++ b/src/main.c @@ -1083,6 +1083,12 @@ int main(int argc, char * argv []) exit(1); } + if(!ovsigck && partdesc && (p = locate_part(part_list, partdesc)) && !(p->prog_modes & pgm->prog_modes)) { + pmsg_error("programmer %s cannot program part %s as they\n", pgmid, p->desc); + imsg_error("lack a common programming mode; use -F to override this check\n"); + exit(1); + } + if (pgm->initpgm) { pgm->initpgm(pgm); } else { @@ -1198,13 +1204,6 @@ int main(int argc, char * argv []) goto main_exit; } - if(!ovsigck && !(p->prog_modes & pgm->prog_modes)) { - pmsg_error("programmer %s cannot program part %s as they\n", pgmid, p->desc); - imsg_error("lack a common programming mode; use -F to override this check\n"); - exitrc = 1; - goto main_exit; - } - if (exitspecs != NULL) { if (pgm->parseexitspecs == NULL) { pmsg_warning("-E option not supported by this programmer type\n");