Permalink
Browse files
colorhug: Add GUIDs for each device
This is required to write fwupd-compatible update descriptions.
- Loading branch information...
Showing
with
36 additions
and
0 deletions.
-
+5
−0
lib/colorhug/ch-common.h
-
+30
−0
lib/colorhug/ch-device.c
-
+1
−0
lib/colorhug/ch-device.h
|
|
@@ -1293,6 +1293,11 @@ G_BEGIN_DECLS |
|
|
#define CH_FIRMWARE_ID_TOKEN_ALS "84f40464" /* since 1.2.9 */
|
|
|
#define CH_FIRMWARE_ID_TOKEN_PLUS "6d6f05a9"
|
|
|
|
|
|
+#define CH_DEVICE_GUID_COLORHUG "40338ceb-b966-4eae-adae-9c32edfcc484" /* since 1.2.9 */
|
|
|
+#define CH_DEVICE_GUID_COLORHUG2 "2082b5e0-7a64-478a-b1b2-e3404fab6dad" /* since 1.2.9 */
|
|
|
+#define CH_DEVICE_GUID_COLORHUG_ALS "84f40464-9272-4ef7-9399-cd95f12da696" /* since 1.2.9 */
|
|
|
+#define CH_DEVICE_GUID_COLORHUG_PLUS "6d6f05a9-3ecb-43a2-bcbb-3844f1825366" /* since 1.2.9 */
|
|
|
+
|
|
|
/* input and output buffer offsets */
|
|
|
#define CH_BUFFER_INPUT_CMD 0x00
|
|
|
#define CH_BUFFER_INPUT_DATA 0x01
|
|
|
|
|
|
@@ -661,3 +661,33 @@ ch_device_get_runcode_address (GUsbDevice *device) |
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * ch_device_get_guid:
|
|
|
+ * @device: A #GUsbDevice
|
|
|
+ *
|
|
|
+ * Returns the GUID for the connected ColorHug device.
|
|
|
+ *
|
|
|
+ * Return value: the GUID address, or %NULL for error
|
|
|
+ *
|
|
|
+ * Since: 1.2.9
|
|
|
+ **/
|
|
|
+const gchar *
|
|
|
+ch_device_get_guid (GUsbDevice *device)
|
|
|
+{
|
|
|
+ ChDeviceMode mode = ch_device_get_mode (device);
|
|
|
+ if (mode == CH_DEVICE_MODE_LEGACY ||
|
|
|
+ mode == CH_DEVICE_MODE_FIRMWARE ||
|
|
|
+ mode == CH_DEVICE_MODE_BOOTLOADER)
|
|
|
+ return CH_DEVICE_GUID_COLORHUG;
|
|
|
+ if (mode == CH_DEVICE_MODE_FIRMWARE2 ||
|
|
|
+ mode == CH_DEVICE_MODE_BOOTLOADER2)
|
|
|
+ return CH_DEVICE_GUID_COLORHUG2;
|
|
|
+ if (mode == CH_DEVICE_MODE_FIRMWARE_PLUS ||
|
|
|
+ mode == CH_DEVICE_MODE_BOOTLOADER_PLUS)
|
|
|
+ return CH_DEVICE_GUID_COLORHUG_PLUS;
|
|
|
+ if (mode == CH_DEVICE_MODE_FIRMWARE_ALS ||
|
|
|
+ mode == CH_DEVICE_MODE_BOOTLOADER_ALS)
|
|
|
+ return CH_DEVICE_GUID_COLORHUG_ALS;
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
@@ -69,6 +69,7 @@ gboolean ch_device_check_firmware (GUsbDevice *device, |
|
|
GError **error)
|
|
|
G_GNUC_WARN_UNUSED_RESULT;
|
|
|
guint16 ch_device_get_runcode_address (GUsbDevice *device);
|
|
|
+const gchar *ch_device_get_guid (GUsbDevice *device);
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
0 comments on commit
7fba4c4