]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/api.c
hantek-dso: capturestate packet also contains the trigger point
[libsigrok.git] / hardware / hantek-dso / api.c
index 1091ea9008c6956ae816239f2f102d588b733be3..e6b87f85eaae6a6d84ca8dfcf6ee4cb17d992df3 100644 (file)
@@ -628,7 +628,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;
@@ -654,12 +655,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) {