]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: Read position only in CAPTURE state
authorMarek Vasut <redacted>
Sun, 20 Apr 2014 17:57:02 +0000 (19:57 +0200)
committerBert Vermeulen <redacted>
Wed, 30 Apr 2014 16:45:51 +0000 (09:45 -0700)
Check the position of ForceStop and Trigger events only in case we
are in CAPTURE state, it's useless to do this unconditionally when
receive_data() is called.

Signed-off-by: Marek Vasut <redacted>
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. */