X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmic-985xx%2Fapi.c;h=510dbb819e7dd2a6d2003b6e314317a02aba4aa7;hb=bee2b0168c087676c1b365861d8c2d4714afa9b9;hp=329a14b6da8335109fdc89291169d44587512aef;hpb=dd5c48a6d567a3cac62c4b0058588273bbeea171;p=libsigrok.git diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index 329a14b6..510dbb81 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -60,18 +60,14 @@ SR_PRIV const struct mic_dev_info mic_devs[] = { static GSList *mic_scan(const char *conn, const char *serialcomm, int idx) { struct sr_dev_inst *sdi; - struct drv_context *drvc; struct dev_context *devc; struct sr_serial_dev_inst *serial; - GSList *devices; serial = sr_serial_dev_inst_new(conn, serialcomm); if (serial_open(serial, SERIAL_RDWR) != SR_OK) return NULL; - drvc = mic_devs[idx].di->context; - devices = NULL; serial_flush(serial); /* TODO: Query device type. */ @@ -89,19 +85,15 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx) sdi->inst_type = SR_INST_SERIAL; sdi->conn = serial; sdi->priv = devc; - sdi->driver = mic_devs[idx].di; sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "Temperature"); if (mic_devs[idx].has_humidity) sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "Humidity"); - drvc->instances = g_slist_append(drvc->instances, sdi); - devices = g_slist_append(devices, sdi); - serial_close(serial); - return devices; + return std_scan_complete(mic_devs[idx].di, g_slist_append(NULL, sdi)); } static GSList *scan(GSList *options, int idx) @@ -193,7 +185,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) devc = sdi->priv; sr_sw_limits_acquisition_start(&devc->limits); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; @@ -206,7 +198,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close, - sdi->conn, LOG_PREFIX); + sdi->conn); } /* Driver-specific API function wrappers */