diff options
-rw-r--r-- | ipecamera/events.c | 6 | ||||
-rwxr-xr-x | tests/grabhw.sh | 20 |
2 files changed, 23 insertions, 3 deletions
diff --git a/ipecamera/events.c b/ipecamera/events.c index 58c29a1..3253fc5 100644 --- a/ipecamera/events.c +++ b/ipecamera/events.c @@ -139,7 +139,7 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili } retry: - if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1) - IPECAMERA_RESERVE_BUFFERS; + if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1 - IPECAMERA_RESERVE_BUFFERS); else ++ctx->reported_id; if (evid) *evid = ctx->reported_id; @@ -152,9 +152,9 @@ retry: else return PCILIB_ERROR_INVALID_ARGUMENT; } - + if ((ctx->event_id - ctx->reported_id) >= ctx->buffer_size) goto retry; - + return 0; } diff --git a/tests/grabhw.sh b/tests/grabhw.sh new file mode 100755 index 0000000..0279ab4 --- /dev/null +++ b/tests/grabhw.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +function enable_hw_trigger { + usleep 100000 + pci -w control 0xa01 +} + +rm -f images.raw + +enable_hw_trigger & +pid=$! + +echo "Starting the grabber" +pci -g -o images.raw --run-time 60000000 --verbose 10 -o /dev/null +wait $pid |