[mutter] native: shore up matching of card device



commit f1e1a5ff06ab17a06b3a157bc60f75077af67420
Author: Ray Strode <rstrode redhat com>
Date:   Wed Oct 19 10:41:14 2016 -0400

    native: shore up matching of card device
    
    Right now we accept any character device that matches the glob card*.
    
    That's fine, but we can be a little more specific by checking that
    the devtype is what we expect.
    
    This commit does that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771442

 src/backends/native/meta-launcher.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
index 03a928a..765e5ef 100644
--- a/src/backends/native/meta-launcher.c
+++ b/src/backends/native/meta-launcher.c
@@ -47,6 +47,8 @@
 #include "meta-idle-monitor-native.h"
 #include "meta-renderer-native.h"
 
+#define DRM_CARD_UDEV_DEVICE_TYPE "drm_minor"
+
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevDevice, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevClient, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevEnumerator, g_object_unref)
@@ -310,12 +312,17 @@ get_primary_gpu_path (const gchar *seat_name)
       g_autoptr (GUdevDevice) pci_device = NULL;
       GUdevDevice *dev = tmp->data;
       gint boot_vga;
+      const gchar *device_type;
       const gchar *device_seat;
 
       /* filter out devices that are not character device, like card0-VGA-1 */
       if (g_udev_device_get_device_type (dev) != G_UDEV_DEVICE_TYPE_CHAR)
         continue;
 
+      device_type = g_udev_device_get_property (dev, "DEVTYPE");
+      if (g_strcmp0 (device_type, DRM_CARD_UDEV_DEVICE_TYPE) != 0)
+        continue;
+
       device_seat = g_udev_device_get_property (dev, "ID_SEAT");
       if (!device_seat)
         {


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