mirror of
https://github.com/brl/mutter.git
synced 2025-02-04 07:34:09 +00:00
device-pool: Only fetch major/minor for taken devices
It's only when we take/release from/to logind we need these two integers, so only retrieve them when that's done. Making this change makes it possible to open devices that don't have these parameters. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
This commit is contained in:
parent
e6421dc5da
commit
3d882b6410
@ -211,7 +211,7 @@ meta_device_pool_open (MetaDevicePool *pool,
|
|||||||
{
|
{
|
||||||
g_autoptr (GMutexLocker) locker = NULL;
|
g_autoptr (GMutexLocker) locker = NULL;
|
||||||
MetaDeviceFile *file;
|
MetaDeviceFile *file;
|
||||||
int major, minor;
|
int major = -1, minor = -1;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
locker = g_mutex_locker_new (&pool->mutex);
|
locker = g_mutex_locker_new (&pool->mutex);
|
||||||
@ -224,15 +224,6 @@ meta_device_pool_open (MetaDevicePool *pool,
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!get_device_info_from_path (path, &major, &minor))
|
|
||||||
{
|
|
||||||
g_set_error (error,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_NOT_FOUND,
|
|
||||||
"Could not get device info for path %s: %m", path);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & META_DEVICE_FILE_FLAG_TAKE_CONTROL)
|
if (flags & META_DEVICE_FILE_FLAG_TAKE_CONTROL)
|
||||||
{
|
{
|
||||||
if (!pool->session_proxy)
|
if (!pool->session_proxy)
|
||||||
@ -242,6 +233,15 @@ meta_device_pool_open (MetaDevicePool *pool,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!get_device_info_from_path (path, &major, &minor))
|
||||||
|
{
|
||||||
|
g_set_error (error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_NOT_FOUND,
|
||||||
|
"Could not get device info for path %s: %m", path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!take_device (pool->session_proxy, major, minor, &fd, NULL, error))
|
if (!take_device (pool->session_proxy, major, minor, &fd, NULL, error))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user