X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fscpi-pps%2Fprotocol.c;h=a27089f52a7981f1b936ee2c46599abede38dd3e;hb=da005885c8ebbf98772f75126764f758b2640d11;hp=86ec387693a4d3b58072643a752dd6b60526116d;hpb=c1d56d20131a0f34d819721f7fd9c4952482557f;p=libsigrok.git diff --git a/src/hardware/scpi-pps/protocol.c b/src/hardware/scpi-pps/protocol.c index 86ec3876..a27089f5 100644 --- a/src/hardware/scpi-pps/protocol.c +++ b/src/hardware/scpi-pps/protocol.c @@ -18,14 +18,15 @@ */ #include +#include #include #include "protocol.h" -SR_PRIV char *scpi_cmd_get(const struct sr_dev_inst *sdi, int command) +SR_PRIV const char *scpi_cmd_get(const struct sr_dev_inst *sdi, int command) { struct dev_context *devc; unsigned int i; - char *cmd; + const char *cmd; devc = sdi->priv; cmd = NULL; @@ -44,7 +45,7 @@ SR_PRIV int scpi_cmd(const struct sr_dev_inst *sdi, int command, ...) struct sr_scpi_dev_inst *scpi; va_list args; int ret; - char *cmd; + const char *cmd; if (!(cmd = scpi_cmd_get(sdi, command))) { /* Device does not implement this command, that's OK. */ @@ -66,7 +67,8 @@ SR_PRIV int scpi_cmd_resp(const struct sr_dev_inst *sdi, GVariant **gvar, va_list args; double d; int ret; - char *cmd, *s; + char *s; + const char *cmd; if (!(cmd = scpi_cmd_get(sdi, command))) { /* Device does not implement this command, that's OK. */ @@ -147,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; @@ -225,6 +227,8 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data) pch = devc->cur_channel->priv; if (pch->mq == SR_MQ_VOLTAGE) cmd = SCPI_CMD_GET_MEAS_VOLTAGE; + else if (pch->mq == SR_MQ_FREQUENCY) + cmd = SCPI_CMD_GET_MEAS_FREQUENCY; else if (pch->mq == SR_MQ_CURRENT) cmd = SCPI_CMD_GET_MEAS_CURRENT; else if (pch->mq == SR_MQ_POWER)