]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/protocol.c
scpi-pps: Add infrastructure for controlling output frequency
[libsigrok.git] / src / hardware / scpi-pps / protocol.c
index 86ec387693a4d3b58072643a752dd6b60526116d..26ff82163a744aa205a6573005971dee8bd10583 100644 (file)
  */
 
 #include <string.h>
+#include <strings.h>
 #include <stdarg.h>
 #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. */
@@ -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)