uterm: vt: reset KBMODE to K_UNICODE if it was K_OFF
authorDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 9 Oct 2012 11:10:02 +0000 (13:10 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 9 Oct 2012 11:10:02 +0000 (13:10 +0200)
If we switch to a VT that has KBMODE set to K_OFF, we do not set it back
to K_OFF when leaving, instead, we set it to K_UNICODE. This allows
recovering when kmscon died by simply restarting kmscon.

There is really no need to let a VT stay in K_OFF! This causes the user to
be stuck at this VT and use the sysrq (if enabled) keys to recover.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/uterm_vt.c

index 53e91df..433c6be 100644 (file)
@@ -330,6 +330,12 @@ static int real_open(struct uterm_vt *vt, const char *vt_for_seat0)
                goto err_setmode;
        }
 
+       log_debug("previous VT KBMODE was %d", vt->real_kbmode);
+       if (vt->real_kbmode == K_OFF) {
+               log_warning("VT KBMODE was K_OFF, using K_UNICODE instead");
+               vt->real_kbmode = K_UNICODE;
+       }
+
        ret = ioctl(vt->real_fd, KDSKBMODE, K_OFF);
        if (ret) {
                log_error("cannot set VT KBMODE to K_OFF (%d): %m", errno);