[gnome-color-manager] trivial: fall back to ID_MODEL if it's present



commit cf76451a723a7ab9ab99334f3618fb4998d3671a
Author: Richard Hughes <richard hughsie com>
Date:   Sat Mar 6 21:17:05 2010 +0000

    trivial: fall back to ID_MODEL if it's present

 src/gcm-colorimeter.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-colorimeter.c b/src/gcm-colorimeter.c
index d3edf8d..28265b4 100644
--- a/src/gcm-colorimeter.c
+++ b/src/gcm-colorimeter.c
@@ -300,12 +300,16 @@ gcm_colorimeter_device_add (GcmColorimeter *colorimeter, GUdevDevice *device)
 	g_free (priv->vendor);
 	priv->vendor = g_strdup (g_udev_device_get_property (device, "ID_VENDOR_FROM_DATABASE"));
 	if (priv->vendor == NULL)
+		priv->vendor = g_strdup (g_udev_device_get_property (device, "ID_VENDOR"));
+	if (priv->vendor == NULL)
 		priv->vendor = g_strdup (g_udev_device_get_sysfs_attr (device, "manufacturer"));
 
 	/* model */
 	g_free (priv->model);
 	priv->model = g_strdup (g_udev_device_get_property (device, "ID_MODEL_FROM_DATABASE"));
 	if (priv->model == NULL)
+		priv->model = g_strdup (g_udev_device_get_property (device, "ID_MODEL"));
+	if (priv->model == NULL)
 		priv->model = g_strdup (g_udev_device_get_sysfs_attr (device, "product"));
 
 	/* device support */
@@ -314,11 +318,11 @@ gcm_colorimeter_device_add (GcmColorimeter *colorimeter, GUdevDevice *device)
 	priv->supports_printer = g_udev_device_get_property_as_boolean (device, "GCM_TYPE_PRINTER");
 
 	/* try to get type */
-	if (g_ascii_strcasecmp (priv->model, "Huey") == 0) {
+	if (priv->model != NULL && g_ascii_strcasecmp (priv->model, "Huey") == 0) {
 		priv->colorimeter_kind = GCM_COLORIMETER_KIND_HUEY;
-	} else if (g_ascii_strcasecmp (priv->model, "ColorMunki") == 0) {
+	} else if (priv->model != NULL && g_ascii_strcasecmp (priv->model, "ColorMunki") == 0) {
 		priv->colorimeter_kind = GCM_COLORIMETER_KIND_COLOR_MUNKI;
-	} else if (g_ascii_strcasecmp (priv->model, "Monitor Spyder") == 0) {
+	} else if (priv->model != NULL && g_ascii_strcasecmp (priv->model, "Monitor Spyder") == 0) {
 		priv->colorimeter_kind = GCM_COLORIMETER_KIND_SPYDER;
 	} else if (priv->model != NULL) {
 		egg_warning ("Failed to recognise color device: %s", priv->model);



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