* @internal
*/
+#include <config.h>
#include "protocol.h"
static const uint32_t scanopts[] = {
SR_PRIV struct sr_dev_driver norma_dmm_driver_info;
SR_PRIV struct sr_dev_driver siemens_b102x_driver_info;
-static const char* get_brandstr(struct sr_dev_driver* drv)
+static const char *get_brandstr(struct sr_dev_driver *drv)
{
if (drv == &norma_dmm_driver_info)
return "Norma";
return "Siemens";
}
-static const char* get_typestr(int type, struct sr_dev_driver* drv)
+static const char *get_typestr(int type, struct sr_dev_driver *drv)
{
- static const char* nameref[5][2] = {
+ static const char *nameref[5][2] = {
{"DM910", "B1024"},
{"DM920", "B1025"},
{"DM930", "B1026"},
return std_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *scan(struct sr_dev_driver* drv, GSList *options)
+static GSList *scan(struct sr_dev_driver *drv, GSList *options)
{
struct sr_dev_inst *sdi;
struct drv_context *drvc;
int auxtype;
devices = NULL;
- drvc = drv->priv;
+ drvc = drv->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
serial_flush(serial);
- if (!(buf = g_try_malloc(BUF_MAX))) {
- sr_err("Serial buffer malloc failed.");
- return NULL;
- }
+ buf = g_malloc(BUF_MAX);
snprintf(req, sizeof(req), "%s\r\n",
nmadmm_requests[NMADMM_REQ_IDN].req_str);
g_usleep(150 * 1000); /* Wait a little to allow serial port to settle. */
for (cnt = 0; cnt < 7; cnt++) {
- if (serial_write_blocking(serial, req, strlen(req), 0) < 0) {
+ if (serial_write_blocking(serial, req, strlen(req),
+ serial_timeout(serial, strlen(req))) < 0) {
sr_err("Unable to send identification request.");
return NULL;
}
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 dev_close(struct sr_dev_inst *sdi)
switch (key) {
case SR_CONF_LIMIT_MSEC:
- 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;
return SR_OK;
}
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
-
SR_PRIV struct sr_dev_driver siemens_b102x_driver_info = {
.name = "siemens-b102x",
.longname = "Siemens B102x DMMs",
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};