]> sigrok.org Git - libsigrok.git/blobdiff - hardware/tondaj-sl-814/api.c
zeroplus: Properly set inst_type to SR_INST_USB.
[libsigrok.git] / hardware / tondaj-sl-814 / api.c
index 78d61eb64434cde8a67d5ede96db9b2844b6d6b8..41e9d95c957b41d3e0b2b71a38588593858eb230 100644 (file)
@@ -40,37 +40,14 @@ static const int32_t hwcaps[] = {
 SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info;
 static struct sr_dev_driver *di = &tondaj_sl_814_driver_info;
 
-/* Properly close and free all devices. */
 static int clear_instances(void)
 {
-       struct sr_dev_inst *sdi;
-       struct drv_context *drvc;
-       struct dev_context *devc;
-       struct sr_serial_dev_inst *serial;
-       GSList *l;
-
-       if (!(drvc = di->priv))
-               return SR_OK;
-
-       for (l = drvc->instances; l; l = l->next) {
-               if (!(sdi = l->data))
-                       continue;
-               if (!(devc = sdi->priv))
-                       continue;
-               serial = sdi->conn;
-               sr_serial_dev_inst_free(serial);
-               sr_dev_inst_free(sdi);
-       }
-
-       g_slist_free(drvc->instances);
-       drvc->instances = NULL;
-
-       return SR_OK;
+       return std_dev_clear(di, NULL);
 }
 
 static int hw_init(struct sr_context *sr_ctx)
 {
-       return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN);
+       return std_hw_init(sr_ctx, di, LOG_PREFIX);
 }
 
 static GSList *hw_scan(GSList *options)
@@ -179,9 +156,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
 
 static int hw_cleanup(void)
 {
-       clear_instances();
-
-       return SR_OK;
+       return clear_instances();
 }
 
 static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
@@ -240,7 +215,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        devc->cb_data = cb_data;
 
        /* Send header packet to the session bus. */
-       std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
+       std_session_send_df_header(cb_data, LOG_PREFIX);
 
        /* Poll every 500ms, or whenever some data comes in. */
        serial = sdi->conn;
@@ -253,7 +228,7 @@ 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)
 {
        return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
-                                                 sdi->conn, DRIVER_LOG_DOMAIN);
+                                                 sdi->conn, LOG_PREFIX);
 }
 
 SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {