[gnome-color-manager: 14/80] huey: when we get the ambient brightness, we use command 0x17



commit 10fd07827fb2e93b9a530ddaa9c7cb05b7ed08b8
Author: Richard Hughes <richard hughsie com>
Date:   Sat Jul 17 22:42:59 2010 +0100

    huey: when we get the ambient brightness, we use command 0x17

 docs/huey/usb-ambient.txt.gz |  Bin 0 -> 955 bytes
 src/gcm-huey-example.c       |   22 ++++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/docs/huey/usb-ambient.txt.gz b/docs/huey/usb-ambient.txt.gz
new file mode 100644
index 0000000..cc03f3f
Binary files /dev/null and b/docs/huey/usb-ambient.txt.gz differ
diff --git a/src/gcm-huey-example.c b/src/gcm-huey-example.c
index ab8bafc..2370b6a 100644
--- a/src/gcm-huey-example.c
+++ b/src/gcm-huey-example.c
@@ -45,10 +45,11 @@
 #define HUEY_COMMAND_UNKNOWN_06		0x06 /* returns: all NULL for NULL input, 00,06,f1,f2,f3,f4,00,00 for 0xf1f2f3f4f5f6f7f8 */
 #define HUEY_COMMAND_UNKNOWN_07		0x07 /* returns: all NULL all of the time */
 #define HUEY_COMMAND_UNKNOWN_08		0x08 /* returns: all NULL for NULL input, 00,08,f1,f2,00,00,00,00 for 0xf1f2f3f4f5f6f7f8 */
-#define HUEY_COMMAND_MAYBE_UNLOCK	0x0e /* returns: all NULL all of the time */
+#define HUEY_COMMAND_UNLOCK		0x0e /* returns: all NULL all of the time */
 #define HUEY_COMMAND_UNKNOWN_0F		0x0f /* returns: all NULL all of the time */
 #define HUEY_COMMAND_UNKNOWN_13		0x13 /* returns: all NULL all of the time */
 #define HUEY_COMMAND_UNKNOWN_16		0x16 /* returns: all NULL for NULL input, times out for 0xf1f2f3f4f5f6f7f8 */
+#define HUEY_COMMAND_AMBIENT		0x17 /* returns: ? */
 #define HUEY_COMMAND_SET_LEDS		0x18 /* returns: all NULL for NULL input, times out for 0xf1f2f3f4f5f6f7f8 */
 #define HUEY_COMMAND_UNKNOWN_19		0x19 /* returns: all NULL for NULL input, times out for 0xf1f2f3f4f5f6f7f8 */
 
@@ -250,7 +251,7 @@ send_unlock (GcmPriv *priv, GError **error)
 	gboolean ret;
 	gsize reply_read;
 
-	request[0] = HUEY_COMMAND_MAYBE_UNLOCK;
+	request[0] = HUEY_COMMAND_UNLOCK;
 	request[1] = 'G';
 	request[2] = 'r';
 	request[3] = 'M';
@@ -276,6 +277,15 @@ send_leds (GcmPriv *priv, guchar mask, GError **error)
 	return send_command (priv, HUEY_COMMAND_SET_LEDS, payload, error);
 }
 
+static gboolean
+get_ambient (GcmPriv *priv, GError **error)
+{
+	guchar payload[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+	/* send all commands that are implemented */
+	return send_command (priv, HUEY_COMMAND_AMBIENT, payload, error);
+}
+
 int
 main (void)
 {
@@ -319,6 +329,14 @@ main (void)
 		goto out;
 	}
 
+	/* get ambient */
+	ret = get_ambient (priv, &error);
+	if (!ret) {
+		g_warning ("failed to get ambient: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+
 if (0) {
 	guchar payload[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 	guchar available[] = { 0x00, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x0e, 0x0f, 0x13, 0x16, 0x18, 0x19, 0xff };



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