[PATCH 2/8] tty: Log error if we cannot setup a valid tty keyboard mode

Rob Bradford robert.bradford at intel.com
Tue Oct 9 10:44:30 PDT 2012


From: Rob Bradford <rob at linux.intel.com>

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 <rob at linux.intel.com>
---
 src/tty.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/tty.c b/src/tty.c
index 72f8fac..6d58aa5 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");
-- 
1.7.11.2



More information about the wayland-devel mailing list