From b655f1b1bac64bf548df9d6d9a8f0b1322171804 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Thu, 13 Aug 2015 08:12:59 +0200 Subject: Read correct sensor height depending on firmware --- uca-ufo-camera.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'uca-ufo-camera.c') diff --git a/uca-ufo-camera.c b/uca-ufo-camera.c index c55fbab..bbcb150 100644 --- a/uca-ufo-camera.c +++ b/uca-ufo-camera.c @@ -219,6 +219,8 @@ update_properties (UcaUfoCameraPrivate *priv) static gboolean setup_pcilib (UcaUfoCameraPrivate *priv) { + guint32 firmware_version; + priv->handle = pcilib_open("/dev/fpga0", "ipecamera"); if (priv->handle == NULL) { @@ -233,16 +235,20 @@ setup_pcilib (UcaUfoCameraPrivate *priv) priv->property_table = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); N_PROPERTIES = update_properties (priv); - priv->height = read_register_value (priv->handle, "cmosis_number_lines_single"); priv->frequency = read_register_value (priv->handle, "control") >> 31; /* FIXME: this is a fix to prevent wrong assumption about the bitdepth with - * the CMOSIS20000 chip. This should be removed as soon as possible. + * the CMOSIS20000 chip and the height of the sensor in pixels. This should + * be removed as soon as possible. */ - if (read_register_value (priv->handle, "firmware_version") == 6) + if (read_register_value (priv->handle, "firmware_version") == 6) { priv->n_bits = 12; - else + priv->height = read_register_value (priv->handle, "cmosis_number_lines_single"); + } + else { priv->n_bits = read_register_value (priv->handle, "adc_resolution") + 10; + priv->height = read_register_value (priv->handle, "cmosis_number_lines"); + } return TRUE; } -- cgit v1.2.3