Module Name:    src
Committed By:   martin
Date:           Fri Dec 13 12:05:11 UTC 2019

Modified Files:
        src/usr.sbin/sysinst: wskbd.c

Log Message:
Do not try to change the keyboard layout if we are not running on the
console.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/wskbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/wskbd.c
diff -u src/usr.sbin/sysinst/wskbd.c:1.3 src/usr.sbin/sysinst/wskbd.c:1.4
--- src/usr.sbin/sysinst/wskbd.c:1.3	Sat Jun 22 20:46:07 2019
+++ src/usr.sbin/sysinst/wskbd.c	Fri Dec 13 12:05:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wskbd.c,v 1.3 2019/06/22 20:46:07 christos Exp $	*/
+/*	$NetBSD: wskbd.c,v 1.4 2019/12/13 12:05:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: wskbd.c,v 1.3 2019/06/22 20:46:07 christos Exp $");
+__RCSID("$NetBSD: wskbd.c,v 1.4 2019/12/13 12:05:11 martin Exp $");
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -93,6 +93,13 @@ get_kb_encoding(void)
 	menu_ent opt[__arraycount(kb_types)];
 	const char *dflt = msg_string(MSG_kb_default);
 
+	/*
+	 * Check if we are running on a wscons keyboard at all,
+	 * do not bother to try changing the layout if not.
+	 */
+	if (ioctl(0, WSKBDIO_GTYPE,  &i) == -1)
+		return;
+
 	memset(opt, 0, sizeof(opt));
 	fd = open("/dev/wskbd0", O_WRONLY);
 	if (fd < 0)

Reply via email to