[gnome-color-manager] huey: Discover the serial number for the huey
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] huey: Discover the serial number for the huey
- Date: Fri, 23 Jul 2010 14:20:02 +0000 (UTC)
commit 9d576e1402e8f8ca6d262cd51060f98fc5f14cca
Author: Richard Hughes <richard hughsie com>
Date: Fri Jul 23 09:13:07 2010 +0100
huey: Discover the serial number for the huey
Thanks to Andrew Lutomirski for the debug dump
docs/huey/huey-sensor-dump2.txt.gz | Bin 0 -> 1072 bytes
libcolor-glib/gcm-sensor-huey.c | 11 +++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/docs/huey/huey-sensor-dump2.txt.gz b/docs/huey/huey-sensor-dump2.txt.gz
new file mode 100644
index 0000000..812183d
Binary files /dev/null and b/docs/huey/huey-sensor-dump2.txt.gz differ
diff --git a/libcolor-glib/gcm-sensor-huey.c b/libcolor-glib/gcm-sensor-huey.c
index e0feff2..eb24e0c 100644
--- a/libcolor-glib/gcm-sensor-huey.c
+++ b/libcolor-glib/gcm-sensor-huey.c
@@ -760,6 +760,8 @@ gcm_sensor_huey_startup (GcmSensor *sensor, GError **error)
{
gboolean ret = FALSE;
guint i;
+ guint32 serial_number;
+ gchar *serial_number_tmp = NULL;
GcmSensorHuey *sensor_huey = GCM_SENSOR_HUEY (sensor);
GcmSensorHueyPrivate *priv = sensor_huey->priv;
const guint8 spin_leds[] = { 0x0, 0x1, 0x2, 0x4, 0x8, 0x4, 0x2, 0x1, 0x0, 0xff };
@@ -776,6 +778,14 @@ gcm_sensor_huey_startup (GcmSensor *sensor, GError **error)
if (!ret)
goto out;
+ /* get serial number */
+ ret = gcm_sensor_huey_read_register_word (sensor_huey, 0x00, &serial_number, error);
+ if (!ret)
+ goto out;
+ serial_number_tmp = g_strdup_printf ("%i", serial_number);
+ gcm_sensor_set_serial_number (sensor, serial_number_tmp);
+ egg_debug ("Serial number: %s", serial_number_tmp);
+
/* get unlock string */
ret = gcm_sensor_huey_read_register_string (sensor_huey, 0x7a, priv->unlock_string, 5, error);
if (!ret)
@@ -804,6 +814,7 @@ gcm_sensor_huey_startup (GcmSensor *sensor, GError **error)
g_usleep (50000);
}
out:
+ g_free (serial_number_tmp);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]