]> sigrok.org Git - libsigrok.git/blobdiff - hardware/agilent-dmm/api.c
Consistently use 'cg' for channel group variables.
[libsigrok.git] / hardware / agilent-dmm / api.c
index d4c9427d49b95b89ac515e8446abfde55e35f375..8c1f3b4a85da97b2ba686978a56f4e89892c6c8c 100644 (file)
@@ -61,11 +61,6 @@ static const struct agdmm_profile supported_agdmm[] = {
 SR_PRIV struct sr_dev_driver agdmm_driver_info;
 static struct sr_dev_driver *di = &agdmm_driver_info;
 
-static int dev_clear(void)
-{
-       return std_dev_clear(di, NULL);
-}
-
 static int init(struct sr_context *sr_ctx)
 {
        return std_init(sr_ctx, di, LOG_PREFIX);
@@ -133,7 +128,7 @@ static GSList *scan(GSList *options)
                for (i = 0; supported_agdmm[i].model; i++) {
                        if (strcmp(supported_agdmm[i].modelname, tokens[1]))
                                continue;
-                       if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, tokens[0],
+                       if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Agilent",
                                        tokens[1], tokens[3])))
                                return NULL;
                        if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
@@ -169,43 +164,17 @@ static GSList *dev_list(void)
        return ((struct drv_context *)(di->priv))->instances;
 }
 
-static int dev_open(struct sr_dev_inst *sdi)
-{
-       struct sr_serial_dev_inst *serial;
-
-       serial = sdi->conn;
-       if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
-               return SR_ERR;
-
-       sdi->status = SR_ST_ACTIVE;
-
-       return SR_OK;
-}
-
-static int dev_close(struct sr_dev_inst *sdi)
-{
-       struct sr_serial_dev_inst *serial;
-
-       serial = sdi->conn;
-       if (serial && serial->fd != -1) {
-               serial_close(serial);
-               sdi->status = SR_ST_INACTIVE;
-       }
-
-       return SR_OK;
-}
-
 static int cleanup(void)
 {
-       return dev_clear();
+       return std_dev_clear(di, NULL);
 }
 
 static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
-       (void)probe_group;
+       (void)cg;
 
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
@@ -239,10 +208,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
 }
 
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        (void)sdi;
-       (void)probe_group;
+       (void)cg;
 
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
@@ -287,7 +256,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 
 static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 {
-       return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
+       return std_serial_dev_acquisition_stop(sdi, cb_data, std_serial_dev_close,
                        sdi->conn, LOG_PREFIX);
 }
 
@@ -299,12 +268,12 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
        .cleanup = cleanup,
        .scan = scan,
        .dev_list = dev_list,
-       .dev_clear = dev_clear,
+       .dev_clear = NULL,
        .config_get = NULL,
        .config_set = config_set,
        .config_list = config_list,
-       .dev_open = dev_open,
-       .dev_close = dev_close,
+       .dev_open = std_serial_dev_open,
+       .dev_close = std_serial_dev_close,
        .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = dev_acquisition_stop,
        .priv = NULL,