From bc12e0ea13336a8da2d2d7637675c104591d8ae0 Mon Sep 17 00:00:00 2001 From: yair Date: Sun, 16 Nov 2025 05:21:09 +0200 Subject: [PATCH] Fix property getters to query hardware state instead of cached values - PROP_AUTO_EXPOSURE now queries hardware using IS_GET_ENABLE_AUTO_SHUTTER - PROP_AUTO_GAIN now queries hardware using IS_GET_ENABLE_AUTO_GAIN - PROP_GAIN_BOOST now queries hardware using IS_GET_GAINBOOST This ensures each camera reports its actual hardware state rather than a shared cached value when properties are queried via camera_control.py --- sys/idsueye/gstidsueyesrc.c | 51 ++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/sys/idsueye/gstidsueyesrc.c b/sys/idsueye/gstidsueyesrc.c index e9b43c9..9c92cc2 100644 --- a/sys/idsueye/gstidsueyesrc.c +++ b/sys/idsueye/gstidsueyesrc.c @@ -343,13 +343,58 @@ gst_idsueyesrc_get_property (GObject * object, guint property_id, g_value_set_int (value, src->gain); break; case PROP_AUTO_EXPOSURE: - g_value_set_boolean (value, src->auto_exposure); + if (src->is_started && src->hCam) { + double enable = 0.0; + INT ret = is_SetAutoParameter (src->hCam, IS_GET_ENABLE_AUTO_SHUTTER, + &enable, NULL); + if (ret == IS_SUCCESS) { + gboolean actual_state = (enable != 0.0); + /* Update cached value to match hardware state */ + src->auto_exposure = actual_state; + g_value_set_boolean (value, actual_state); + } else { + GST_WARNING_OBJECT (src, "Failed to query auto exposure state (error %d), returning cached value", + ret); + g_value_set_boolean (value, src->auto_exposure); + } + } else { + g_value_set_boolean (value, src->auto_exposure); + } break; case PROP_AUTO_GAIN: - g_value_set_boolean (value, src->auto_gain); + if (src->is_started && src->hCam) { + double enable = 0.0; + INT ret = is_SetAutoParameter (src->hCam, IS_GET_ENABLE_AUTO_GAIN, + &enable, NULL); + if (ret == IS_SUCCESS) { + gboolean actual_state = (enable != 0.0); + /* Update cached value to match hardware state */ + src->auto_gain = actual_state; + g_value_set_boolean (value, actual_state); + } else { + GST_WARNING_OBJECT (src, "Failed to query auto gain state (error %d), returning cached value", + ret); + g_value_set_boolean (value, src->auto_gain); + } + } else { + g_value_set_boolean (value, src->auto_gain); + } break; case PROP_GAIN_BOOST: - g_value_set_boolean (value, src->gain_boost); + if (src->is_started && src->hCam) { + INT ret = is_SetGainBoost (src->hCam, IS_GET_GAINBOOST); + if (ret != IS_INVALID_PARAMETER) { + gboolean actual_state = (ret == IS_SET_GAINBOOST_ON); + /* Update cached value to match hardware state */ + src->gain_boost = actual_state; + g_value_set_boolean (value, actual_state); + } else { + GST_WARNING_OBJECT (src, "Failed to query gain boost state, returning cached value"); + g_value_set_boolean (value, src->gain_boost); + } + } else { + g_value_set_boolean (value, src->gain_boost); + } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);