static const uint32_t devopts[] = {
SR_CONF_MULTIMETER,
- SR_CONF_LIMIT_SAMPLES,
SR_CONF_CONTINUOUS,
- SR_CONF_LIMIT_MSEC,
+ SR_CONF_LIMIT_SAMPLES | SR_CONF_SET,
+ SR_CONF_LIMIT_MSEC | SR_CONF_SET,
};
SR_PRIV struct sr_dev_driver brymen_bm857_driver_info;
uint8_t buf[128];
size_t len;
- if (!(serial = sr_serial_dev_inst_new(conn, serialcomm)))
- return NULL;
+ serial = sr_serial_dev_inst_new(conn, serialcomm);
- if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
+ if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL;
sr_info("Probing port %s.", conn);
sr_info("Found device on port %s.", conn);
- if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Brymen", "BM85x", NULL)))
- goto scan_cleanup;
-
- if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
- sr_err("Device context malloc failed.");
- goto scan_cleanup;
- }
-
+ sdi = g_malloc0(sizeof(struct sr_dev_inst));
+ sdi->status = SR_ST_INACTIVE;
+ sdi->vendor = g_strdup("Brymen");
+ sdi->model = g_strdup("BM85x");
+ devc = g_malloc0(sizeof(struct dev_context));
sdi->inst_type = SR_INST_SERIAL;
sdi->conn = serial;
drvc = di->priv;
sdi->priv = devc;
sdi->driver = di;
-
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- goto scan_cleanup;
-
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);