summaryrefslogtreecommitdiff
path: root/src/login/logind-device.c
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 /src/login/logind-device.c
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.
Diffstat (limited to 'src/login/logind-device.c')
-rw-r--r--src/login/logind-device.c16
1 files changed, 13 insertions, 3 deletions
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) {
}
void device_detach(Device *d) {
+ Seat *s;
assert(d);
- if (d->seat)
- LIST_REMOVE(Device, devices, d->seat->devices, d);
+ if (!d->seat)
+ return;
- seat_add_to_gc_queue(d->seat);
+ s = d->seat;
+ LIST_REMOVE(Device, devices, d->seat->devices, d);
d->seat = NULL;
+
+ seat_add_to_gc_queue(s);
+ seat_send_changed(s, "CanGraphical\0");
}
void device_attach(Device *d, Seat *s) {
assert(d);
assert(s);
+ if (d->seat == s)
+ return;
+
if (d->seat)
device_detach(d);
d->seat = s;
LIST_PREPEND(Device, devices, s->devices, d);
+
+ seat_send_changed(s, "CanGraphical\0");
}