[gnome-color-manager] huey: the HUEY does not support measuring projectors



commit 54d238390a529fad642f3ef193e3c59e45f6140e
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jul 19 17:06:47 2010 +0100

    huey: the HUEY does not support measuring projectors

 libcolor-glib/gcm-sensor-huey.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libcolor-glib/gcm-sensor-huey.c b/libcolor-glib/gcm-sensor-huey.c
index 0614dc5..9325d14 100644
--- a/libcolor-glib/gcm-sensor-huey.c
+++ b/libcolor-glib/gcm-sensor-huey.c
@@ -554,6 +554,14 @@ gcm_sensor_huey_get_ambient (GcmSensor *sensor, gdouble *value, GError **error)
 	guchar request[] = { HUEY_COMMAND_GET_AMBIENT, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 	GcmSensorHuey *sensor_huey = GCM_SENSOR_HUEY (sensor);
 
+	/* no hardware support */
+	if (gcm_sensor_get_output_type (sensor) == GCM_SENSOR_OUTPUT_TYPE_PROJECTOR) {
+		g_set_error_literal (error, GCM_SENSOR_ERROR,
+				     GCM_SENSOR_ERROR_NO_SUPPORT,
+				     "HUEY cannot measure ambient light in projector mode");
+		goto out;
+	}
+
 	/* ensure the user set this */
 	output_type = gcm_sensor_get_output_type (sensor);
 	if (output_type == GCM_SENSOR_OUTPUT_TYPE_UNKNOWN) {
@@ -662,7 +670,7 @@ out:
 static gboolean
 gcm_sensor_huey_sample (GcmSensor *sensor, GcmColorXYZ *value, GError **error)
 {
-	gboolean ret;
+	gboolean ret = FALSE;
 	gdouble precision_value;
 	GcmColorRGB native;
 	GcmSensorHueyMultiplier multiplier;
@@ -670,6 +678,14 @@ gcm_sensor_huey_sample (GcmSensor *sensor, GcmColorXYZ *value, GError **error)
 	GcmVec3 *output = (GcmVec3 *) value;
 	GcmSensorHuey *sensor_huey = GCM_SENSOR_HUEY (sensor);
 
+	/* no hardware support */
+	if (gcm_sensor_get_output_type (sensor) == GCM_SENSOR_OUTPUT_TYPE_PROJECTOR) {
+		g_set_error_literal (error, GCM_SENSOR_ERROR,
+				     GCM_SENSOR_ERROR_NO_SUPPORT,
+				     "HUEY cannot measure ambient light in projector mode");
+		goto out;
+	}
+
 	/* set this to one value for a quick approximate value */
 	multiplier.R = 1;
 	multiplier.G = 1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]