From 2c30155b076a2198fbccd4d41be7f8b462975350 Mon Sep 17 00:00:00 2001
From: cnlohr <lohr85@gmail.com>
Date: Mon, 12 Feb 2024 18:09:44 -0800
Subject: [PATCH] Fix operation for ch32v003

---
 minichlink/pgm-wch-linke.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/minichlink/pgm-wch-linke.c b/minichlink/pgm-wch-linke.c
index 51e2654..36f4143 100644
--- a/minichlink/pgm-wch-linke.c
+++ b/minichlink/pgm-wch-linke.c
@@ -375,7 +375,7 @@ static int LESetupInterface( void * d )
 		iss->sector_size = 256;
 
 		wch_link_command( dev, "\x81\x0d\x01\x03", 4, (int*)&transferred, rbuff, 1024 ); // Reply: Ignored, 820d050900300500
-	} else if( !result ) {
+	} else if( result < 0 ) {
 		fprintf( stderr, "Chip type not supported. Aborting...\n" );
 		return -1;
 	}
-- 
GitLab