]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/agilent-dmm/sched.c
agilent-dmm: Correctly parse negative overload.
[libsigrok.git] / src / hardware / agilent-dmm / sched.c
index bd9cb3885ba2ef78d528f2a3af394b691168af18..b910f7aafd3c762b6bef5c027d732847018de7ee 100644 (file)
@@ -234,6 +234,7 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
        struct sr_datafeed_packet packet;
        struct sr_datafeed_analog analog;
        float fvalue;
+       const char *s;
        char *mstr;
 
        sr_spew("FETC reply '%s'.", g_match_info_get_string(match));
@@ -245,14 +246,15 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
                 * get metadata soon enough. */
                return SR_OK;
 
-       if (!strcmp(g_match_info_get_string(match), "+9.90000000E+37")) {
+       s = g_match_info_get_string(match);
+       if (!strcmp(s, "-9.90000000E+37") || !strcmp(s, "+9.90000000E+37")) {
                /* An invalid measurement shows up on the display as "O.L", but
                 * comes through like this. Since comparing 38-digit floats
                 * is rather problematic, we'll cut through this here. */
                fvalue = NAN;
        } else {
                mstr = g_match_info_fetch(match, 1);
-               if (sr_atof_ascii(mstr, &fvalue) != SR_OK || fvalue == 0.0) {
+               if (sr_atof_ascii(mstr, &fvalue) != SR_OK) {
                        g_free(mstr);
                        sr_err("Invalid float.");
                        return SR_ERR;