X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fnexus-osciprime%2Fapi.c;h=f28069860c25ad74663e3ac5feb5f14678ca51f2;hb=refs%2Ftags%2Fdsupstream;hp=48b361a003ae677db979aafbdfa687bcdb29aeb7;hpb=bd6fbf628abef9fab5293e016ad11e1a1ac4a0a9;p=libsigrok.git diff --git a/hardware/nexus-osciprime/api.c b/hardware/nexus-osciprime/api.c index 48b361a0..f2806986 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 }, @@ -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) @@ -157,9 +157,6 @@ static GSList *hw_scan(GSList *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 +220,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi) { /* TODO */ - (void)sdi; + sdi->status = SR_ST_ACTIVE; return SR_OK; } @@ -232,7 +229,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi) { /* TODO */ - (void)sdi; + sdi->status = SR_ST_INACTIVE; return SR_OK; } @@ -253,10 +250,8 @@ 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) { @@ -285,9 +280,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; }