]> sigrok.org Git - libsigrok.git/blobdiff - hardware/agilent-dmm/api.c
hw_init(): Save struct sr_context * parameter in struct drv_context
[libsigrok.git] / hardware / agilent-dmm / api.c
index c7783bca399fb7387f3f825972b3eb178c21c13b..de89422a7a4d9a4af0759037f2c120b72194cf57 100644 (file)
@@ -94,7 +94,7 @@ static int clear_instances(void)
        return SR_OK;
 }
 
-static int hw_init(void)
+static int hw_init(struct sr_context *sr_ctx)
 {
        struct drv_context *drvc;
 
@@ -103,6 +103,7 @@ static int hw_init(void)
                return SR_ERR_MALLOC;
        }
 
+       drvc->sr_ctx = sr_ctx;
        di->priv = drvc;
 
        return SR_OK;
@@ -145,7 +146,7 @@ static GSList *hw_scan(GSList *options)
        if (!(serial = sr_serial_dev_inst_new(conn, serialcomm)))
                return NULL;
 
-       if (serial_open(serial, O_RDWR|O_NONBLOCK) != SR_OK)
+       if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
                return NULL;
 
        serial_flush(serial);
@@ -218,7 +219,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
                return SR_ERR_BUG;
        }
 
-       if (serial_open(devc->serial, O_RDWR|O_NONBLOCK) != SR_OK)
+       if (serial_open(devc->serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
                return SR_ERR;
 
        sdi->status = SR_ST_ACTIVE;