Weston might not run on CONFIG_VT=0 systems
Hi
I am looking at where seat0 is hardcoded for Weston as to where VTs are enabled. While all TTYs are in seat0, not all seat0 s have TTYs.
I don't have a CONFIG_VT=0 box to test on...
while in libweston/launcher-logind.c I can do something along the lines of
diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index 9b3c52fa..4811530c 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -767,7 +767,7 @@ launcher_logind_connect(struct weston_launcher **out, struct weston_compositor *
goto err_session;
}
- r = strcmp(t, "seat0");
+ r = sd_seat_can_tty(t);
free(t);
if (r == 0) {
r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
I am not sure about libweston/launcher-direct.c I am thinking something along the lines of
index c20d70f2..e994d2a2 100644
--- a/libweston/launcher-direct.c
+++ b/libweston/launcher-direct.c
@@ -289,6 +289,7 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
int tty, const char *seat_id, bool sync_drm)
{
struct launcher_direct *launcher;
+ struct stat buf;
if (geteuid() != 0)
return -EINVAL;
@@ -300,7 +301,8 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
launcher->base.iface = &launcher_direct_iface;
launcher->compositor = compositor;
- if (strcmp("seat0", seat_id) == 0) {
+ if (strcmp("seat0", seat_id) == 0 &&
+ fstat("/dev/tty0", &buf) && major(buf.st_rdev) == TTY_MAJOR) {
if (setup_tty(launcher, tty) == -1) {
free(launcher);
return -1;
because libweston/launcher-direct.c is more generic seeming, and I only grepped for seat0
, so not sure if I can call sd_seat_can_tty
from there...
Thanks