From d057762cdbdde289880128bfe56dbf117d1fca70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 15 Jul 2021 09:00:10 +0200 Subject: [PATCH] device-pool: Add debug logging Enabled by enabling the 'backend' debug topic. Part-of: --- src/backends/native/meta-device-pool.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/backends/native/meta-device-pool.c b/src/backends/native/meta-device-pool.c index f15ad90a3..8bbbe3e34 100644 --- a/src/backends/native/meta-device-pool.c +++ b/src/backends/native/meta-device-pool.c @@ -29,6 +29,7 @@ #include #include "backends/native/meta-launcher.h" +#include "meta/util.h" #include "meta-dbus-login1.h" @@ -135,6 +136,7 @@ MetaDeviceFile * meta_device_file_acquire (MetaDeviceFile *file) { g_mutex_lock (&file->pool->mutex); + meta_topic (META_DEBUG_BACKEND, "Acquiring device file '%s'", file->path); meta_device_file_acquire_locked (file); g_mutex_unlock (&file->pool->mutex); @@ -243,6 +245,10 @@ meta_device_pool_open (MetaDevicePool *pool, if (flags & META_DEVICE_FILE_FLAG_TAKE_CONTROL) { + meta_topic (META_DEBUG_BACKEND, + "Opening and taking control of device file '%s'", + path); + if (!pool->session_proxy) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, @@ -266,6 +272,10 @@ meta_device_pool_open (MetaDevicePool *pool, { int open_flags; + meta_topic (META_DEBUG_BACKEND, + "Opening device file '%s'", + path); + if (flags & META_DEVICE_FILE_FLAG_READ_ONLY) open_flags = O_RDONLY; else @@ -302,6 +312,8 @@ release_device_file (MetaDevicePool *pool, locker = g_mutex_locker_new (&pool->mutex); + meta_topic (META_DEBUG_BACKEND, "Releasing device file '%s'", file->path); + if (!g_ref_count_dec (&file->ref_count)) return; @@ -311,6 +323,10 @@ release_device_file (MetaDevicePool *pool, { MetaDbusLogin1Session *session_proxy; + meta_topic (META_DEBUG_BACKEND, + "Releasing control of and closing device file '%s'", + file->path); + session_proxy = pool->session_proxy; if (!meta_dbus_login1_session_call_release_device_sync (session_proxy, file->major, @@ -323,6 +339,12 @@ release_device_file (MetaDevicePool *pool, error->message); } } + else + { + meta_topic (META_DEBUG_BACKEND, + "Closing device file '%s'", + file->path); + } close (file->fd);