summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-21 13:48:01 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-21 13:48:01 +0200
commitf1a8e221ecacea23883df57951e291a910463948 (patch)
treed8b9f11198577f4b2d4ecdabbf473fa06fcda090
parentcd8e457c583b812a13bfbfef5c61325bdd1d55f3 (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.
-rw-r--r--TODO13
-rw-r--r--src/login/logind-device.c16
-rw-r--r--src/login/logind-seat-dbus.c40
-rw-r--r--src/login/logind-seat.c20
-rw-r--r--src/login/logind-seat.h3
5 files changed, 79 insertions, 13 deletions
diff --git a/TODO b/TODO
index 73230caae..872d66652 100644
--- a/TODO
+++ b/TODO
@@ -12,8 +12,6 @@ Bugfixes:
12 12
13* make anaconda write timeout=0 for encrypted devices 13* make anaconda write timeout=0 for encrypted devices
14 14
15* make sure timeouts are applied to Type=oneshot services.
16
17* Dangling symlinks of .automount unit files in .wants/ directories, set up 15* Dangling symlinks of .automount unit files in .wants/ directories, set up
18 automount points even when the original .automount file did not exist 16 automount points even when the original .automount file did not exist
19 anymore. Only the .mount unit was still around. 17 anymore. Only the .mount unit was still around.
@@ -27,16 +25,19 @@ Bugfixes:
27 25
28Features: 26Features:
29 27
30* introduce CanGraphics and CanText properties on seat objects, to combat races where gdm is started before the graphics driver is loaded and finished probing. 28* support rd.luks= kernel cmdline params in cryptsetup generator
29
30* support rd.fstab= kernel cmdline params in fstab generator
31
32* support rd.driver= kernel cmdline params in modules load
31 33
32* change $NOTIFY_SOCKET to use an abstract namespace socket, so that chroot() is compatible with this 34* supprto rd.xxx wherever else makes sense
33 https://bugzilla.redhat.com/show_bug.cgi?id=833105
34 35
35* readahead: merge the three tools into one binary 36* readahead: merge the three tools into one binary
36 37
37* systemctl: when stopping a service which has triggres and warning about it actually check the TriggeredBy= deps fields 38* systemctl: when stopping a service which has triggres and warning about it actually check the TriggeredBy= deps fields
38 39
39* send bus signal to upower on resume so that it can send out its dbus signal for compat 40* send SIGPWR to upower on resume so that it can send out its dbus signal for compat
40 41
41* vtconsole: don't override kernel cmdline utf8 override setting 42* vtconsole: don't override kernel cmdline utf8 override setting
42 43
diff --git a/src/login/logind-device.c b/src/login/logind-device.c
index 828e1efe4..51b15358b 100644
--- a/src/login/logind-device.c
+++ b/src/login/logind-device.c
@@ -65,22 +65,32 @@ void device_free(Device *d) {
65} 65}
66 66
67void device_detach(Device *d) { 67void device_detach(Device *d) {
68 Seat *s;
68 assert(d); 69 assert(d);
69 70
70 if (d->seat) 71 if (!d->seat)
71 LIST_REMOVE(Device, devices, d->seat->devices, d); 72 return;
72 73
73 seat_add_to_gc_queue(d->seat); 74 s = d->seat;
75 LIST_REMOVE(Device, devices, d->seat->devices, d);
74 d->seat = NULL; 76 d->seat = NULL;
77
78 seat_add_to_gc_queue(s);
79 seat_send_changed(s, "CanGraphical\0");
75} 80}
76 81
77void device_attach(Device *d, Seat *s) { 82void device_attach(Device *d, Seat *s) {
78 assert(d); 83 assert(d);
79 assert(s); 84 assert(s);
80 85
86 if (d->seat == s)
87 return;
88
81 if (d->seat) 89 if (d->seat)
82 device_detach(d); 90 device_detach(d);
83 91
84 d->seat = s; 92 d->seat = s;
85 LIST_PREPEND(Device, devices, s->devices, d); 93 LIST_PREPEND(Device, devices, s->devices, d);
94
95 seat_send_changed(s, "CanGraphical\0");
86} 96}
diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
index 4bf9bf7b1..7833d70a0 100644
--- a/src/login/logind-seat-dbus.c
+++ b/src/login/logind-seat-dbus.c
@@ -36,6 +36,8 @@
36 " <property name=\"Id\" type=\"s\" access=\"read\"/>\n" \ 36 " <property name=\"Id\" type=\"s\" access=\"read\"/>\n" \
37 " <property name=\"ActiveSession\" type=\"so\" access=\"read\"/>\n" \ 37 " <property name=\"ActiveSession\" type=\"so\" access=\"read\"/>\n" \
38 " <property name=\"CanMultiSession\" type=\"b\" access=\"read\"/>\n" \ 38 " <property name=\"CanMultiSession\" type=\"b\" access=\"read\"/>\n" \
39 " <property name=\"CanTTY\" type=\"b\" access=\"read\"/>\n" \
40 " <property name=\"CanGraphical\" type=\"b\" access=\"read\"/>\n" \
39 " <property name=\"Sessions\" type=\"a(so)\" access=\"read\"/>\n" \ 41 " <property name=\"Sessions\" type=\"a(so)\" access=\"read\"/>\n" \
40 " <property name=\"IdleHint\" type=\"b\" access=\"read\"/>\n" \ 42 " <property name=\"IdleHint\" type=\"b\" access=\"read\"/>\n" \
41 " <property name=\"IdleSinceHint\" type=\"t\" access=\"read\"/>\n" \ 43 " <property name=\"IdleSinceHint\" type=\"t\" access=\"read\"/>\n" \
@@ -133,7 +135,7 @@ static int bus_seat_append_sessions(DBusMessageIter *i, const char *property, vo
133 return 0; 135 return 0;
134} 136}
135 137
136static int bus_seat_append_multi_session(DBusMessageIter *i, const char *property, void *data) { 138static int bus_seat_append_can_multi_session(DBusMessageIter *i, const char *property, void *data) {
137 Seat *s = data; 139 Seat *s = data;
138 dbus_bool_t b; 140 dbus_bool_t b;
139 141
@@ -149,6 +151,38 @@ static int bus_seat_append_multi_session(DBusMessageIter *i, const char *propert
149 return 0; 151 return 0;
150} 152}
151 153
154static int bus_seat_append_can_tty(DBusMessageIter *i, const char *property, void *data) {
155 Seat *s = data;
156 dbus_bool_t b;
157
158 assert(i);
159 assert(property);
160 assert(s);
161
162 b = seat_can_tty(s);
163
164 if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b))
165 return -ENOMEM;
166
167 return 0;
168}
169
170static int bus_seat_append_can_graphical(DBusMessageIter *i, const char *property, void *data) {
171 Seat *s = data;
172 dbus_bool_t b;
173
174 assert(i);
175 assert(property);
176 assert(s);
177
178 b = seat_can_graphical(s);
179
180 if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b))
181 return -ENOMEM;
182
183 return 0;
184}
185
152static int bus_seat_append_idle_hint(DBusMessageIter *i, const char *property, void *data) { 186static int bus_seat_append_idle_hint(DBusMessageIter *i, const char *property, void *data) {
153 Seat *s = data; 187 Seat *s = data;
154 dbus_bool_t b; 188 dbus_bool_t b;
@@ -210,7 +244,9 @@ static int get_seat_for_path(Manager *m, const char *path, Seat **_s) {
210static const BusProperty bus_login_seat_properties[] = { 244static const BusProperty bus_login_seat_properties[] = {
211 { "Id", bus_property_append_string, "s", offsetof(Seat, id), true }, 245 { "Id", bus_property_append_string, "s", offsetof(Seat, id), true },
212 { "ActiveSession", bus_seat_append_active, "(so)", 0 }, 246 { "ActiveSession", bus_seat_append_active, "(so)", 0 },
213 { "CanMultiSession", bus_seat_append_multi_session, "b", 0 }, 247 { "CanMultiSession", bus_seat_append_can_multi_session, "b", 0 },
248 { "CanTTY", bus_seat_append_can_tty, "b", 0 },
249 { "CanGraphical", bus_seat_append_can_graphical, "b", 0 },
214 { "Sessions", bus_seat_append_sessions, "a(so)", 0 }, 250 { "Sessions", bus_seat_append_sessions, "a(so)", 0 },
215 { "IdleHint", bus_seat_append_idle_hint, "b", 0 }, 251 { "IdleHint", bus_seat_append_idle_hint, "b", 0 },
216 { "IdleSinceHint", bus_seat_append_idle_hint_since, "t", 0 }, 252 { "IdleSinceHint", bus_seat_append_idle_hint_since, "t", 0 },
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 755f20c03..045712192 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -104,9 +104,13 @@ int seat_save(Seat *s) {
104 fprintf(f, 104 fprintf(f,
105 "# This is private data. Do not parse.\n" 105 "# This is private data. Do not parse.\n"
106 "IS_VTCONSOLE=%i\n" 106 "IS_VTCONSOLE=%i\n"
107 "CAN_MULTI_SESSION=%i\n", 107 "CAN_MULTI_SESSION=%i\n"
108 "CAN_TTY=%i\n"
109 "CAN_GRAPHICAL=%i\n",
108 seat_is_vtconsole(s), 110 seat_is_vtconsole(s),
109 seat_can_multi_session(s)); 111 seat_can_multi_session(s),
112 seat_can_tty(s),
113 seat_can_graphical(s));
110 114
111 if (s->active) { 115 if (s->active) {
112 assert(s->active->user); 116 assert(s->active->user);
@@ -427,6 +431,18 @@ bool seat_can_multi_session(Seat *s) {
427 return s->manager->console_active_fd >= 0; 431 return s->manager->console_active_fd >= 0;
428} 432}
429 433
434bool seat_can_tty(Seat *s) {
435 assert(s);
436
437 return seat_is_vtconsole(s);
438}
439
440bool seat_can_graphical(Seat *s) {
441 assert(s);
442
443 return !!s->devices;
444}
445
430int seat_get_idle_hint(Seat *s, dual_timestamp *t) { 446int seat_get_idle_hint(Seat *s, dual_timestamp *t) {
431 Session *session; 447 Session *session;
432 bool idle_hint = true; 448 bool idle_hint = true;
diff --git a/src/login/logind-seat.h b/src/login/logind-seat.h
index d41320da4..1abbc344e 100644
--- a/src/login/logind-seat.h
+++ b/src/login/logind-seat.h
@@ -63,6 +63,9 @@ int seat_attach_session(Seat *s, Session *session);
63 63
64bool seat_is_vtconsole(Seat *s); 64bool seat_is_vtconsole(Seat *s);
65bool seat_can_multi_session(Seat *s); 65bool seat_can_multi_session(Seat *s);
66bool seat_can_tty(Seat *s);
67bool seat_can_graphical(Seat *s);
68
66int seat_get_idle_hint(Seat *s, dual_timestamp *t); 69int seat_get_idle_hint(Seat *s, dual_timestamp *t);
67 70
68int seat_start(Seat *s); 71int seat_start(Seat *s);