summaryrefslogtreecommitdiffstats
path: root/ipecamera
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-04-14 05:18:18 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-04-14 05:18:18 +0200
commitd7143e0f1ff45449f5e69adc1a42c72eddf642d8 (patch)
treeef7b4d90c487527963e9dbe70a5b218530b4932d /ipecamera
parentb70ed8b6ccf17a7c5b4339f05a33471eaf3b33e5 (diff)
downloadpcitool-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.tar.gz
pcitool-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.tar.bz2
pcitool-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.tar.xz
pcitool-d7143e0f1ff45449f5e69adc1a42c72eddf642d8.zip
Accept timeout parameter to get_next_event call
Diffstat (limited to 'ipecamera')
-rw-r--r--ipecamera/image.c9
-rw-r--r--ipecamera/image.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/ipecamera/image.c b/ipecamera/image.c
index 3e320cd..5d2021c 100644
--- a/ipecamera/image.c
+++ b/ipecamera/image.c
@@ -532,7 +532,7 @@ static int ipecamera_resolve_event_id(ipecamera_t *ctx, pcilib_event_id_t evid)
return buf_ptr;
}
-pcilib_event_id_t ipecamera_next_event(void *vctx, pcilib_event_t event_mask) {
+pcilib_event_id_t ipecamera_next_event(void *vctx, pcilib_event_t event_mask, const struct timespec *timeout) {
int buf_ptr;
pcilib_event_id_t reported;
ipecamera_t *ctx = (ipecamera_t*)vctx;
@@ -547,7 +547,12 @@ pcilib_event_id_t ipecamera_next_event(void *vctx, pcilib_event_t event_mask) {
return PCILIB_EVENT_ID_INVALID;
}
- if ((!ctx->event_id)||(ctx->reported_id == ctx->event_id)) return PCILIB_EVENT_ID_INVALID;
+ if ((!ctx->event_id)||(ctx->reported_id == ctx->event_id)) {
+ if (timeout) {
+ // We should wait here for the specified timeout
+ }
+ return PCILIB_EVENT_ID_INVALID;
+ }
// We had an overflow in event counting
if (ctx->reported_id > ctx->event_id) {
diff --git a/ipecamera/image.h b/ipecamera/image.h
index 513449f..245e450 100644
--- a/ipecamera/image.h
+++ b/ipecamera/image.h
@@ -13,7 +13,7 @@ int ipecamera_reset(void *ctx);
int ipecamera_start(void *ctx, pcilib_event_t event_mask, pcilib_callback_t cb, void *user);
int ipecamera_stop(void *ctx);
int ipecamera_trigger(void *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data);
-pcilib_event_id_t ipecamera_next_event(void *ctx, pcilib_event_t event_mask);
+pcilib_event_id_t ipecamera_next_event(void *ctx, pcilib_event_t event_mask, const struct timespec *timeout);
void* ipecamera_get(void *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t arg_size, void *arg, size_t *size);
int ipecamera_return(void *ctx, pcilib_event_id_t event_id);