From: Alexandru Gagniuc Date: Fri, 30 Nov 2012 18:29:22 +0000 (-0600) Subject: metex14: Fix parsing of spaces. X-Git-Tag: dsupstream~513 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=76b55dfa8a5318a0495d3f2cfb29d6cd229ce5dc;p=libsigrok.git metex14: Fix parsing of spaces. When the parser found a space, it treated it as an invalid digit and discarded the whole packet. This behavior was incorrect on 2000 count devices, where the first digit can be sent as a space rather than a '0'. Convert spaces to '0' and parse them as usual. Signed-off-by: Alexandru Gagniuc --- diff --git a/hardware/common/dmm/metex14.c b/hardware/common/dmm/metex14.c index 5e99feff..e6b9b983 100644 --- a/hardware/common/dmm/metex14.c +++ b/hardware/common/dmm/metex14.c @@ -75,6 +75,9 @@ static int parse_value(const uint8_t *buf, float *result) factor = 1000; for (i = 0; i < 5; i++) { digit = buf[4 + i]; + /* Convert spaces to '0', so that we can parse them. */ + if (digit == ' ') + digit = '0'; if (digit == '.') { decimal_point = i; } else if (isdigit(digit)) {