X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fhantek-dso%2Fapi.c;h=c9310336173bd6e625352355cf4a374ab939b7f5;hb=9edfee3ee31bc6cd7657392f2c9ac28ccf7a7dce;hp=c571caf89ee92d258886ea547b8d703654fa023f;hpb=c5841b28092ad9366cef5d512ddb10d6a34c9c0a;p=libsigrok.git diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index c571caf8..c9310336 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include "sigrok.h" @@ -574,7 +573,8 @@ static void receive_transfer(struct libusb_transfer *transfer) packet.payload = &analog; /* TODO: support for 5xxx series 9-bit samples */ analog.num_samples = transfer->actual_length / 2; - analog.unit = SR_UNIT_VOLTAGE; + analog.mq = SR_MQ_VOLTAGE; + analog.unit = SR_UNIT_VOLT; analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes); data_offset = 0; for (i = 0; i < analog.num_samples; i++) { @@ -629,7 +629,8 @@ static int handle_event(int fd, int revents, void *cb_data) struct sr_datafeed_packet packet; struct timeval tv; struct context *ctx; - int capturestate; + uint32_t trigger_offset; + uint8_t capturestate; /* Avoid compiler warnings. */ (void)fd; @@ -655,12 +656,11 @@ static int handle_event(int fd, int revents, void *cb_data) if (ctx->dev_state != CAPTURE) return TRUE; - if ((capturestate = dso_get_capturestate(ctx)) == CAPTURE_UNKNOWN) { - /* Generated by the function, not the hardware. */ + if ((dso_get_capturestate(ctx, &capturestate, &trigger_offset)) != SR_OK) return TRUE; - } sr_dbg("hantek-dso: capturestate %d", capturestate); + sr_dbg("hantek-dso: trigger offset 0x%.6x", trigger_offset); switch (capturestate) { case CAPTURE_EMPTY: if (++ctx->capture_empty_count >= MAX_CAPTURE_EMPTY) {