X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmotech-lps-30x%2Fapi.c;h=b29346ca1cbcab166b6e37d6210ed08b11bec310;hb=204dd31fa1074a78fbe3bf04208776a4a3615a1c;hp=af3ee4f0aecbe504943b9aafb215c6ddc3395769;hpb=e4924d752b3a2e08d0ab90b0eb872c569c4c68c9;p=libsigrok.git diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index af3ee4f0..b29346ca 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -363,13 +363,12 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o sdi = NULL; devc = NULL; - conn = serialcomm = NULL; /* Process and check options. */ + conn = NULL; + serialcomm = SERIALCOMM; if (sr_serial_extract_options(options, &conn, &serialcomm) != SR_OK) return NULL; - if (!serialcomm) - serialcomm = SERIALCOMM; /* Init serial port. */ serial = sr_serial_dev_inst_new(conn, serialcomm); @@ -378,7 +377,6 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o goto exit_err; /* Query and verify model string. */ - serial_flush(serial); if (lps_cmd_reply(buf, serial, "MODEL") != SR_OK) return NULL; @@ -440,13 +438,9 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o devc->channel_status[cnt].info = g_slist_append(NULL, ch); - cg = g_malloc(sizeof(struct sr_channel_group)); - snprintf(channel, sizeof(channel), "CG%d", cnt+1); - cg->name = g_strdup(channel); - cg->priv = NULL; + snprintf(channel, sizeof(channel), "CG%d", cnt + 1); + cg = sr_channel_group_new(sdi, channel, NULL); cg->channels = g_slist_append(NULL, ch); - - sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); } /* Query status */