]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/conrad-digi-35-cpu/api.c
Add sr_dev_acquisition_stop(), factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / conrad-digi-35-cpu / api.c
index 44f9f26646fa7683eecd063fe646dff14c60b326..022e53304a2b5cdcb0cbf689d4f62bf53128bbcb 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file
- *  <em>Conrad DIGI 35 CPU</em> power supply driver
- *  @internal
+/**
+ * @file
+ *
+ * <em>Conrad DIGI 35 CPU</em> power supply driver
+ *
+ * @internal
  */
 
 #include <config.h>
@@ -42,14 +45,11 @@ static const uint32_t devopts[] = {
 static GSList *scan(struct sr_dev_driver *di, GSList *options)
 {
        struct sr_dev_inst *sdi;
-       struct drv_context *drvc;
        struct sr_config *src;
        struct sr_serial_dev_inst *serial;
-       GSList *l, *devices;
+       GSList *l;
        const char *conn, *serialcomm;
 
-       devices = NULL;
-       drvc = di->context;
        conn = serialcomm = NULL;
 
        for (l = options; l; l = l->next) {
@@ -90,12 +90,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        sdi->model = g_strdup("DIGI 35 CPU");
        sdi->conn = serial;
        sdi->priv = NULL;
-       sdi->driver = di;
        sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
-       drvc->instances = g_slist_append(drvc->instances, sdi);
-       devices = g_slist_append(devices, sdi);
 
-       return devices;
+       return std_scan_complete(di, g_slist_append(NULL, sdi));
 }
 
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
@@ -174,8 +171,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 
 static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
+       (void)sdi;
 
        return SR_OK;
 }