From 592c07a6b9b0fa0caedc9fc67dec8ff0027399f4 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 9 Oct 2012 18:44:30 +0100 Subject: [PATCH] tty: Log error if we cannot setup a valid tty keyboard mode The previous logging code would never be reached - this change makes sure a message is reported if changing keyboard mode to either the desired (K_OFF) or fallback (K_RAW with handler that drops the events) fails. Signed-off-by: Rob Bradford --- src/tty.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/tty.c b/src/tty.c index 72f8face..6d58aa5c 100644 --- a/src/tty.c +++ b/src/tty.c @@ -199,8 +199,10 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, ret = ioctl(tty->fd, KDSKBMODE, K_OFF); if (ret) { ret = ioctl(tty->fd, KDSKBMODE, K_RAW); - if (ret) + if (ret) { + weston_log("failed to set keyboard mode on tty: %m\n"); goto err_attr; + } tty->input_source = wl_event_loop_add_fd(loop, tty->fd, WL_EVENT_READABLE, @@ -209,11 +211,6 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, goto err_kdkbmode; } - if (ret) { - weston_log("failed to set K_OFF keyboard mode on tty: %m\n"); - goto err_attr; - } - ret = ioctl(tty->fd, KDSETMODE, KD_GRAPHICS); if (ret) { weston_log("failed to set KD_GRAPHICS mode on tty: %m\n");