X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fnorma-dmm%2Fapi.c;h=d155bc36d657b3b24f5f0817ae81caf5caa9e8b2;hb=0759e2f55b5e45ff283f396c38c08eb180ba83b7;hp=29cdbccdb92d2a37baf9aaa7842a418747a5536d;hpb=f778bf02eaf0d7fa7ccb91a0da8a68233f1fb79a;p=libsigrok.git
diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c
index 29cdbccd..d155bc36 100644
--- a/src/hardware/norma-dmm/api.c
+++ b/src/hardware/norma-dmm/api.c
@@ -17,11 +17,6 @@
* along with this program. If not, see .
*/
-/** @file
- * Norma DM9x0/Siemens B102x DMMs driver.
- * @internal
- */
-
#include
#include "protocol.h"
@@ -30,8 +25,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,
@@ -112,6 +110,7 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
if (serial_write_blocking(serial, req, strlen(req),
serial_timeout(serial, strlen(req))) < 0) {
sr_err("Unable to send identification request.");
+ g_free(buf);
return NULL;
}
len = BUF_MAX;
@@ -161,8 +160,8 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
return std_scan_complete(drv, 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;
@@ -173,26 +172,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)
@@ -205,7 +188,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, 100,
norma_dmm_receive_data, (void *)sdi);