From: HÃ¥vard Espeland Date: Sun, 22 Apr 2012 11:05:10 +0000 (+0200) Subject: sigma: Fix bugs in receive_data callback. X-Git-Tag: libsigrok-0.1.1~38 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=805919b042386043f3f2fde8c13ca276a99e088c;p=libsigrok.git sigma: Fix bugs in receive_data callback. - Poll data position on Sigma for every iteration. - Return TRUE when no data ready. --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 342b2a4d..f3a97364 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -1023,10 +1023,13 @@ static int receive_data(int fd, int revents, void *cb_data) (void)fd; (void)revents; + /* Get the current position. */ + sigma_read_pos(&ctx->state.stoppos, &ctx->state.triggerpos, ctx); + numchunks = (ctx->state.stoppos + 511) / 512; if (ctx->state.state == SIGMA_IDLE) - return FALSE; + return TRUE; if (ctx->state.state == SIGMA_CAPTURE) { /* Check if the timer has expired, or memory is full. */ @@ -1035,11 +1038,11 @@ static int receive_data(int fd, int revents, void *cb_data) (tv.tv_usec - ctx->start_tv.tv_usec) / 1000; if (running_msec < ctx->limit_msec && numchunks < 32767) - return FALSE; + return TRUE; /* While capturing... */ + else { hw_dev_acquisition_stop(sdi->index, sdi); - return FALSE; } else if (ctx->state.state == SIGMA_DOWNLOAD) { if (ctx->state.chunks_downloaded >= numchunks) { /* End of samples. */