From f1e1a5ff06ab17a06b3a157bc60f75077af67420 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 19 Oct 2016 10:41:14 -0400 Subject: [PATCH] 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 file changed, 7 insertions(+) diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index 03a928a2f..765e5efa1 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) {