X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Frigol-ds1xx2%2Fapi.c;h=4eeacececfcf1675294929b4d2bc7b4ae8ee0bf3;hb=035a1078fda93cf1da37d19b3a1d95311b99b00f;hp=93f1fc2a4cf0f81b54bd03802f9210ca183402ec;hpb=1953564a96798bc298d1c94eb90c129adbde1c9e;p=libsigrok.git diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index 93f1fc2a..4eeacece 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -138,6 +138,7 @@ static int clear_instances(void) continue; g_free(devc->device); + g_slist_free(devc->enabled_probes); close(devc->fd); sr_dev_inst_free(sdi); @@ -323,12 +324,11 @@ static int hw_cleanup(void) return SR_OK; } -static int hw_info_get(int info_id, const void **data, - const struct sr_dev_inst *sdi) +static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) { (void)sdi; - switch (info_id) { + switch (id) { case SR_DI_HWCAPS: *data = hwcaps; break; @@ -351,8 +351,7 @@ static int hw_info_get(int info_id, const void **data, return SR_OK; } -static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, - const void *value) +static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) { struct dev_context *devc; uint64_t tmp_u64; @@ -369,7 +368,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, } ret = SR_OK; - switch (hwcap) { + switch (id) { case SR_CONF_LIMIT_FRAMES: devc->limit_frames = *(const uint64_t *)value; break; @@ -432,7 +431,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, ret = SR_ERR_ARG; break; default: - sr_err("Unknown hardware capability: %d.", hwcap); + sr_err("Unknown hardware capability: %d.", id); ret = SR_ERR_ARG; break; } @@ -464,6 +463,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, gettimeofday(&header.starttime, NULL); sr_session_send(cb_data, &packet); + /* Hardcoded to CH1 only. */ + devc->enabled_probes = g_slist_append(NULL, sdi->probes->data); rigol_ds1xx2_send_data(devc->fd, ":CHAN1:SCAL?\n"); len = read(devc->fd, buf, sizeof(buf)); buf[len] = 0; @@ -506,10 +507,10 @@ SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info = { .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, .dev_open = hw_dev_open, .dev_close = hw_dev_close, - .info_get = hw_info_get, - .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, .priv = NULL,