Codebase list wlroots / 2baad6e
backend/session: Allow setting a custom tty via WLR_DIRECT_TTY Niklas Schulze authored 5 years ago emersion committed 5 years ago
2 changed file(s) with 14 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
154154 }
155155
156156 static bool setup_tty(struct direct_session *session, struct wl_display *display) {
157 int fd = open("/dev/tty", O_RDWR | O_CLOEXEC);
157
158 bool default_tty = false;
159
160 const char *tty_path = getenv("WLR_DIRECT_TTY");
161
162 if (!tty_path) {
163 tty_path = "/dev/tty";
164 default_tty = true;
165 }
166
167 int fd = open(tty_path, O_RDWR | O_CLOEXEC);
158168 if (fd == -1) {
159 wlr_log_errno(WLR_ERROR, "Cannot open /dev/tty");
169 wlr_log_errno(WLR_ERROR, "Cannot open %s", tty_path);
160170 return false;
161171 }
162172
175185 goto error;
176186 }
177187
178 if (kd_mode != KD_TEXT) {
188 if (default_tty && kd_mode != KD_TEXT) {
179189 wlr_log(WLR_ERROR,
180190 "tty already in graphics mode; is another display server running?");
181191 goto error;
1919 hardware cursors
2020 * *WLR_SESSION*: specifies the wlr\_session to be used (available sessions:
2121 logind/systemd, direct)
22 * *WLR_DIRECT_TTY*: specifies the tty to be used (instead of using /dev/tty)
2223
2324 rootston specific
2425 ------------------