X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Ffx2lafw.c;h=76c5019d1da3929e455699f380aa4f25e04bba63;hb=fa114e4ab1ef0d30bb3cce8f926e43d66df9f787;hp=6b184b70d8f9ff0178dca18f1aa49b3609a7dd08;hpb=eabf24035b29020085f01dd6e5a2f3c7075db23e;p=libsigrok.git diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 6b184b70..76c5019d 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -766,25 +766,22 @@ static void receive_transfer(struct libusb_transfer *transfer) */ packet.type = SR_DF_LOGIC; packet.payload = &logic; - logic.length = ctx->trigger_stage; - logic.unitsize = 1; + logic.unitsize = sizeof(*ctx->trigger_buffer); + logic.length = ctx->trigger_stage * logic.unitsize; logic.data = ctx->trigger_buffer; sr_session_send(ctx->session_dev_id, &packet); 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. */