X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbrymen-dmm%2Fapi.c;h=aef784e8ca314396e6ac7b08fc2291f5a069c58a;hb=289eebd7ca9f1229fe7e9d318c4895069ed82d6e;hp=44c9286d1227247521636c36617a6f0cab73c2d8;hpb=a0e0bb4149081eda06714f1158639f2dadcfa9d8;p=libsigrok.git diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index 44c9286d..aef784e8 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -26,9 +26,9 @@ static const uint32_t scanopts[] = { 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; @@ -51,10 +51,9 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm) 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); @@ -75,23 +74,17 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm) 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);