X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fhardware%2Fpipistrello-ols%2Fapi.c;h=5995cdf87f69cb21ccd1f81a56883f64f15bf2f0;hb=6402c379161ec138e451901c411817a55846a75b;hp=91c7dc2f17a11c3a22b8e3e3ad258c69e2b11d2c;hpb=15a5bfe4815f9991a9bb532c05d6244a1818a0e4;p=libsigrok.git diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index 91c7dc2f..5995cdf8 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -113,7 +113,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (p_ols_open(devc) != SR_OK) { goto err_free_ftdic; } - + /* The discovery procedure is like this: first send the Reset * command (0x00) 5 times, since the device could be anywhere * in a 5-byte command. Then send the ID command (0x02). @@ -257,9 +257,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd (void)cg; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - devc = sdi->priv; switch (key) { @@ -414,32 +411,23 @@ static int dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; - if (p_ols_open(devc) != SR_OK) { + if (p_ols_open(devc) != SR_OK) return SR_ERR; - } else { - sdi->status = SR_ST_ACTIVE; - return SR_OK; - } + + sdi->status = SR_ST_ACTIVE; + + return SR_OK; } static int dev_close(struct sr_dev_inst *sdi) { - int ret; struct dev_context *devc; - ret = SR_OK; devc = sdi->priv; - if (sdi->status == SR_ST_ACTIVE) { - sr_dbg("Status ACTIVE, closing device."); - ret = p_ols_close(devc); - } else { - sr_spew("Status not ACTIVE, nothing to do."); - } - sdi->status = SR_ST_INACTIVE; - return ret; + return p_ols_close(devc); } static int set_trigger(const struct sr_dev_inst *sdi, int stage) @@ -523,9 +511,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) int num_pols_changrp, samplespercount; int ret, i; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - devc = sdi->priv; pols_channel_mask(sdi); @@ -642,8 +627,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_dbg("flag_reg = %x", devc->flag_reg); /* - * In demux mode the OLS is processing two 8-bit or 16-bit samples - * in parallel and for this to work the lower two bits of the four + * In demux mode the OLS is processing two 8-bit or 16-bit samples + * in parallel and for this to work the lower two bits of the four * "channel_disable" bits must be replicated to the upper two bits. */ flag_tmp = devc->flag_reg; @@ -667,7 +652,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->cnt_bytes = devc->cnt_samples = devc->cnt_samples_rle = 0; memset(devc->sample, 0, 4); - std_session_send_df_header(sdi, LOG_PREFIX); + std_session_send_df_header(sdi); /* Hook up a dummy handler to receive data from the device. */ sr_session_source_add(sdi->session, -1, 0, 10, p_ols_receive_data, @@ -682,7 +667,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) devc = sdi->priv; - sr_dbg("Stopping acquisition."); write_shortcommand(devc, CMD_RESET); write_shortcommand(devc, CMD_RESET); write_shortcommand(devc, CMD_RESET); @@ -691,7 +675,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) sr_session_source_remove(sdi->session, -1); - std_session_send_df_end(sdi, LOG_PREFIX); + std_session_send_df_end(sdi); return SR_OK; }