X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fnexus-osciprime%2Fapi.c;h=238cda515867bd5ee5d278e53e4c78493acc0b0f;hb=542dbd185b2e01e61df8a70a2ab850f5cfe03271;hp=c1de7b7762c0dc9d0bfb86fa1770205b872ba70f;hpb=c8733a2bbb876496e3c6eb9e95084d9d5fb7e834;p=libsigrok.git diff --git a/hardware/nexus-osciprime/api.c b/hardware/nexus-osciprime/api.c index c1de7b77..238cda51 100644 --- a/hardware/nexus-osciprime/api.c +++ b/hardware/nexus-osciprime/api.c @@ -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 }, @@ -223,7 +223,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi) { /* TODO */ - (void)sdi; + sdi->status = SR_ST_ACTIVE; return SR_OK; } @@ -232,7 +232,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi) { /* TODO */ - (void)sdi; + sdi->status = SR_ST_INACTIVE; return SR_OK; } @@ -253,17 +253,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 +268,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 +283,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; }