X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fmotech-lps-30x%2Fprotocol.c;h=b31f2ee1d33ad83bcf48f33e8881a32f55290f4b;hb=1ed93110c3c31233dfce10ed6e67e21ecfcdae7d;hp=867cbb45197fca719b7c5d553548e9fc19446d81;hpb=d2f7c417fdd96a13d8fd86350d2fc13db16f626c;p=libsigrok.git
diff --git a/src/hardware/motech-lps-30x/protocol.c b/src/hardware/motech-lps-30x/protocol.c
index 867cbb45..b31f2ee1 100644
--- a/src/hardware/motech-lps-30x/protocol.c
+++ b/src/hardware/motech-lps-30x/protocol.c
@@ -18,14 +18,6 @@
* along with this program. If not, see .
*/
-/**
- * @file
- *
- * Motech LPS-30x series power supply driver
- *
- * @internal
- */
-
#include
#include
#include
@@ -84,6 +76,8 @@ static void process_line(struct sr_dev_inst *sdi)
int auxint;
devc = sdi->priv;
+ if (!devc)
+ return;
switch (devc->acq_req_pending) {
case 0: /* Should not happen... */
@@ -95,13 +89,15 @@ static void process_line(struct sr_dev_inst *sdi)
case AQ_U2:
case AQ_I1:
case AQ_I2:
- if (sr_atod(devc->buf, &dbl) != SR_OK) {
+ dbl = 0.0;
+ if (sr_atod_ascii(devc->buf, &dbl) != SR_OK) {
sr_err("Failed to convert '%s' to double, errno=%d %s",
devc->buf, errno, g_strerror(errno));
dbl = 0.0;
}
break;
case AQ_STATUS:
+ auxint = 0;
if (sr_atoi(devc->buf, &auxint) != SR_OK) {
sr_err("Failed to convert '%s' to int, errno=%d %s",
devc->buf, errno, g_strerror(errno));