Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Aug 2014 21:57:19 +0000 (UTC)
From:      Stefan Esser <se@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r270309 - stable/10/usr.sbin/kbdmap
Message-ID:  <201408212157.s7LLvJcX011048@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: se
Date: Thu Aug 21 21:57:18 2014
New Revision: 270309
URL: http://svnweb.freebsd.org/changeset/base/270309

Log:
  MFC 269976.
  
  	Add support for NEWCONS to kbdmap and vidfont.

Modified:
  stable/10/usr.sbin/kbdmap/kbdmap.c
  stable/10/usr.sbin/kbdmap/kbdmap.h

Modified: stable/10/usr.sbin/kbdmap/kbdmap.c
==============================================================================
--- stable/10/usr.sbin/kbdmap/kbdmap.c	Thu Aug 21 21:53:43 2014	(r270308)
+++ stable/10/usr.sbin/kbdmap/kbdmap.c	Thu Aug 21 21:57:18 2014	(r270309)
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <sys/queue.h>
+#include <sys/sysctl.h>
 
 #include <assert.h>
 #include <ctype.h>
@@ -47,10 +48,10 @@ static const char *lang_default = DEFAUL
 static const char *font;
 static const char *lang;
 static const char *program;
-static const char *keymapdir = DEFAULT_KEYMAP_DIR;
-static const char *fontdir = DEFAULT_FONT_DIR;
+static const char *keymapdir = DEFAULT_VT_KEYMAP_DIR;
+static const char *fontdir = DEFAULT_VT_FONT_DIR;
+static const char *font_default = DEFAULT_VT_FONT;
 static const char *sysconfig = DEFAULT_SYSCONFIG;
-static const char *font_default = DEFAULT_FONT;
 static const char *font_current;
 static const char *dir;
 static const char *menu = "";
@@ -146,6 +147,22 @@ add_keymap(const char *desc, int mark, c
 }
 
 /*
+ * Return 0 if syscons is in use (to select legacy defaults).
+ */
+static int
+check_newcons(void)
+{
+	size_t len;
+	char term[3];
+
+	len = 3;
+	if (sysctlbyname("kern.vty", &term, &len, NULL, 0) != 0 ||
+	    strcmp(term, "vt") != 0)
+		return 0;
+	return -1;
+}
+
+/*
  * Figure out the default language to use.
  */
 static const char *
@@ -815,6 +832,12 @@ main(int argc, char **argv)
 		sleep(2);
 	}
 
+	if (check_newcons() == 0) {
+		keymapdir = DEFAULT_SC_KEYMAP_DIR;
+		fontdir = DEFAULT_SC_FONT_DIR;
+		font_default = DEFAULT_SC_FONT;
+	}
+
 	SLIST_INIT(&head);
 
 	lang = get_locale();

Modified: stable/10/usr.sbin/kbdmap/kbdmap.h
==============================================================================
--- stable/10/usr.sbin/kbdmap/kbdmap.h	Thu Aug 21 21:53:43 2014	(r270308)
+++ stable/10/usr.sbin/kbdmap/kbdmap.h	Thu Aug 21 21:57:18 2014	(r270309)
@@ -28,7 +28,12 @@
 
 
 #define DEFAULT_LANG		"en"
-#define DEFAULT_KEYMAP_DIR	"/usr/share/syscons/keymaps"
-#define DEFAULT_FONT_DIR	"/usr/share/syscons/fonts"
 #define DEFAULT_SYSCONFIG	"/etc/rc.conf"
-#define DEFAULT_FONT		"cp437-8x16.fnt"
+
+#define DEFAULT_SC_KEYMAP_DIR	"/usr/share/syscons/keymaps"
+#define DEFAULT_SC_FONT_DIR	"/usr/share/syscons/fonts"
+#define DEFAULT_SC_FONT		"cp437-8x16.fnt"
+
+#define DEFAULT_VT_KEYMAP_DIR	"/usr/share/vt/keymaps"
+#define DEFAULT_VT_FONT_DIR	"/usr/share/vt/fonts"
+#define DEFAULT_VT_FONT		"vgarom-thin-8x16.fnt"



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