summaryrefslogtreecommitdiff
path: root/src/login/logind-core.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-08-23 11:17:14 +0200
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:12:20 +0100
commit1c627e6a1ffe67022a3610a07613e690e9d0752a (patch)
tree915ce4a2f800bff591907c99ab36cd62620ef41b /src/login/logind-core.c
parent965f7e2c6602adb824a848132c20abd7a7aa96f6 (diff)
Remove support for auto-spawning VTs
Auto-spawning VTs requires systemd in practice. If you're using systemd you can just use its logind :)
Diffstat (limited to 'src/login/logind-core.c')
-rw-r--r--src/login/logind-core.c49
1 files changed, 7 insertions, 42 deletions
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index 59f5f8cc0..c566159d3 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -429,7 +429,7 @@ static int vt_is_busy(unsigned int vtnr) {
return r;
}
-static bool manager_is_docked(Manager *m) {
+bool manager_is_docked(Manager *m) {
Iterator i;
Button *b;
@@ -440,7 +440,7 @@ static bool manager_is_docked(Manager *m) {
return false;
}
-static int manager_count_external_displays(Manager *m) {
+int manager_count_displays(Manager *m) {
_cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
@@ -462,8 +462,7 @@ static int manager_count_external_displays(Manager *m) {
udev_list_entry_foreach(item, first) {
_cleanup_udev_device_unref_ struct udev_device *d = NULL;
struct udev_device *p;
- const char *status, *enabled, *dash, *nn, *i;
- bool external = false;
+ const char *status;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
if (!d)
@@ -479,40 +478,6 @@ static int manager_count_external_displays(Manager *m) {
if (!streq_ptr(udev_device_get_subsystem(p), "drm"))
continue;
- nn = udev_device_get_sysname(d);
- if (!nn)
- continue;
-
- /* Ignore internal displays: the type is encoded in
- * the sysfs name, as the second dash seperated item
- * (the first is the card name, the last the connector
- * number). We implement a whitelist of external
- * displays here, rather than a whitelist, to ensure
- * we don't block suspends too eagerly. */
- dash = strchr(nn, '-');
- if (!dash)
- continue;
-
- dash++;
- FOREACH_STRING(i, "VGA-", "DVI-I-", "DVI-D-", "DVI-A-"
- "Composite-", "SVIDEO-", "Component-",
- "DIN-", "DP-", "HDMI-A-", "HDMI-B-", "TV-") {
-
- if (startswith(dash, i)) {
- external = true;
- break;
- }
- }
- if (!external)
- continue;
-
- /* Ignore ports that are not enabled */
- enabled = udev_device_get_sysattr_value(d, "enabled");
- if (!enabled)
- continue;
- if (!streq_ptr(enabled, "enabled"))
- continue;
-
/* We count any connector which is not explicitly
* "disconnected" as connected. */
status = udev_device_get_sysattr_value(d, "status");
@@ -523,7 +488,7 @@ static int manager_count_external_displays(Manager *m) {
return n;
}
-bool manager_is_docked_or_external_displays(Manager *m) {
+bool manager_is_docked_or_multiple_displays(Manager *m) {
int n;
/* If we are docked don't react to lid closing */
@@ -534,11 +499,11 @@ bool manager_is_docked_or_external_displays(Manager *m) {
/* If we have more than one display connected,
* assume that we are docked. */
- n = manager_count_external_displays(m);
+ n = manager_count_displays(m);
if (n < 0)
log_warning_errno(n, "Display counting failed: %m");
- else if (n >= 1) {
- log_debug("External (%i) displays connected.", n);
+ else if (n > 1) {
+ log_debug("Multiple (%i) displays connected.", n);
return true;
}