X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ftondaj-sl-814%2Fapi.c;h=bc6fa18e1bbd1987e8eee7ef01d33594d7935709;hb=bcbf2b5953328142d99ef15bbd76cd703317f512;hp=d14f0e6edb0b100e2210fdc591ffa4c607f4c6b6;hpb=e66d1892d0dd16ed166fc8f13493f95de0607362;p=libsigrok.git diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index d14f0e6e..bc6fa18e 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -31,8 +31,11 @@ static const uint32_t scanopts[] = { SR_CONF_SERIALCOMM, }; -static const uint32_t devopts[] = { +static const uint32_t drvopts[] = { SR_CONF_SOUNDLEVELMETER, +}; + +static const uint32_t devopts[] = { SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_SET, @@ -79,8 +82,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) serial = sr_serial_dev_inst_new(conn, serialcomm); - if (serial_open(serial, SERIAL_RDWR) != SR_OK) + if (serial_open(serial, SERIAL_RDWR) != SR_OK) { + g_free(sdi); return NULL; + } sdi->inst_type = SR_INST_SERIAL; sdi->conn = serial; @@ -91,8 +96,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return std_scan_complete(di, g_slist_append(NULL, sdi)); } -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; @@ -103,10 +108,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) { - return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, NULL, devopts); + return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); } static int dev_acquisition_start(const struct sr_dev_inst *sdi) @@ -118,7 +123,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); - /* Poll every 500ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 500, tondaj_sl_814_receive_data, (void *)sdi);