X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fcolead-slm%2Fapi.c;h=34bebd8e6484227438d1996c80222fc1fdaebdbb;hb=cc8be68f22b05fd00649b8c38854e37cd4805f57;hp=d299693f95b49be54694c2c8bc7958b47bdd8d79;hpb=a0e0bb4149081eda06714f1158639f2dadcfa9d8;p=libsigrok.git diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index d299693f..34bebd8e 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -37,9 +37,9 @@ static const uint32_t scanopts[] = { static const uint32_t devopts[] = { SR_CONF_SOUNDLEVELMETER, - SR_CONF_LIMIT_SAMPLES, - SR_CONF_LIMIT_MSEC, SR_CONF_CONTINUOUS, + SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, + SR_CONF_LIMIT_MSEC | SR_CONF_SET, }; SR_PRIV struct sr_dev_driver colead_slm_driver_info; @@ -82,23 +82,16 @@ static GSList *scan(GSList *options) if (!serialcomm) serialcomm = SERIALCOMM; - if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Colead", - "SL-5868P", NULL))) - return NULL; - - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_dbg("Device context malloc failed."); - return NULL; - } - - if (!(sdi->conn = sr_serial_dev_inst_new(conn, serialcomm))) - return NULL; - + sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->vendor = g_strdup("Colead"); + sdi->model = g_strdup("SL-5868P"); + devc = g_malloc0(sizeof(struct dev_context)); + sdi->conn = sr_serial_dev_inst_new(conn, serialcomm); sdi->inst_type = SR_INST_SERIAL; sdi->priv = devc; sdi->driver = di; - if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1"))) - return NULL; + 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);