]> sigrok.org Git - libsigrok.git/blobdiff - hardware/fx2lafw/fx2lafw.c
sr: fx2lafw: Fix multistage trigger
[libsigrok.git] / hardware / fx2lafw / fx2lafw.c
index 6b184b70d8f9ff0178dca18f1aa49b3609a7dd08..afdd95019b8bad440c1127038d90a18037dfbb5e 100644 (file)
@@ -774,17 +774,14 @@ static void receive_transfer(struct libusb_transfer *transfer)
                                        ctx->trigger_stage = TRIGGER_FIRED;
                                        break;
                                }
-                               return;
-                       }
-
-                       /*
-                        * We had a match before, but not in the next sample. However, we may
-                        * have a match on this stage in the next bit -- trigger on 0001 will
-                        * fail on seeing 00001, so we need to go back to stage 0 -- but at
-                        * the next sample from the one that matched originally, which the
-                        * counter increment at the end of the loop takes care of.
-                        */
-                       if (ctx->trigger_stage > 0) {
+                       } else if (ctx->trigger_stage > 0) {
+                               /*
+                                * We had a match before, but not in the next sample. However, we may
+                                * have a match on this stage in the next bit -- trigger on 0001 will
+                                * fail on seeing 00001, so we need to go back to stage 0 -- but at
+                                * the next sample from the one that matched originally, which the
+                                * counter increment at the end of the loop takes care of.
+                                */
                                i -= ctx->trigger_stage;
                                if (i < -1)
                                        i = -1; /* Oops, went back past this buffer. */