From owner-svn-src-head@FreeBSD.ORG Thu May 29 14:39:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F30BE5E9; Thu, 29 May 2014 14:39:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C723920FC; Thu, 29 May 2014 14:39:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4TEdPrZ039252; Thu, 29 May 2014 14:39:25 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4TEdPa5039250; Thu, 29 May 2014 14:39:25 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201405291439.s4TEdPa5039250@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 29 May 2014 14:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266839 - head/usr.sbin/kbdcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2014 14:39:26 -0000 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 #include #include +#include #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/"