Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 May 2014 14:39:25 +0000 (UTC)
From:      Aleksandr Rybalko <ray@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266839 - head/usr.sbin/kbdcontrol
Message-ID:  <201405291439.s4TEdPa5039250@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ray
Date: Thu May 29 14:39:25 2014
New Revision: 266839
URL: http://svnweb.freebsd.org/changeset/base/266839

Log:
  Enable kbdcontrol(1) to use maps from vt(4) keymaps dir /usr/share/vt/keymaps
  if vt(4) is present.
  
  MFC after:	7 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.c
  head/usr.sbin/kbdcontrol/path.h

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c
==============================================================================
--- head/usr.sbin/kbdcontrol/kbdcontrol.c	Thu May 29 13:41:07 2014	(r266838)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.c	Thu May 29 14:39:25 2014	(r266839)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <fcntl.h>
 #include <sys/kbio.h>
 #include <sys/consio.h>
+#include <sys/sysctl.h>
 #include "path.h"
 #include "lex.h"
 
@@ -141,6 +142,17 @@ static void	set_keyrates(char *opt);
 static void	show_kbd_info(void);
 static void	usage(void) __dead2;
 
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+
+	if (sysctlbyname("kern.vt.deadtimer", NULL, NULL, NULL, 0) == 0)
+		return (1);
+
+	return (0);
+}
+
 static char *
 nextarg(int ac, char **av, int *indp, int oc)
 {
@@ -785,10 +797,13 @@ load_keymap(char *opt, int dumponly)
 	FILE	*fd;
 	int	i, j;
 	char	*name, *cp;
-	char	blank[] = "", keymap_path[] = KEYMAP_PATH, dotkbd[] = ".kbd";
+	char	blank[] = "", keymap_path[] = KEYMAP_PATH;
+	char	vt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = ".kbd";
 	char	*prefix[]  = {blank, blank, keymap_path, NULL};
 	char	*postfix[] = {blank, dotkbd, NULL};
 
+	if (is_vt4())
+		prefix[2] = vt_keymap_path;
 	cp = getenv("KEYMAP_PATH");
 	if (cp != NULL)
 		asprintf(&(prefix[0]), "%s/", cp);

Modified: head/usr.sbin/kbdcontrol/path.h
==============================================================================
--- head/usr.sbin/kbdcontrol/path.h	Thu May 29 13:41:07 2014	(r266838)
+++ head/usr.sbin/kbdcontrol/path.h	Thu May 29 14:39:25 2014	(r266839)
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
 #define KEYMAP_PATH	"/usr/share/syscons/keymaps/"
 #define FONT_PATH	"/usr/share/syscons/fonts/"
 #define SCRNMAP_PATH	"/usr/share/syscons/scrnmaps/"
 
+#define VT_KEYMAP_PATH	"/usr/share/vt/keymaps/"
+#define VT_FONT_PATH	"/usr/share/vt/fonts/"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405291439.s4TEdPa5039250>