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



commit c81a6eca950a15cd7fe32e671ae87482cbcded71
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 66ff599..05f98e8 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -199,14 +199,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]