[gnome-settings-daemon/gnome-3-2] color: Create the correct device ID for EDIDs with no text data



commit 29551525352a695ccd2dc7e8500e23b31af44b5e
Author: Richard Hughes <richard hughsie com>
Date:   Thu Mar 1 15:05:12 2012 +0000

    color: Create the correct device ID for EDIDs with no text data
    
    When an EDID is valid, but crap (for example in a cheap projector) we don't get
    any EDID vendor, model or serial. Fall back to the connection name in this case,
    rather than just registering an 'xrandr' device ID.

 plugins/color/gsd-color-manager.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/plugins/color/gsd-color-manager.c b/plugins/color/gsd-color-manager.c
index 118a92c..55a2fa7 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -202,14 +202,24 @@ gcm_session_get_output_id (GsdColorManager *manager, GnomeRROutput *output)
                 goto out;
         }
 
-        /* get EDID data */
+        /* check EDID data is okay to use */
         vendor = gcm_edid_get_vendor_name (edid);
+        name = gcm_edid_get_monitor_name (edid);
+        serial = gcm_edid_get_serial_number (edid);
+        if (vendor == NULL && name == NULL && serial == NULL) {
+                g_debug ("edid invalid for %s, falling back to connection name",
+                         gnome_rr_output_get_name (output));
+                g_string_append_printf (device_id,
+                                        "-%s",
+                                        gnome_rr_output_get_name (output));
+                goto out;
+        }
+
+        /* use EDID data */
         if (vendor != NULL)
                 g_string_append_printf (device_id, "-%s", vendor);
-        name = gcm_edid_get_monitor_name (edid);
         if (name != NULL)
                 g_string_append_printf (device_id, "-%s", name);
-        serial = gcm_edid_get_serial_number (edid);
         if (serial != NULL)
                 g_string_append_printf (device_id, "-%s", serial);
 out:



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