]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: don't fail acquisition start for devices with no CMD_SELECT_CHANNEL
authorAurelien Jacobs <redacted>
Sat, 9 May 2015 21:06:10 +0000 (23:06 +0200)
committerAurelien Jacobs <redacted>
Sat, 9 May 2015 21:06:10 +0000 (23:06 +0200)
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
src/hardware/scpi-pps/protocol.c

index d4aa4923ff71f06941e049fab2e110d2a98e6313..cf6bc65b6f0d25fbbd8dd0e13e5d4a611f3c3507 100644 (file)
@@ -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;
index 26ff82163a744aa205a6573005971dee8bd10583..a27089f52a7981f1b936ee2c46599abede38dd3e 100644 (file)
@@ -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;