]> sigrok.org Git - libsigrok.git/blobdiff - hardware/mic-985xx/api.c
input/vcd: deprecate struct sr_rational
[libsigrok.git] / hardware / mic-985xx / api.c
index bfb942ed118fdcf49fc9eafa557592f4ab793a68..4b184e7cbdd6f3b0a43c98980f71d03f71c98c1e 100644 (file)
@@ -35,11 +35,18 @@ static const int hwcaps[] = {
        0,
 };
 
+SR_PRIV struct sr_dev_driver mic_98581_driver_info;
 SR_PRIV struct sr_dev_driver mic_98583_driver_info;
 
 SR_PRIV const struct mic_dev_info mic_devs[] = {
        {
-               "MIC", "98583", "38400/8n2", 32000, TRUE, TRUE,
+               "MIC", "98581", "38400/8n2", 32000, TRUE, FALSE, 6,
+               packet_valid_temp,
+               &mic_98581_driver_info, receive_data_MIC_98581,
+       },
+       {
+               "MIC", "98583", "38400/8n2", 32000, TRUE, TRUE, 10,
+               packet_valid_temp_hum,
                &mic_98583_driver_info, receive_data_MIC_98583,
        },
 };
@@ -122,9 +129,11 @@ static GSList *scan(const char *conn, const char *serialcomm, int idx)
                goto scan_cleanup;
        sdi->probes = g_slist_append(sdi->probes, probe);
 
-       if (!(probe = sr_probe_new(1, SR_PROBE_ANALOG, TRUE, "Humidity")))
-               goto scan_cleanup;
-       sdi->probes = g_slist_append(sdi->probes, probe);
+       if (mic_devs[idx].has_humidity) {
+               if (!(probe = sr_probe_new(1, SR_PROBE_ANALOG, TRUE, "Humidity")))
+                       goto scan_cleanup;
+               sdi->probes = g_slist_append(sdi->probes, probe);
+       }
 
        drvc->instances = g_slist_append(drvc->instances, sdi);
        devices = g_slist_append(devices, sdi);
@@ -277,27 +286,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
 
 static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 {
-       struct sr_datafeed_packet packet;
-       struct dev_context *devc;
-
-       if (sdi->status != SR_ST_ACTIVE) {
-               sr_err("Device inactive, can't stop acquisition.");
-               return SR_ERR;
-       }
-
-       devc = sdi->priv;
-
-       sr_dbg("Stopping acquisition.");
-
-       sr_source_remove(devc->serial->fd);
-       hw_dev_close((struct sr_dev_inst *)sdi);
-
-       /* Send end packet to the session bus. */
-       sr_dbg("Sending SR_DF_END.");
-       packet.type = SR_DF_END;
-       sr_session_send(cb_data, &packet);
-
-       return SR_OK;
+       return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+              ((struct dev_context *)(sdi->priv))->serial, DRIVER_LOG_DOMAIN);
 }
 
 /* Driver-specific API function wrappers */
@@ -342,4 +332,5 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
        .priv = NULL, \
 };
 
+DRV(mic_98581, MIC_98581, "mic-98581", "MIC 98581")
 DRV(mic_98583, MIC_98583, "mic-98583", "MIC 98583")