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 <[email protected]>
---
 hardware/asix-sigma/asix-sigma.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c
index 9860702..4d8f238 100644
--- a/hardware/asix-sigma/asix-sigma.c
+++ b/hardware/asix-sigma/asix-sigma.c
@@ -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. */
-- 
1.8.5.3


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to