From ad1d96f2d0771d8657da40c80eea8703111a9e80 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Mon, 7 Mar 2011 08:57:42 +0100 Subject: Specific error return codes for grabbers and cameras --- src/cameras/pco.c | 4 ++-- src/cameras/pf.c | 4 ++-- src/grabbers/me4.c | 2 +- src/uca.c | 6 +++--- src/uca.h | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cameras/pco.c b/src/cameras/pco.c index 45d0f62..ff2daff 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -202,12 +202,12 @@ uint32_t uca_pco_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber) struct pco_edge_t *pco = pco_init(); if (pco == NULL) { - return UCA_ERR_INIT_NOT_FOUND; + return UCA_ERR_CAM_NOT_FOUND; } if ((pco->serial_ref == NULL) || !pco_is_active(pco)) { pco_destroy(pco); - return UCA_ERR_INIT_NOT_FOUND; + return UCA_ERR_CAM_NOT_FOUND; } struct uca_camera_t *uca = (struct uca_camera_t *) malloc(sizeof(struct uca_camera_t)); diff --git a/src/cameras/pf.c b/src/cameras/pf.c index 76d903f..e31e882 100644 --- a/src/cameras/pf.c +++ b/src/cameras/pf.c @@ -171,10 +171,10 @@ uint32_t uca_pf_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber) { int num_ports; if (pfPortInit(&num_ports) < 0) - return UCA_ERR_INIT_NOT_FOUND; + return UCA_ERR_CAM_NOT_FOUND; if (pfDeviceOpen(0) < 0) - return UCA_ERR_INIT_NOT_FOUND; + return UCA_ERR_CAM_NOT_FOUND; /* We could check if a higher baud rate is supported, but... forget about * it. We don't need high speed configuration. */ diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c index b52b48f..4cdb14a 100644 --- a/src/grabbers/me4.c +++ b/src/grabbers/me4.c @@ -91,7 +91,7 @@ uint32_t uca_me4_init(struct uca_grabber_t **grabber) /* FIXME: find out if this board/grabber is running */ Fg_Struct *fg = Fg_Init("libFullAreaGray8.so", 0); if (fg == NULL) - return UCA_ERR_INIT_NOT_FOUND; + return UCA_ERR_GRABBER_NOT_FOUND; struct uca_grabber_t *uca = (struct uca_grabber_t *) malloc(sizeof(struct uca_grabber_t)); struct uca_me4_grabber_t *me4 = (struct uca_me4_grabber_t *) malloc(sizeof(struct uca_me4_grabber_t)); diff --git a/src/uca.c b/src/uca.c index 39b45b4..b70c25a 100644 --- a/src/uca.c +++ b/src/uca.c @@ -53,7 +53,7 @@ static struct uca_property_t property_map[UCA_PROP_LAST+1] = { { NULL, 0, 0 } }; -struct uca_t *uca_init() +struct uca_t *uca_init(void) { struct uca_t *uca = (struct uca_t *) malloc(sizeof(struct uca_t)); uca->cameras = NULL; @@ -89,7 +89,7 @@ struct uca_t *uca_init() while (grabber_inits[i] != NULL) { uca_grabber_init init = grabber_inits[i]; /* FIXME: we don't only want to take the first one */ - if (init(&grabber) != UCA_ERR_INIT_NOT_FOUND) + if (init(&grabber) != UCA_ERR_GRABBER_NOT_FOUND) break; i++; } @@ -105,7 +105,7 @@ struct uca_t *uca_init() while (cam_inits[i] != NULL) { struct uca_camera_t *cam = NULL; uca_cam_init init = cam_inits[i]; - if (init(&cam, grabber) != UCA_ERR_INIT_NOT_FOUND) { + if (init(&cam, grabber) != UCA_ERR_CAM_NOT_FOUND) { if (current == NULL) uca->cameras = current = cam; else { diff --git a/src/uca.h b/src/uca.h index c65d509..9c17b86 100644 --- a/src/uca.h +++ b/src/uca.h @@ -119,7 +119,8 @@ struct uca_property_t { enum uca_errors { UCA_NO_ERROR = 0, - UCA_ERR_INIT_NOT_FOUND, /**< camera probing or initialization failed */ + UCA_ERR_GRABBER_NOT_FOUND, + UCA_ERR_CAM_NOT_FOUND, /**< camera probing or initialization failed */ UCA_ERR_PROP_INVALID, /**< the requested property is not supported by the camera */ UCA_ERR_PROP_GENERAL, /**< error occured reading/writing the property */ UCA_ERR_PROP_VALUE_OUT_OF_RANGE, /**< error occured writing the property */ -- cgit v1.2.3