]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/agilent-dmm/api.c
Build: Set local include directories in Makefile.am
[libsigrok.git] / src / hardware / agilent-dmm / api.c
index 19a4144cca2aed4ea75df880087be1767ae7ace6..273c7f06c5290a8db26929398c811cc7fc75286a 100644 (file)
@@ -22,8 +22,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <string.h>
-#include <errno.h>
-#include "libsigrok.h"
+#include <libsigrok/libsigrok.h>
 #include "libsigrok-internal.h"
 #include "agilent-dmm.h"
 
@@ -89,7 +88,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        const char *conn, *serialcomm;
        char *buf, **tokens;
 
-       drvc = di->priv;
+       drvc = di->context;
        drvc->instances = NULL;
 
        devices = NULL;
@@ -122,10 +121,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        }
 
        len = 128;
-       if (!(buf = g_try_malloc(len))) {
-               sr_err("Serial buffer malloc failed.");
-               return NULL;
-       }
+       buf = g_malloc(len);
        serial_readline(serial, &buf, &len, 250);
        if (!len)
                return NULL;
@@ -166,7 +162,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
 static GSList *dev_list(const struct sr_dev_driver *di)
 {
-       return ((struct drv_context *)(di->priv))->instances;
+       return ((struct drv_context *)(di->context))->instances;
 }
 
 static int cleanup(const struct sr_dev_driver *di)
@@ -278,5 +274,5 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
        .dev_close = std_serial_dev_close,
        .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = dev_acquisition_stop,
-       .priv = NULL,
+       .context = NULL,
 };