]> sigrok.org Git - libsigrok.git/blobdiff - hardware/chronovu-la8/api.c
Enforce open device before config_set()/dev_acquisition_start()
[libsigrok.git] / hardware / chronovu-la8 / api.c
index 08e06c32afe717823493a3b5e2b309f8a5b7de9f..6e5fd5b695638dfc3699516d9e1a43baa87717dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
  *
  * Copyright (C) 2011-2012 Uwe Hermann <uwe@hermann-uwe.de>
  *
@@ -308,6 +308,9 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
+
        if (!(devc = sdi->priv)) {
                sr_err("%s: sdi->priv was NULL.", __func__);
                return SR_ERR_BUG;
@@ -433,6 +436,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        uint8_t buf[4];
        int bytes_written;
 
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
+
        if (!(devc = sdi->priv)) {
                sr_err("%s: sdi->priv was NULL.", __func__);
                return SR_ERR_BUG;