summaryrefslogtreecommitdiffstats
path: root/src/cameras/ipe.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-11 15:56:10 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-11 15:56:10 +0100
commitfcd098454e67f027f9a305da41952f11717df2d4 (patch)
treef5c0671610405f692684ebf69b6f8a1b2d5cc6be /src/cameras/ipe.c
parentc8dcb293921903a2f97a2022ebc77565da792b48 (diff)
downloaduca-fcd098454e67f027f9a305da41952f11717df2d4.tar.gz
uca-fcd098454e67f027f9a305da41952f11717df2d4.tar.bz2
uca-fcd098454e67f027f9a305da41952f11717df2d4.tar.xz
uca-fcd098454e67f027f9a305da41952f11717df2d4.zip
Read first property from IPE camera
Diffstat (limited to 'src/cameras/ipe.c')
-rw-r--r--src/cameras/ipe.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c
index 78aae01..89f4e9a 100644
--- a/src/cameras/ipe.c
+++ b/src/cameras/ipe.c
@@ -6,13 +6,8 @@
#include "uca-cam.h"
#include "uca-grabber.h"
-struct ipe_desc_t {
- pcilib_t *handle;
- pcilib_model_t model;
-};
-
#define set_void(p, type, value) { *((type *) p) = value; }
-#define GET_IPE_DESC(cam) ((struct ipe_desc_t *) cam->user)
+#define GET_HANDLE(cam) ((pcilib_t *) cam->user)
static void uca_ipe_handle_error(const char *format, ...)
{
@@ -26,11 +21,19 @@ static uint32_t uca_ipe_set_property(struct uca_camera_t *cam, enum uca_property
static uint32_t uca_ipe_get_property(struct uca_camera_t *cam, enum uca_property_ids property, void *data)
{
+ pcilib_t *handle = GET_HANDLE(cam);
+ pcilib_register_value_t value = 0;
+
switch (property) {
case UCA_PROP_NAME:
strcpy((char *) data, "IPE PCIe");
break;
+ case UCA_PROP_TEMPERATURE_SENSOR:
+ pcilib_read_register(handle, NULL, "cmosis_temperature", &value);
+ set_void(data, uint32_t, (uint32_t) value);
+ break;
+
default:
return UCA_ERR_PROP_INVALID;
}
@@ -54,9 +57,7 @@ static uint32_t uca_ipe_grab(struct uca_camera_t *cam, char *buffer)
static uint32_t uca_ipe_destroy(struct uca_camera_t *cam)
{
- struct ipe_desc_t *ipe_desc = GET_IPE_DESC(cam);
- pcilib_close(ipe_desc->handle);
- free(ipe_desc);
+ pcilib_close(GET_HANDLE(cam));
return UCA_NO_ERROR;
}
@@ -68,10 +69,6 @@ uint32_t uca_ipe_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber)
if (handle < 0)
return UCA_ERR_CAM_NOT_FOUND;
- struct ipe_desc_t *ipe_desc = (struct ipe_desc_t *) malloc(sizeof(struct ipe_desc_t));
- ipe_desc->handle = handle;
- ipe_desc->model = model;
-
pcilib_set_error_handler(&uca_ipe_handle_error);
model = pcilib_get_model(handle);
@@ -86,7 +83,7 @@ uint32_t uca_ipe_init(struct uca_camera_t **cam, struct uca_grabber_t *grabber)
uca->grab = &uca_ipe_grab;
uca->state = UCA_CAM_CONFIGURABLE;
- uca->user = ipe_desc;
+ uca->user = handle;
*cam = uca;
return UCA_NO_ERROR;