diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2013-04-17 18:41:35 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2013-04-17 18:41:35 +0200 |
commit | fda2d65fa7e38f0e30101bce657685a8c637cb13 (patch) | |
tree | d5c599cdd160bacb6ed2ca320278046d25baf286 | |
parent | b2bead6a5fd74b4543c7bb9278558ff485c22995 (diff) | |
parent | 821a945eafaf63963d56c9bdef773760bea9a41d (diff) | |
download | ipecamera-fda2d65fa7e38f0e30101bce657685a8c637cb13.tar.gz ipecamera-fda2d65fa7e38f0e30101bce657685a8c637cb13.tar.bz2 ipecamera-fda2d65fa7e38f0e30101bce657685a8c637cb13.tar.xz ipecamera-fda2d65fa7e38f0e30101bce657685a8c637cb13.zip |
Merge important fixes for operation under LibUCA control
-rw-r--r-- | ipecamera/events.c | 6 | ||||
-rw-r--r-- | ipecamera/ipecamera.c | 6 | ||||
-rwxr-xr-x | tests/grabhw.sh | 20 |
3 files changed, 28 insertions, 4 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/ipecamera/ipecamera.c b/ipecamera/ipecamera.c index 27bea77..4ba0e9e 100644 --- a/ipecamera/ipecamera.c +++ b/ipecamera/ipecamera.c @@ -575,7 +575,11 @@ int ipecamera_stop(pcilib_context_t *vctx, pcilib_event_flags_t flags) { pcilib_stop_dma(vctx->pcilib, ctx->rdma, PCILIB_DMA_FLAGS_DEFAULT); ctx->rdma = PCILIB_DMA_ENGINE_INVALID; } - + + while (ctx->streaming) { + usleep(IPECAMERA_NOFRAME_SLEEP); + } + if (ctx->ipedec) { ufo_decoder_free(ctx->ipedec); ctx->ipedec = NULL; 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 |