[gnome-color-manager] huey: command 13 seems to be used as an alternate measure mode for CRTs



commit d09ce2d9ab1c33badd37ed3a4992b15aa212abd1
Author: Richard Hughes <richard hughsie com>
Date:   Thu Sep 23 16:40:05 2010 +0100

    huey: command 13 seems to be used as an alternate measure mode for CRTs

 docs/huey/gcm-parse-huey.c                |   30 ++++++++++++++++++++--------
 docs/huey/usb-profile-complete-crt.txt.gz |  Bin 51034 -> 51713 bytes
 docs/huey/usb-profile-complete.txt.gz     |  Bin 56720 -> 48573 bytes
 libcolor-glib/gcm-sensor-huey.c           |   16 ++++++++++++--
 4 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/docs/huey/gcm-parse-huey.c b/docs/huey/gcm-parse-huey.c
index 466372d..444361c 100644
--- a/docs/huey/gcm-parse-huey.c
+++ b/docs/huey/gcm-parse-huey.c
@@ -78,7 +78,7 @@ get_command_string (guchar value)
 	if (value == 0x12)
 		return "unknown12";
 	if (value == 0x13)
-		return "unknown13";
+		return "measure-rgb-crt";
 	if (value == 0x15)
 		return "unknown15(status?)";
 	if (value == 0x16)
@@ -100,31 +100,43 @@ parse_command_sequence (GString *output, const gchar *line, gboolean reply)
 	gchar **tok;
 	guint j;
 	guchar cmd;
-	const gchar *annote;
+	guchar instruction = 0;
+	const gchar *command_as_text;
 	tok = g_strsplit (line, " ", -1);
 
 	/* only know how to parse 8 bytes */
 	if (g_strv_length (tok) != 8)
 		goto out;
 	for (j=0; j<8; j++) {
-		annote = NULL;
+		command_as_text = NULL;
 		cmd = g_ascii_strtoll (tok[j], NULL, 16);
 		if (j == 0 && reply) {
-			annote = get_return_string (cmd);
-			if (annote == NULL)
+			command_as_text = get_return_string (cmd);
+			if (command_as_text == NULL)
 				g_warning ("return code 0x%02x not known in %s", cmd, line);
 		}
 		if ((j == 0 && !reply) ||
 		    (j == 1 && reply)) {
-			annote = get_command_string (cmd);
-			if (annote == NULL)
+			instruction = cmd;
+			command_as_text = get_command_string (instruction);
+			if (command_as_text == NULL)
 				g_warning ("command code 0x%02x not known", cmd);
 		}
-		if (annote != NULL)
-			g_string_append_printf (output, "%02x(%s) ", cmd, annote);
+		/* some requests are filled with junk data */
+		if (!reply && instruction == 0x08 && j > 1)
+			g_string_append_printf (output, "xx ");
+		else if (!reply && instruction == 0x18 && j > 4)
+			g_string_append_printf (output, "xx ");
+		else if (!reply && instruction == 0x17 && j > 3)
+			g_string_append_printf (output, "xx ");
+		else if (command_as_text != NULL)
+			g_string_append_printf (output, "%02x(%s) ", cmd, command_as_text);
 		else
 			g_string_append_printf (output, "%02x ", cmd);
 	}
+	/* remove trailing space */
+	if (output->len > 1)
+		g_string_set_size (output, output->len - 1);
 out:
 	g_strfreev (tok);
 }
diff --git a/docs/huey/usb-profile-complete-crt.txt.gz b/docs/huey/usb-profile-complete-crt.txt.gz
index 839954c..3417203 100644
Binary files a/docs/huey/usb-profile-complete-crt.txt.gz and b/docs/huey/usb-profile-complete-crt.txt.gz differ
diff --git a/docs/huey/usb-profile-complete.txt.gz b/docs/huey/usb-profile-complete.txt.gz
index a604659..1a9640e 100644
Binary files a/docs/huey/usb-profile-complete.txt.gz and b/docs/huey/usb-profile-complete.txt.gz differ
diff --git a/libcolor-glib/gcm-sensor-huey.c b/libcolor-glib/gcm-sensor-huey.c
index 1b84297..51f434b 100644
--- a/libcolor-glib/gcm-sensor-huey.c
+++ b/libcolor-glib/gcm-sensor-huey.c
@@ -212,11 +212,21 @@ G_DEFINE_TYPE (GcmSensorHuey, gcm_sensor_huey, GCM_TYPE_SENSOR)
 #define HUEY_COMMAND_UNKNOWN_12		0x12
 
 /*
- * Unknown command
+ * Measures RGB value, and return the red value (only used in CRT mode).
+ *
+ * Seems to have to retry, every single time.
+ *
+ *                   Gain?
+ *              _______|_______
+ *             /---\ /---\ /---\
+ * input:   13 02 41 00 54 00 49 00
+ * returns: 00 13 00 00 01 99 02 00
+ *                   ^^^^^ - would match HUEY_COMMAND_SENSOR_MEASURE_RGB
  *
- * returns: all NULL all of the time
+ * The gain seems not to change for different measurements with different
+ * colors. This seems to be a less precise profile too.
  */
-#define HUEY_COMMAND_UNKNOWN_13		0x13
+#define HUEY_COMMAND_SENSOR_MEASURE_RGB_CRT	0x13
 
 /*
  * Unknown command



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