From c1603f4574c8ce9648b51ea587b99cfb0bb02420 Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Sat, 9 May 2015 23:06:10 +0200 Subject: [PATCH] scpi-pps: don't fail acquisition start for devices with no CMD_SELECT_CHANNEL For devices such as the HP 6632B the following invocation was failing due to scpi_cmd(sdi, SCPI_CMD_SELECT_CHANNEL, ...) returning SR_OK_CONTINUE. ./sigrok-cli -d scpi-pps:conn=/dev/ttyUSB0:serialcomm=9600/8n1 --continuous sr: session: sr_session_start: could not start an acquisition (not enough data to decide error status yet) Failed to start session. --- src/hardware/scpi-pps/api.c | 2 +- src/hardware/scpi-pps/protocol.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index d4aa4923..cf6bc65b 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -560,7 +560,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, /* Prime the pipe with the first channel's fetch. */ ch = next_enabled_channel(sdi, NULL); pch = ch->priv; - if ((ret = select_channel(sdi, ch)) != SR_OK) + if ((ret = select_channel(sdi, ch)) < 0) return ret; if (pch->mq == SR_MQ_VOLTAGE) cmd = SCPI_CMD_GET_MEAS_VOLTAGE; diff --git a/src/hardware/scpi-pps/protocol.c b/src/hardware/scpi-pps/protocol.c index 26ff8216..a27089f5 100644 --- a/src/hardware/scpi-pps/protocol.c +++ b/src/hardware/scpi-pps/protocol.c @@ -149,7 +149,7 @@ SR_PRIV int select_channel(const struct sr_dev_inst *sdi, struct sr_channel *ch) } } - if ((ret = scpi_cmd(sdi, SCPI_CMD_SELECT_CHANNEL, new_pch->hwname)) == SR_OK) + if ((ret = scpi_cmd(sdi, SCPI_CMD_SELECT_CHANNEL, new_pch->hwname)) >= 0) devc->cur_channel = ch; return ret;