Hi all, 

I now made the diff with -u hoping that this is acceptable.

Regards Matthias

--- /home/mschz/elektronik/libsigrok/src/dmm/vc96.c	2023-04-17 18:11:31.155109310 +0200
+++ /home/mschz/elektronik/libsigrok.ba1/src/dmm/vc96.c	2023-04-17 21:29:12.131825015 +0200
@@ -92,10 +92,13 @@
 	info->is_ac = !strncmp(buf, "AC", 2);
 	info->is_dc = !strncmp(buf, "DC", 2);
 
-	/* Bytes 0-2: Measurement mode DIO, OHM */
-	info->is_ohm = !strncmp(buf, "OHM", 3);
-	info->is_diode = !strncmp(buf, "DIO", 3);
-	info->is_hfe = !strncmp(buf, "hfe", 3);
+	/* Bytes 0-2: Measurement mode, except AC/DC */
+	info->is_ohm = !strncmp(buf, "OHM", 3) ||
+		(!strncmp(buf, "  ", 3) && info->is_ohm);
+	info->is_diode = !strncmp(buf, "DIO", 3) ||
+		(!strncmp(buf, "  ", 3) && info->is_volt && info->is_milli);
+	info->is_hfe = !strncmp(buf, "hfe", 3) && !info->is_ampere && !info->is_volt &&
+		!info->is_resistance && !info->is_diode;
 
 	/* Bytes 3-8: See parse_value(). */
 
@@ -119,21 +122,15 @@
 		info->is_volt = TRUE;
 	else if (!g_ascii_strcasecmp(u, "mV"))
 		info->is_milli = info->is_volt = TRUE;
-	else if (!g_ascii_strcasecmp(u, "K"))
+	else if (!g_ascii_strncasecmp(u, "K", 1))
+	/* ignore case, VC96 sends wrong upper case "K" */
 		info->is_kilo = TRUE;
-	else if (!g_ascii_strcasecmp(u, "M"))
+	else if (!g_ascii_strncmp(u, "M", 1))
 		info->is_mega = TRUE;
 	else if (!g_ascii_strcasecmp(u, ""))
 		info->is_unitless = TRUE;
 
-	/* Bytes 0-2: Measurement mode, except AC/DC */
-	info->is_resistance = !strncmp(buf, "OHM", 3) ||
-		(!strncmp(buf, "  ", 3) && info->is_ohm);
-	info->is_diode = !strncmp(buf, "DIO", 3) ||
-		(!strncmp(buf, "  ", 3) && info->is_volt && info->is_milli);
-	info->is_hfe = !strncmp(buf, "hfe", 3) ||
-		(!strncmp(buf, "  ", 3) && !info->is_ampere && !info->is_volt &&
-		!info->is_resistance && !info->is_diode);
+	sr_spew("is_kilo = %i  is_mega = %i", info->is_kilo, info->is_mega);
 
 	/*
 	 * Note:
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to