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
This commit is contained in:
ray 2014-05-29 14:39:25 +00:00
parent c5a7ba7016
commit afb34ab59c
2 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -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/"