From e0683417163d1563cedbfeb0a2c23e4d783d4940 Mon Sep 17 00:00:00 2001
From: MCUdude <hansibull@gmail.com>
Date: Sun, 26 Jun 2022 10:19:27 +0200
Subject: [PATCH] Make sure "-x hvupdi" is only valid for Pickit4 and
 Powerdebugger

---
 src/jtag3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/jtag3.c b/src/jtag3.c
index 976291f4..5e971a28 100644
--- a/src/jtag3.c
+++ b/src/jtag3.c
@@ -1458,6 +1458,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms)
   LNODEID ln;
   const char *extended_param;
   int rv = 0;
+  avrdude_message(MSG_INFO, "id: %s, desc: %s, type: %s\n", ldata(lfirst(pgm->id)), pgm->desc, pgm->type);
 
   for (ln = lfirst(extparms); ln; ln = lnext(ln)) {
     extended_param = ldata(ln);
@@ -1482,7 +1483,9 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms)
 
       continue;
     }
-    else if (matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) {
+
+    else if ((matches(extended_param, "hvupdi") || matches(extended_param, "hvupdi=1")) &&
+      (matches(ldata(lfirst(pgm->id)), "pickit4_updi") || matches(ldata(lfirst(pgm->id)), "powerdebugger_updi"))) {
       PDATA(pgm)->use_hvupdi = true;
       continue;
     }