diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-06-21 13:48:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-06-21 13:48:01 +0200 |
commit | f1a8e221ecacea23883df57951e291a910463948 (patch) | |
tree | d8b9f11198577f4b2d4ecdabbf473fa06fcda090 /src/login/logind-seat-dbus.c | |
parent | cd8e457c583b812a13bfbfef5c61325bdd1d55f3 (diff) |
logind: expose CanGraphical and CanTTY properties on seat objects
Since we boot so fast now that gdm might get started before the
graphics drivers are properly loaded and probed we might end up
announcing seat0 to gdm before it has graphics capabilities. Which will
cause gdm/X11 cause to fail later on.
To fix this race, let's expose CanGraphical and CanTTY fields on all
seats, which clarify whether a seat is suitable for gdm resp, suitable
for text logins. gdm then needs to watch CanGraphical and spawn X11 on
it only if it is true.
This way:
USB graphics seats will expose CanGraphical=yes, CanTTY=no
Machines with no graphics drivers at all, but a text console:
CanGraphical=no, CanTTY=yes
Machines with CONFIG_VT turned off: CanGraphical=yes, CanTTY=no
And the most important case: seat0 where the graphics driver has not
been probed yet boot up with CanGraphical=no, CanTTY=yes first, which
then changes to CanGraphical=yes as soon as the probing is complete.
Diffstat (limited to 'src/login/logind-seat-dbus.c')
-rw-r--r-- | src/login/logind-seat-dbus.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c index 4bf9bf7b1f..7833d70a03 100644 --- a/src/login/logind-seat-dbus.c +++ b/src/login/logind-seat-dbus.c @@ -36,6 +36,8 @@ " <property name=\"Id\" type=\"s\" access=\"read\"/>\n" \ " <property name=\"ActiveSession\" type=\"so\" access=\"read\"/>\n" \ " <property name=\"CanMultiSession\" type=\"b\" access=\"read\"/>\n" \ + " <property name=\"CanTTY\" type=\"b\" access=\"read\"/>\n" \ + " <property name=\"CanGraphical\" type=\"b\" access=\"read\"/>\n" \ " <property name=\"Sessions\" type=\"a(so)\" access=\"read\"/>\n" \ " <property name=\"IdleHint\" type=\"b\" access=\"read\"/>\n" \ " <property name=\"IdleSinceHint\" type=\"t\" access=\"read\"/>\n" \ @@ -133,7 +135,7 @@ static int bus_seat_append_sessions(DBusMessageIter *i, const char *property, vo return 0; } -static int bus_seat_append_multi_session(DBusMessageIter *i, const char *property, void *data) { +static int bus_seat_append_can_multi_session(DBusMessageIter *i, const char *property, void *data) { Seat *s = data; dbus_bool_t b; @@ -149,6 +151,38 @@ static int bus_seat_append_multi_session(DBusMessageIter *i, const char *propert return 0; } +static int bus_seat_append_can_tty(DBusMessageIter *i, const char *property, void *data) { + Seat *s = data; + dbus_bool_t b; + + assert(i); + assert(property); + assert(s); + + b = seat_can_tty(s); + + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) + return -ENOMEM; + + return 0; +} + +static int bus_seat_append_can_graphical(DBusMessageIter *i, const char *property, void *data) { + Seat *s = data; + dbus_bool_t b; + + assert(i); + assert(property); + assert(s); + + b = seat_can_graphical(s); + + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) + return -ENOMEM; + + return 0; +} + static int bus_seat_append_idle_hint(DBusMessageIter *i, const char *property, void *data) { Seat *s = data; dbus_bool_t b; @@ -210,7 +244,9 @@ static int get_seat_for_path(Manager *m, const char *path, Seat **_s) { static const BusProperty bus_login_seat_properties[] = { { "Id", bus_property_append_string, "s", offsetof(Seat, id), true }, { "ActiveSession", bus_seat_append_active, "(so)", 0 }, - { "CanMultiSession", bus_seat_append_multi_session, "b", 0 }, + { "CanMultiSession", bus_seat_append_can_multi_session, "b", 0 }, + { "CanTTY", bus_seat_append_can_tty, "b", 0 }, + { "CanGraphical", bus_seat_append_can_graphical, "b", 0 }, { "Sessions", bus_seat_append_sessions, "a(so)", 0 }, { "IdleHint", bus_seat_append_idle_hint, "b", 0 }, { "IdleSinceHint", bus_seat_append_idle_hint_since, "t", 0 }, |