X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdmm%2Fmetex14.c;h=1c751bd5f794d2682cfacdec72f1f171b3d23ef9;hb=HEAD;hp=b610aba9fab962f43b09312414df38acf44680ce;hpb=cd97e39d8917ac7612712ee51ae24ffc89706239;p=libsigrok.git diff --git a/src/dmm/metex14.c b/src/dmm/metex14.c index b610aba9..1c751bd5 100644 --- a/src/dmm/metex14.c +++ b/src/dmm/metex14.c @@ -22,7 +22,6 @@ * * Metex 14-bytes ASCII protocol parser. * - * @internal * This should work for various multimeters which use this kind of protocol, * even though there is some variation in which modes each DMM supports. * @@ -196,8 +195,6 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval, { int factor; - (void)exponent; - /* Factors */ factor = 0; if (info->is_pico) @@ -213,6 +210,7 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval, if (info->is_mega) factor += 6; *floatval *= powf(10, factor); + *exponent += factor; /* Measurement modes */ if (info->is_volt) { @@ -329,14 +327,23 @@ static gboolean flags_valid(const struct metex14_info *info) return TRUE; } -#ifdef HAVE_LIBSERIALPORT +#ifdef HAVE_SERIAL_COMM SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial) { const uint8_t wbuf = 'D'; + size_t wrlen; + int ret; sr_spew("Requesting DMM packet."); - return serial_write_blocking(serial, &wbuf, 1, 0); + wrlen = sizeof(wbuf); + ret = serial_write_blocking(serial, &wbuf, wrlen, 0); + if (ret < 0) + return ret; + if ((size_t)ret != wrlen) + return SR_ERR_IO; + + return SR_OK; } #endif