]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi.c
scpi: Make helper functions from scpi-pps available library-wide.
[libsigrok.git] / src / scpi / scpi.c
index ce3cb99d2362be792549d8e1970a76ebb1b35f57..8cf62ad4e06710e1069101a987e211a528411111 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "libsigrok.h"
-#include "libsigrok-internal.h"
-
 #include <glib.h>
 #include <string.h>
+#include <libsigrok/libsigrok.h>
+#include "libsigrok-internal.h"
+#include "scpi.h"
 
 #define LOG_PREFIX "scpi"
 
 #define SCPI_READ_RETRIES 100
-#define SCPI_READ_RETRY_TIMEOUT 10000
+#define SCPI_READ_RETRY_TIMEOUT_US (10 * 1000)
 
 /**
  * Parse a string representation of a boolean-like value into a gboolean.
@@ -578,7 +578,7 @@ SR_PRIV int sr_scpi_get_opc(struct sr_scpi_dev_inst *scpi)
                sr_scpi_get_bool(scpi, SCPI_CMD_OPC, &opc);
                if (opc)
                        return SR_OK;
-               g_usleep(SCPI_READ_RETRY_TIMEOUT);
+               g_usleep(SCPI_READ_RETRY_TIMEOUT_US);
        }
 
        return SR_ERR;
@@ -736,7 +736,7 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
 
        for (num_tokens = 0; tokens[num_tokens] != NULL; num_tokens++);
 
-       if (num_tokens != 4) {
+       if (num_tokens < 4) {
                sr_dbg("IDN response not according to spec: %80.s.", response);
                g_strfreev(tokens);
                g_free(response);