X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fagilent-dmm%2Fapi.c;h=ccc2f65cd5ccaaa893c42e0f507aa6d531b0ed3d;hb=a153d6b8fffa6e1e1a88c8d52bee0aec86add91e;hp=a58e57c32e2a983d30653ae1761975c5d51b4bf1;hpb=d43b090816f61e77d8054084e85202de1a1ebeb7;p=libsigrok.git diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index a58e57c3..ccc2f65c 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -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); @@ -77,7 +72,7 @@ static GSList *scan(GSList *options) struct drv_context *drvc; struct dev_context *devc; struct sr_config *src; - struct sr_probe *probe; + struct sr_channel *ch; struct sr_serial_dev_inst *serial; GSList *l, *devices; int len, i; @@ -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)))) { @@ -146,9 +141,9 @@ static GSList *scan(GSList *options) sdi->conn = serial; sdi->priv = devc; sdi->driver = di; - if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "P1"))) + if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1"))) return NULL; - sdi->probes = g_slist_append(sdi->probes, probe); + sdi->channels = g_slist_append(sdi->channels, ch); drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); break; @@ -169,30 +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 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; @@ -226,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: @@ -286,11 +268,11 @@ 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_open = std_serial_dev_open, .dev_close = std_serial_dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop,