]> sigrok.org Git - libsigrok.git/blobdiff - hardware/fluke-dmm/api.c
hw_init(): Save struct sr_context * parameter in struct drv_context
[libsigrok.git] / hardware / fluke-dmm / api.c
index 2d476419307ff79cab7a62691e84930fd1606821..154479ccc25c039c67154bf7883f31562b7c023a 100644 (file)
@@ -81,7 +81,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;
 
@@ -90,6 +90,7 @@ static int hw_init(void)
                return SR_ERR_MALLOC;
        }
 
+       drvc->sr_ctx = sr_ctx;
        di->priv = drvc;
 
        return SR_OK;
@@ -109,7 +110,7 @@ static GSList *fluke_scan(const char *conn, const char *serialcomm)
        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;
 
        drvc = di->priv;
@@ -230,7 +231,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;