[PATCH 1/1] weston-launch: alter tty command line parameter semantics
Alex DAMIAN
alexandru.damian at intel.com
Wed Oct 2 11:20:33 PDT 2013
From: Alexandru DAMIAN <alexandru.damian at intel.com>
Current behaviour of the tty parameter is to take effect
only if there is a new user starting up.
Since it is useful to start weston-launch with a command line
specified tty, I'm changing the semantics of the tty parameter:
* the argument to the --tty parameter is now mandatory
* if specified, weston-launch will try to run on the specified tty
* otherwise, it will continue to try to find the first free console
This patch allows starting weston-launch over a ssh connection,
for example, with the current user.
Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
src/weston-launch.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/weston-launch.c b/src/weston-launch.c
index 1b560af..94be876 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -466,14 +466,10 @@ setup_tty(struct weston_launch *wl, const char *tty)
struct vt_mode mode = { 0 };
char *t;
- if (!wl->new_user) {
+ if (tty) {
+ wl->tty = open(tty, O_RDWR | O_NOCTTY);
+ } else if (!wl->new_user) {
wl->tty = STDIN_FILENO;
- } else if (tty) {
- t = ttyname(STDIN_FILENO);
- if (t && strcmp(t, tty) == 0)
- wl->tty = STDIN_FILENO;
- else
- wl->tty = open(tty, O_RDWR | O_NOCTTY);
} else {
int tty0 = open("/dev/tty0", O_WRONLY | O_CLOEXEC);
char filename[16];
@@ -497,7 +493,7 @@ setup_tty(struct weston_launch *wl, const char *tty)
error(1, errno, "stat %s failed", tty);
if (major(buf.st_rdev) != TTY_MAJOR)
- error(1, 0, "invalid tty device: %s", tty);
+ error(1, 0, "invalid tty device: %s ", ttyname(wl->tty));
wl->ttynr = minor(buf.st_rdev);
}
@@ -631,7 +627,7 @@ main(int argc, char *argv[])
memset(&wl, 0, sizeof wl);
- while ((c = getopt_long(argc, argv, "u:t::vh", opts, &i)) != -1) {
+ while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) {
switch (c) {
case 'u':
wl.new_user = optarg;
--
1.8.1.2
More information about the wayland-devel
mailing list