]> sigrok.org Git - libsigrok.git/blobdiff - hardware/nexus-osciprime/api.c
Drop some lines that are no longer needed.
[libsigrok.git] / hardware / nexus-osciprime / api.c
index c1de7b7762c0dc9d0bfb86fa1770205b872ba70f..35bf27423af92cc047ffede3ff6691cc20c56021 100644 (file)
@@ -42,7 +42,7 @@ static const int32_t hwcaps[] = {
        SR_CONF_VDIV,
 };
 
-static const struct sr_rational timebases[] = {
+static const uint64_t timebases[][2] = {
        /* 24 MHz */
        { 42, 1e9 },
        /* 12 MHz */
@@ -94,7 +94,7 @@ static const char *probe_names[] = {
        NULL,
 };
 
-static const struct sr_rational vdivs[] = {
+static const uint64_t vdivs[][2] = {
        { 1, 1 },
        { 2, 1 },
        { 5, 2 },
@@ -137,7 +137,7 @@ static int clear_instances(void)
 
 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)
@@ -153,13 +153,8 @@ static GSList *hw_scan(GSList *options)
        int i;
        const char *conn;
 
-       (void)options;
-
        drvc = di->priv;
 
-       /* USB scan is always authoritative. */
-       clear_instances();
-
        conn = NULL;
        for (l = options; l; l = l->next) {
                src = l->data;
@@ -223,7 +218,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
 {
 
        /* TODO */
-       (void)sdi;
+       sdi->status = SR_ST_ACTIVE;
 
        return SR_OK;
 }
@@ -232,7 +227,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
 {
 
        /* TODO */
-       (void)sdi;
+    sdi->status = SR_ST_INACTIVE;
 
        return SR_OK;
 }
@@ -253,17 +248,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        /* TODO */
        (void)data;
 
-       if (sdi->status != SR_ST_ACTIVE) {
-               sr_err("Device inactive, can't set config options.");
-               return SR_ERR;
-       }
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
 
        ret = SR_OK;
        switch (id) {
 
        default:
-               sr_err("Unknown hardware capability: %d.", id);
-               ret = SR_ERR_ARG;
+               ret = SR_ERR_NA;
        }
 
        return ret;
@@ -271,12 +263,12 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
 
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
 {
-
        (void)sdi;
+       (void)data;
 
        switch (key) {
        default:
-               return SR_ERR_ARG;
+               return SR_ERR_NA;
        }
 
        return SR_OK;
@@ -286,9 +278,11 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                                    void *cb_data)
 {
        /* TODO */
-       (void)sdi;
        (void)cb_data;
 
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
+
        return SR_OK;
 }