]> sigrok.org Git - libsigrok.git/blobdiff - hardware/fluke-dmm/api.c
config.h usage cleanups.
[libsigrok.git] / hardware / fluke-dmm / api.c
index b81ea4206c5738926310bfc957d358903670f055..d6c322accdc9416a0ccc3e214d5d8dc31cc7ec48 100644 (file)
@@ -20,7 +20,6 @@
 #include <glib.h>
 #include "libsigrok.h"
 #include "libsigrok-internal.h"
-#include "config.h"
 #include "fluke-dmm.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -51,8 +50,8 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info;
 static struct sr_dev_driver *di = &flukedmm_driver_info;
 
 static const struct flukedmm_profile supported_flukedmm[] = {
-       { FLUKE_187, "187" },
-       { FLUKE_287, "287" },
+       { FLUKE_187, "187", 100 },
+       { FLUKE_287, "287", 100 },
 };
 
 
@@ -114,7 +113,7 @@ static int serial_readline(int fd, char **buf, int *buflen, uint64_t timeout_ms)
                if (len > 0) {
                        *buflen += len;
                        *(*buf + *buflen) = '\0';
-                       if (*buflen > 0 && *(*buf + *buflen - 1) == '\n') {
+                       if (*buflen > 0 && *(*buf + *buflen - 1) == '\r') {
                                /* Strip LF and terminate. */
                                *(*buf + --*buflen) = '\0';
                                break;
@@ -404,7 +403,14 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        sr_session_send(devc->cb_data, &packet);
 
        /* Poll every 100ms, or whenever some data comes in. */
-       sr_source_add(devc->serial->fd, G_IO_IN, 100, fluke_receive_data, (void *)sdi);
+       sr_source_add(devc->serial->fd, G_IO_IN, 50, fluke_receive_data, (void *)sdi);
+
+       if (serial_write(devc->serial->fd, "QM\r", 3) == -1) {
+               sr_err("fluke-dmm: unable to send QM: %s", strerror(errno));
+               return SR_ERR;
+       }
+       devc->cmd_sent_at = g_get_monotonic_time() / 1000;
+       devc->expect_response = TRUE;
 
        return SR_OK;
 }