From 0f41a2e0c38d66dc6af89d3a59a573b9a38f7ceb Mon Sep 17 00:00:00 2001
From: "Suren A. Chilingaryan" <csa@suren.me>
Date: Tue, 28 Jan 2014 00:33:20 +0100
Subject: Support new revision of UFO cameras...

---
 ipecamera/ipecamera.c | 12 +++++++++---
 ipecamera/private.h   |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

(limited to 'ipecamera')

diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c
index 1b8752e..54df33f 100644
--- a/ipecamera/ipecamera.c
+++ b/ipecamera/ipecamera.c
@@ -284,11 +284,17 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev
 	return PCILIB_ERROR_INVALID_REQUEST;
     }
 
+
 	// Allow readout and clean the FRAME_REQUEST mode if set for some reason
-    SET_REG(control_reg, IPECAMERA_IDLE|IPECAMERA_READOUT_FLAG);
+    GET_REG(control_reg, value);
+    SET_REG(control_reg, value|IPECAMERA_READOUT_FLAG);
     usleep(IPECAMERA_SLEEP_TIME);
-    CHECK_STATUS_REG();
-    if (err) return err;
+    if (value&0x1000) ctx->fr_mode = 1;
+    else {
+	ctx->fr_mode = 0;
+	CHECK_STATUS_REG();
+	if (err) return err;
+    }
 
     ctx->event_id = 0;
     ctx->preproc_id = 0;
diff --git a/ipecamera/private.h b/ipecamera/private.h
index 739aa97..47c80a9 100644
--- a/ipecamera/private.h
+++ b/ipecamera/private.h
@@ -123,6 +123,7 @@ struct ipecamera_s {
     
     size_t max_frames;		/**< Maximal number of frames what may be buffered in camera DDR memory */
     int firmware;		/**< Firmware version */
+    int fr_mode;		/**< Fast Reject mode */
     int cmosis_outputs;		/**< Number of active cmosis outputs: 4 or 16 */
     int width, height;
 
-- 
cgit v1.2.3