X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fagilent-dmm%2Fapi.c;h=82e4378326bc426cdeff102acd6f0f00d69b0db7;hb=f9197887e447bb7536e25f3cb24d175d97cd20bb;hp=6c41023de91aa31f258807a34c8a250c210b79e8;hpb=4f840ce965b1c30c5ab75afecc56193cbaf5c1b3;p=libsigrok.git
diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c
index 6c41023d..82e43783 100644
--- a/src/hardware/agilent-dmm/api.c
+++ b/src/hardware/agilent-dmm/api.c
@@ -17,13 +17,13 @@
* along with this program. If not, see .
*/
+#include
#include
#include
#include
#include
#include
-#include
-#include "libsigrok.h"
+#include
#include "libsigrok-internal.h"
#include "agilent-dmm.h"
@@ -89,7 +89,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn, *serialcomm;
char *buf, **tokens;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
@@ -122,10 +122,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
}
len = 128;
- if (!(buf = g_try_malloc(len))) {
- sr_err("Serial buffer malloc failed.");
- return NULL;
- }
+ buf = g_malloc(len);
serial_readline(serial, &buf, &len, 250);
if (!len)
return NULL;
@@ -166,7 +163,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
@@ -192,18 +189,10 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
switch (key) {
case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
- if (g_variant_get_uint64(data) == 0) {
- sr_err("LIMIT_MSEC can't be 0.");
- return SR_ERR;
- }
devc->limit_msec = g_variant_get_uint64(data);
- sr_dbg("Setting time limit to %" PRIu64 "ms.",
- devc->limit_msec);
break;
case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = g_variant_get_uint64(data);
- sr_dbg("Setting sample limit to %" PRIu64 ".",
- devc->limit_samples);
break;
default:
return SR_ERR_NA;
@@ -286,5 +275,5 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};