X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhantek-6xxx%2Fapi.c;h=e4e20e0a84da803a6adc9cc22cfcaa8add5e66a6;hb=f670835f1fbc03525e995d6970a5495976ab7c1a;hp=c05290be6e9ab460b36813740c13b22a62b8e1c2;hpb=364b09c2a936fd7e98a879c3532fcd2fee4c1e0a;p=libsigrok.git diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index c05290be..e4e20e0a 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -52,7 +52,7 @@ static const char *channel_names[] = { }; static const char *dc_coupling[] = { - "DC", "DC", + "DC", }; static const char *acdc_coupling[] = { @@ -88,8 +88,6 @@ static const uint64_t vdivs[][2] = { static int read_channel(const struct sr_dev_inst *sdi, uint32_t amount); -static int dev_acquisition_stop(struct sr_dev_inst *sdi); - static struct sr_dev_inst *hantek_6xxx_dev_new(const struct hantek_6xxx_profile *prof) { struct sr_dev_inst *sdi; @@ -385,7 +383,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s *data = g_variant_new("(tt)", vdiv[0], vdiv[1]); break; case SR_CONF_COUPLING: - *data = g_variant_new_string(devc->coupling_vals[devc->coupling[ch_idx]]); + *data = g_variant_new_string((devc->coupling[ch_idx] \ + == COUPLING_DC) ? "DC" : "AC"); break; } } @@ -708,7 +707,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) PRIu64 " <= %" PRIu64, devc->limit_samples, devc->samp_received); send_data(sdi, devc->sample_buf, devc->limit_samples); - sdi->driver->dev_acquisition_stop(sdi); + sr_dev_acquisition_stop(sdi); } else if (devc->limit_msec && (g_get_monotonic_time() - devc->aq_started) / 1000 >= devc->limit_msec) { sr_info("Requested time limit reached, stopping. %d <= %d", @@ -717,7 +716,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) send_data(sdi, devc->sample_buf, devc->samp_received); g_free(devc->sample_buf); devc->sample_buf = NULL; - sdi->driver->dev_acquisition_stop(sdi); + sr_dev_acquisition_stop(sdi); } else { read_channel(sdi, data_amount(sdi)); } @@ -785,9 +784,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) struct sr_dev_driver *di = sdi->driver; struct drv_context *drvc = di->context; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - devc = sdi->priv; if (configure_channels(sdi) != SR_OK) { @@ -817,13 +813,11 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct dev_context *devc; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR; - devc = sdi->priv; devc->dev_state = STOPPING; - g_free(devc->sample_buf); devc->sample_buf = NULL; + g_free(devc->sample_buf); + devc->sample_buf = NULL; return SR_OK; }