X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffluke-dmm%2Fapi.c;h=f533f1c5df7d7a2731f187b28779efea7c709944;hb=f6ce25ec05e8707ee3783b111ea13779f237c3b3;hp=75b0954de5a2716c5104e140078cb5768e7e676e;hpb=c3cd66a00cdb4afbd43108563d979eebfbafaf69;p=libsigrok.git diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index 75b0954d..f533f1c5 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -32,8 +32,11 @@ static const uint32_t scanopts[] = { SR_CONF_SERIALCOMM, }; -static const uint32_t devopts[] = { +static const uint32_t drvopts[] = { SR_CONF_MULTIMETER, +}; + +static const uint32_t devopts[] = { SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_SET, @@ -87,7 +90,7 @@ static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn, /* Response is first a CMD_ACK byte (ASCII '0' for OK, * or '1' to signify an error. */ - len = 128; + len = sizeof(buf); serial_readline(serial, &b, &len, 150); if (len != 1) continue; @@ -95,7 +98,7 @@ static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn, continue; /* If CMD_ACK was OK, ID string follows. */ - len = 128; + len = sizeof(buf); serial_readline(serial, &b, &len, 850); if (len < 10) continue; @@ -179,8 +182,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return devices; } -static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_set(uint32_t key, GVariant *data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -191,26 +194,10 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return sr_sw_limits_config_set(&devc->limits, key, data); } -static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_list(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { - (void)sdi; - (void)cg; - - switch (key) { - case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); - break; - case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); - break; - default: - return SR_ERR_NA; - } - - return SR_OK; + return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); } static int dev_acquisition_start(const struct sr_dev_inst *sdi) @@ -223,7 +210,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, fluke_receive_data, (void *)sdi); @@ -246,7 +232,7 @@ static struct sr_dev_driver flukedmm_driver_info = { .cleanup = std_cleanup, .scan = scan, .dev_list = std_dev_list, - .dev_clear = NULL, + .dev_clear = std_dev_clear, .config_get = NULL, .config_set = config_set, .config_list = config_list,