mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
logind: Do not fail display count if a device has no parent
udev_device_get_parent() may return NULL when the device doesn't have a parent, as is the case with (for example) /sys/devices/virtual/drm/ttm. Also, log an actual error message instead of "-12 displays connected".
This commit is contained in:
parent
4de8292689
commit
94036de887
@ -84,7 +84,9 @@ int manager_handle_action(
|
||||
* treat like this under the assumption that there is
|
||||
* no modern drm driver available. */
|
||||
n = manager_count_displays(m);
|
||||
if (n != 1) {
|
||||
if (n < 0)
|
||||
log_warning("Display counting failed: %s", strerror(-n));
|
||||
else if (n != 1) {
|
||||
log_debug("Ignoring lid switch request, %i displays connected.", n);
|
||||
return 0;
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ int manager_count_displays(Manager *m) {
|
||||
|
||||
p = udev_device_get_parent(d);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
continue;
|
||||
|
||||
/* If the parent shares the same subsystem as the
|
||||
* device we are looking at then it is a connector,
|
||||
|
Loading…
x
Reference in New Issue
Block a user