From 805919b042386043f3f2fde8c13ca276a99e088c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Espeland?= Date: Sun, 22 Apr 2012 13:05:10 +0200 Subject: [PATCH] sigma: Fix bugs in receive_data callback. - Poll data position on Sigma for every iteration. - Return TRUE when no data ready. --- hardware/asix-sigma/asix-sigma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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. */