]> sigrok.org Git - libsigrok.git/blobdiff - hardware/asix-sigma/asix-sigma.c
asix-sigma: Read position only in CAPTURE state
[libsigrok.git] / hardware / asix-sigma / asix-sigma.c
index 986070278206ee3aaa434035adb5160c118f8f05..4d8f2383b6381caa44cb03a7f756d0e2c6705cc6 100644 (file)
@@ -1136,13 +1136,14 @@ static int receive_data(int fd, int revents, void *cb_data)
        sdi = cb_data;
        devc = sdi->priv;
 
-       /* Get the current position. */
-       sigma_read_pos(&devc->state.stoppos, &devc->state.triggerpos, devc);
-
        if (devc->state.state == SIGMA_IDLE)
                return TRUE;
 
        if (devc->state.state == SIGMA_CAPTURE) {
+               /* Get the current position. */
+               sigma_read_pos(&devc->state.stoppos, &devc->state.triggerpos,
+                              devc);
+
                numchunks = (devc->state.stoppos + 511) / 512;
 
                /* Check if the timer has expired, or memory is full. */