Blame SOURCES/0005-ply-device-manager-verify_add_or_change-Move-local_c.patch

b9a929
From 406376fbe89078678d68392ea76151ecb4f0e30a Mon Sep 17 00:00:00 2001
b9a929
From: Hans de Goede <hdegoede@redhat.com>
b9a929
Date: Mon, 28 Feb 2022 16:36:58 +0100
b9a929
Subject: [PATCH 5/6] ply-device-manager: verify_add_or_change(): Move
b9a929
 local_console_is_text check
b9a929
b9a929
Move the local_console_is_text check outside of the
b9a929
"if (subsytem == SUBSYSTEM_DRM)" block.
b9a929
b9a929
This check is equally relevant for SUBSYSTEM_FRAME_BUFFER.
b9a929
b9a929
Note by itself this is a no-op since verify_add_or_change() *always*
b9a929
returns false for SUBSYSTEM_FRAME_BUFFER devices.
b9a929
b9a929
This is a preparation patch for making verify_add_or_change() not
b9a929
return false when manager->device_timeout_elapsed is set.
b9a929
b9a929
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
b9a929
---
b9a929
 src/libply-splash-core/ply-device-manager.c | 10 +++++-----
b9a929
 1 file changed, 5 insertions(+), 5 deletions(-)
b9a929
b9a929
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
b9a929
index 6b7ccd6..bff4982 100644
b9a929
--- a/src/libply-splash-core/ply-device-manager.c
b9a929
+++ b/src/libply-splash-core/ply-device-manager.c
b9a929
@@ -423,68 +423,68 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager,
b9a929
                 /* We also try to create the renderer again on change events,
b9a929
                  * renderer creation fails when no outputs are connected and
b9a929
                  * this may have changed.
b9a929
                  */
b9a929
                 create_devices_for_udev_device (manager, device);
b9a929
                 return;
b9a929
         }
b9a929
 
b9a929
         /* Renderer exists, bail if this is not a change event */
b9a929
         if (strcmp (action, "change"))
b9a929
                 return;
b9a929
 
b9a929
         changed = ply_renderer_handle_change_event (renderer);
b9a929
         if (changed) {
b9a929
                 free_displays_for_renderer (manager, renderer);
b9a929
                 create_pixel_displays_for_renderer (manager, renderer);
b9a929
         }
b9a929
 }
b9a929
 
b9a929
 static bool
b9a929
 verify_add_or_change (ply_device_manager_t *manager,
b9a929
                       const char           *action,
b9a929
                       const char           *device_path,
b9a929
                       struct udev_device   *device)
b9a929
 {
b9a929
         const char *subsystem = udev_device_get_subsystem (device);
b9a929
 
b9a929
         if (strcmp (action, "add") && strcmp (action, "change"))
b9a929
                 return false;
b9a929
 
b9a929
+        if (manager->local_console_managed && manager->local_console_is_text) {
b9a929
+                ply_trace ("ignoring since we're already using text splash for local console");
b9a929
+                return false;
b9a929
+        }
b9a929
+
b9a929
         subsystem = udev_device_get_subsystem (device);
b9a929
 
b9a929
         if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
b9a929
-                if (manager->local_console_managed && manager->local_console_is_text) {
b9a929
-                        ply_trace ("ignoring since we're already using text splash for local console");
b9a929
-                        return false;
b9a929
-                }
b9a929
-
b9a929
                 if (!verify_drm_device (device)) {
b9a929
                         ply_trace ("ignoring since we only handle SimpleDRM devices after timeout");
b9a929
                         return false;
b9a929
                 }
b9a929
         } else {
b9a929
                 ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem);
b9a929
                 return false;
b9a929
         }
b9a929
 
b9a929
         return true;
b9a929
 }
b9a929
 
b9a929
 static bool
b9a929
 duplicate_device_path (ply_list_t *events, const char *device_path)
b9a929
 {
b9a929
         struct udev_device *device;
b9a929
         ply_list_node_t *node;
b9a929
 
b9a929
         for (node = ply_list_get_first_node (events);
b9a929
              node; node = ply_list_get_next_node (events, node)) {
b9a929
                 device = ply_list_node_get_data (node);
b9a929
 
b9a929
                 if (strcmp (udev_device_get_devnode (device), device_path) == 0)
b9a929
                         return true;
b9a929
         }
b9a929
 
b9a929
         return false;
b9a929
 }
b9a929
 
b9a929
 static void
b9a929
-- 
b9a929
2.37.0.rc1
b9a929