]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ipdbg-la/api.c
ipdbg-la: Consistently use g_strerror().
[libsigrok.git] / src / hardware / ipdbg-la / api.c
index 62d0616e35077fdc95a31aacedbca821d2c0235b..599960938c7b41fa998893379ceca14b137d8dc4 100644 (file)
@@ -97,11 +97,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                return NULL;
 
        struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst));
-       if (!sdi) {
-               sr_err("no possible to allocate sr_dev_inst");
-               return NULL;
-       }
-
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup("ipdbg.org");
        sdi->model = g_strdup("IPDBG LA");
@@ -158,8 +153,6 @@ static int dev_clear(const struct sr_dev_driver *di)
 
 static int dev_open(struct sr_dev_inst *sdi)
 {
-       sdi->status = SR_ST_INACTIVE;
-
        struct ipdbg_la_tcp *tcp = sdi->conn;
 
        if (!tcp)
@@ -168,21 +161,18 @@ static int dev_open(struct sr_dev_inst *sdi)
        if (ipdbg_la_tcp_open(tcp) != SR_OK)
                return SR_ERR;
 
-       sdi->status = SR_ST_ACTIVE;
-
        return SR_OK;
 }
 
 static int dev_close(struct sr_dev_inst *sdi)
 {
-       // Should be called before a new call to scan()
+       /* Should be called before a new call to scan(). */
        struct ipdbg_la_tcp *tcp = sdi->conn;
 
        if (tcp)
                ipdbg_la_tcp_close(tcp);
 
        sdi->conn = NULL;
-       sdi->status = SR_ST_INACTIVE;
 
        return SR_OK;
 }
@@ -215,9 +205,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_CAPTURE_RATIO:
                devc->capture_ratio = g_variant_get_uint64(data);
@@ -261,9 +248,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
 
 static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        struct ipdbg_la_tcp *tcp = sdi->conn;
        struct dev_context *devc = sdi->priv;