[gnome-color-manager: 6/80] huey: the first byte back seems to be success/failure



commit 00c748e3f4e53978d5fb1c5aaad8b9e5e6cd2cde
Author: Richard Hughes <richard hughsie com>
Date:   Sat Jul 17 22:39:39 2010 +0100

    huey: the first byte back seems to be success/failure

 src/gcm-huey-example.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-huey-example.c b/src/gcm-huey-example.c
index 091b0ef..b63f8c8 100644
--- a/src/gcm-huey-example.c
+++ b/src/gcm-huey-example.c
@@ -145,6 +145,17 @@ send_command (GcmPriv *priv, guchar command, GError **error)
 		goto out;
 	}
 
+	/* the first byte is success */
+	switch (data[0]) {
+	case 0x00:
+		/* assume success */
+	case 0x80:
+		/* failure, the return buffer is set to NoCmd */
+		g_set_error (error, 1, 0, "failed to issue command: %s", &data[2]);
+		goto out;
+	}
+		
+
 	/* show what we've got */
 	g_print ("cmd 0x%02x\t", command);
 	for (i=0; i< (guint)bytes_read; i++)



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