Merge lp:~mterry/lightdm/multi-seat-vt-0 into lp:lightdm

Proposed by Michael Terry
Status: Merged
Merge reported by: Robert Ancell
Merged at revision: not available
Proposed branch: lp:~mterry/lightdm/multi-seat-vt-0
Merge into: lp:lightdm
Diff against target: 58 lines (+18/-1)
3 files modified
src/seat-surfaceflinger.c (+2/-1)
src/vt.c (+14/-0)
src/vt.h (+2/-0)
To merge this branch: bzr merge lp:~mterry/lightdm/multi-seat-vt-0
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Review via email: mp+187303@code.launchpad.net

Commit message

If we aren't in a multi-seat environment, pass logind XDG_VTNR=0 instead of 1 when using surfaceflinger.

Description of the change

If we aren't in a multi-seat environment, pass logind XDG_VTNR=0 instead of 1 when using surfaceflinger.

Logind treats VT numbers very differently depending on whether it determines it is in a multi-seat environment. If we are multi-seat, it does things "normally". But if we aren't, then it only accepts VTNR=0 and rejects anything else. It will assume whatever session it has is active.

Our previous solution was designed and tested on a mako device, which has CONFIG_VT=y (and thus has a /dev/tty0 device, and thus logind thinks is multi-seat). Oddly enough, it doesn't actually have working switching VTs. It just is stuck on VT1. Which is why we originally forced VTNR=1 for logind.

But maguro has CONFIG_VT=n, which stops /dev/tty0 from appearing. Which puts logind in a completely different code path that requires VTNR=0. So this branch detects which mode we are in, and passes the right VTNR for logind's benefit.

Tested on both mako and maguro devices.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

This is slightly time-sensitive, as this is blocking lightdm landing in Ubuntu Touch.

So Robert, if you don't like something in this branch, could you please fix directly if it's simple, rather than going back and forth. And a release, even if just for this, would be welcome.

lp:~mterry/lightdm/multi-seat-vt-0 updated
1799. By Michael Terry

Same logic for normal session

Revision history for this message
Michael Terry (mterry) wrote :

Guh! I am so frazzled, I accidentally pushed this branch to trunk. (If we have autolanding turned on, maybe we should guard trunk so we can't make these mistakes...) I'll leave it there rather than overwriting or reverting immediately, until you review this.

Revision history for this message
Michael Terry (mterry) wrote :

(And to be clear, the code I pushed to trunk -- i.e. this branch including r1799) was tested on both devices and works to my knowledge.)

Revision history for this message
Michael Terry (mterry) wrote :

cwayne also tested on his maguro and it worked.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

No problem having behaviour changes in seat-surfaceflinger - this is only used by the phone so if it works go for it.

The name 'vt_can_multi_seat' is a bit odd, since it's not clear to me what the check does and how it relates to multi-seat support. I'm guessing it's actually checking (indirectly) something like vt_support_is_available()? Not going to block on the naming though.

review: Approve
Revision history for this message
Michael Terry (mterry) wrote :

I stole the terms from logind. It's basically asking "can I switch VTs?"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/seat-surfaceflinger.c'
2--- src/seat-surfaceflinger.c 2013-09-19 17:23:31 +0000
3+++ src/seat-surfaceflinger.c 2013-09-24 17:32:52 +0000
4@@ -13,6 +13,7 @@
5
6 #include "seat-surfaceflinger.h"
7 #include "surfaceflinger-server.h"
8+#include "vt.h"
9
10 G_DEFINE_TYPE (SeatSurfaceflinger, seat_surfaceflinger, SEAT_TYPE);
11
12@@ -48,7 +49,7 @@
13 session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
14
15 /* Fake the VT */
16- session_set_env (SESSION (greeter_session), "XDG_VTNR", "1");
17+ session_set_env (SESSION (greeter_session), "XDG_VTNR", vt_can_multi_seat() ? "1" : "0");
18
19 return greeter_session;
20 }
21
22=== modified file 'src/vt.c'
23--- src/vt.c 2012-06-05 04:25:47 +0000
24+++ src/vt.c 2013-09-24 17:32:52 +0000
25@@ -36,6 +36,20 @@
26 return fd;
27 }
28
29+gboolean
30+vt_can_multi_seat (void)
31+{
32+ /* Quick check to see if we can multi seat. This is intentionally the
33+ same check logind does, just without actually reading from the files.
34+ Existence will prove whether we have CONFIG_VT built into the kernel.
35+ (Reading /dev/console like the rest of the code in this file isn't
36+ sufficient -- it may still exist if tty0 doesn't and it may not work
37+ in situations where tty0 does exist and thus logind will think we are
38+ multi seat.) */
39+ return access ("/dev/tty0", F_OK) == 0 &&
40+ access ("/sys/class/tty/tty0/active", F_OK) == 0;
41+}
42+
43 gint
44 vt_get_active (void)
45 {
46
47=== modified file 'src/vt.h'
48--- src/vt.h 2013-04-23 03:07:03 +0000
49+++ src/vt.h 2013-09-24 17:32:52 +0000
50@@ -14,6 +14,8 @@
51
52 #include <glib-object.h>
53
54+gboolean vt_can_multi_seat (void);
55+
56 gint vt_get_active (void);
57
58 gint vt_get_unused (void);

Subscribers

People subscribed via source and target branches