From c6d58023d20e4e7a7c4a52294f3fdf17738f76c9 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 20 Sep 2011 12:27:00 +0200 Subject: Add: signal handler for SIGINT With `grab`, libuca wasn't closed down properly when pressing C-c which is the only "normal" way to stop it. --- test/grab.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/grab.c b/test/grab.c index f7a7548..005365d 100644 --- a/test/grab.c +++ b/test/grab.c @@ -1,15 +1,27 @@ #include #include +#include #include "uca.h" #define handle_error(errno) {if ((errno) != UCA_NO_ERROR) printf("error at <%s:%i>\n", \ __FILE__, __LINE__);} +static struct uca *u = NULL; + +void sigint_handler(int signal) +{ + printf("Closing down libuca\n"); + handle_error(uca_cam_stop_recording(u->cameras)); + uca_destroy(u); + exit(signal); +} int main(int argc, char *argv[]) { - struct uca *u = uca_init(NULL); + (void) signal(SIGINT, sigint_handler); + + u = uca_init(NULL); if (u == NULL) { printf("Couldn't find a camera\n"); return 1; -- cgit v1.2.3 From cb66db4b221e516153763735f1994206aa20abe4 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 27 Sep 2011 16:28:10 +0200 Subject: Add: set exposure time for IPE camera --- src/cameras/ipe.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c index c398350..78d2c98 100644 --- a/src/cameras/ipe.c +++ b/src/cameras/ipe.c @@ -16,6 +16,17 @@ static void uca_ipe_handle_error(const char *format, ...) static uint32_t uca_ipe_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data) { + pcilib_t *handle = GET_HANDLE(cam); + pcilib_register_value_t value = *((pcilib_register_value_t *) data); + + switch (property) { + case UCA_PROP_EXPOSURE: + pcilib_write_register(handle, NULL, "exp_time", value); + break; + + default: + return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID; + } return UCA_NO_ERROR; } -- cgit v1.2.3