Remove kbd_mode

We only built this on BSD and Solaris, and if such a tool is generally
useful, ship it with the OS.
This commit is contained in:
Daniel Stone 2008-07-24 02:40:02 +03:00
parent 0d785bd635
commit 8c05183790
7 changed files with 0 additions and 426 deletions

View File

@ -1806,29 +1806,6 @@ fi
AM_CONDITIONAL(BUILD_XORGCFG, [test x$XORGCFG = xyes])
AM_CONDITIONAL(USE_CURSES, [test x$CURSES = xyes])
AC_ARG_ENABLE(kbd_mode, AS_HELP_STRING([--enable-kbd_mode],
[Build kbd_mode utility (default: auto)]),
[BUILD_KBD_MODE=$enable_val], [BUILD_KBD_MODE="auto"])
if test x$BUILD_KBD_MODE != xno ; then
case $host_os in
*bsd*)
KBD_MODE_TYPE="bsd"
# BUILD_KBD_MODE="yes" # need to test on BSD before enabling
# by default
;;
solaris*)
KBD_MODE_TYPE="sun"
BUILD_KBD_MODE="yes" # enabled by default
;;
*)
BUILD_KBD_MODE="no" # disabled by default
;;
esac
fi
AM_CONDITIONAL(BUILD_KBD_MODE, [test x$BUILD_KBD_MODE = xyes])
AM_CONDITIONAL(BSD_KBD_MODE, [test x$KBD_MODE_TYPE = xbsd])
AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD_MODE_TYPE = xsun])
BUILD_DATE="$(date +'%Y%m%d')"
AC_SUBST([BUILD_DATE])
BUILD_TIME="$(date +'1%H%M%S')"
@ -1912,7 +1889,6 @@ hw/xfree86/utils/Makefile
hw/xfree86/utils/cvt/Makefile
hw/xfree86/utils/gtf/Makefile
hw/xfree86/utils/ioport/Makefile
hw/xfree86/utils/kbd_mode/Makefile
hw/xfree86/utils/xorgcfg/Makefile
hw/dmx/config/Makefile
hw/dmx/doc/Makefile

View File

@ -2,5 +2,4 @@ SUBDIRS = \
gtf \
cvt \
ioport \
kbd_mode \
xorgcfg

View File

@ -1,69 +0,0 @@
#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, provided that the above
# copyright notice(s) and this permission notice appear in all copies of
# the Software and that both the above copyright notice(s) and this
# permission notice appear in supporting documentation.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Except as contained in this notice, the name of a copyright holder
# shall not be used in advertising or otherwise to promote the sale, use
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#
if BUILD_KBD_MODE
bin_PROGRAMS = kbd_mode
if BSD_KBD_MODE
INCLUDES = $(XORG_INCS)
kbd_mode_CFLAGS = $(XORG_CFLAGS)
kbd_mode_SOURCES = bsd-kbd_mode.c
MAN_SRC = bsd-kbd_mode.man.pre
endif
if SUN_KBD_MODE
kbd_mode_SOURCES = sun-kbd_mode.c
MAN_SRC = sun-kbd_mode.man.pre
endif
appmandir = $(APP_MAN_DIR)
appman_PRE = kbd_mode.man
appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
BUILT_SOURCES = $(appman_PRE)
CLEANFILES = $(appman_PRE) $(appman_DATA)
all-local: kbd_mode.man.pre $(appman_DATA)
kbd_mode.man.pre: $(MAN_SRC)
$(LN_S) $(MAN_SRC) kbd_mode.man.pre
else
all-local:
endif
include $(top_srcdir)/cpprules.in
SUFFIXES += .$(APP_MAN_SUFFIX) .man
.man.$(APP_MAN_SUFFIX):
-rm -f $@
$(LN_S) $< $@
EXTRA_DIST = bsd-kbd_mode.man.pre sun-kbd_mode.man.pre

View File

@ -1,91 +0,0 @@
/* Keyboard mode control program for 386BSD */
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <X11/X.h>
#include "input.h"
#include "scrnintstr.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
static int fd;
void
msg (char* s)
{
perror (s);
close (fd);
exit (-1);
}
int
main(int argc, char** argv)
{
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
vtmode_t vtmode;
#endif
Bool syscons = FALSE;
if ((fd = open("/dev/vga",O_RDONLY,0)) <0)
msg ("Cannot open /dev/vga");
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
/* Check if syscons */
if (ioctl(fd, VT_GETMODE, &vtmode) >= 0)
syscons = TRUE;
#endif
if (0 == strcmp (argv[1], "-u"))
{
if (syscons)
{
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
ioctl (fd, KDSKBMODE, K_RAW);
#endif
}
else
{
if (ioctl (fd, CONSOLE_X_MODE_ON, 0) < 0)
{
close (fd);
exit (0); /* Assume codrv, so nothing to do */
}
}
}
else if (0 == strcmp (argv[1], "-a"))
{
if (syscons)
{
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
ioctl (fd, KDSKBMODE, K_XLATE);
#endif
}
else
{
if (ioctl (fd, CONSOLE_X_MODE_OFF, 0) < 0)
{
close (fd);
exit (0); /* Assume codrv, so nothing to do */
}
}
}
else
{
close (fd);
fprintf (stderr,"Usage: %s [-u|-a]\n",argv[0]);
fprintf (stderr,"-u for sending up down key events in x mode.\n");
fprintf (stderr,"-a for sending ascii keys in normal use.\n");
exit (-1);
}
close (fd);
exit (0);
}

View File

@ -1,36 +0,0 @@
.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man,v 3.4 1998/04/05 02:28:42 dawes Exp $
.TH KBD_MODE 1 __vendorversion__
.SH NAME
kbd_mode \- recover the PC console keyboard
.SH SYNOPSIS
.B kbd_mode
[ -a -u ]
.SH DESCRIPTION
.I Kbd_mode
resets the PC console keyboard to a rational state.
.SH OPTIONS
The following options are supported:
.TP 8
.B \-a
Set the keyboard so that ASCII characters are read from the console.
.TP 8
.B \-u
Set the keyboard so that undecoded keyboard values are read from the
console.
.SH EXAMPLES
If the server crashes or otherwise fails to put the keyboard back in
ascii mode when it exits, it can leave your keyboard dead. If you are
able to login remotely, you can reset it typing:
.sp
kbd_mode -a
.sp
.PP
Conversely, changing the keyboard to ascii mode while the server is
running will make the keyboard appear to be dead while the the mouse
continues to work. Again, if you are able to login remotely, you can
reset it typing:
.sp
kbd_mode -u
.sp
.\" $TOG: kbd_mode.man /main/6 1997/07/19 10:37:14 kaleb $

View File

@ -1,152 +0,0 @@
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
All Rights Reserved
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright no-
tice appear in all copies and that both that copyright no-
tice and this permission notice appear in supporting docu-
mentation, and that the names of Sun or The Open Group
not be used in advertising or publicity pertaining to
distribution of the software without specific prior
written permission. Sun and The Open Group make no
representations about the suitability of this software for
any purpose. It is provided "as is" without any express or
implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/*
static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
*/
/*
* Copyright 1986 by Sun Microsystems, Inc.
*
* kbd_mode: set keyboard encoding mode
*/
#include <sys/types.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#if defined(SVR4) || defined(__SVR4) || defined(__bsdi__)
#include <fcntl.h>
#ifndef __bsdi__
#include <sys/kbio.h>
#include <sys/kbd.h>
#else
#include <unistd.h>
#include </sys/sparc/dev/kbio.h>
#include </sys/sparc/dev/kbd.h>
#endif
#else
#ifndef CSRG_BASED
#include <sundev/kbio.h>
#include <sundev/kbd.h>
#else
#include <machine/kbio.h>
#include <machine/kbd.h>
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static void die(char*);
static void usage(void);
static int kbd_fd;
int
main(argc, argv)
int argc;
char** argv;
{
int code = 0, translate, direct = -1;
char led;
int click;
if ((kbd_fd = open("/dev/kbd", O_RDONLY, 0)) < 0) {
die("Couldn't open /dev/kbd");
}
argc--; argv++;
if (argc-- && **argv == '-') {
code = *(++*argv);
} else {
usage();
}
switch (code) {
case 'a':
case 'A':
translate = TR_ASCII;
direct = 0;
break;
case 'e':
case 'E':
translate = TR_EVENT;
break;
case 'n':
case 'N':
translate = TR_NONE;
break;
case 'u':
case 'U':
translate = TR_UNTRANS_EVENT;
break;
default:
usage();
}
#ifdef KIOCSLED
led = 0;
if (ioctl(kbd_fd, KIOCSLED, &led))
die("Couldn't set LEDs");
#endif
#ifdef KIOCCMD
click = KBD_CMD_NOCLICK;
if (ioctl(kbd_fd, KIOCCMD, &click))
die("Couldn't set click");
#endif
if (ioctl(kbd_fd, KIOCTRANS, (caddr_t) &translate))
die("Couldn't set translation");
if (direct != -1 && ioctl(kbd_fd, KIOCSDIRECT, (caddr_t) &direct))
die("Couldn't set redirect");
return 0;
}
static void
die(char *msg)
{
fprintf(stderr, "%s\n", msg);
exit(1);
}
static void
usage(void)
{
int translate;
if (ioctl(kbd_fd, KIOCGTRANS, (caddr_t) &translate)) {
die("Couldn't inquire current translation");
}
fprintf(stderr, "kbd_mode {-a | -e | -n | -u }\n");
fprintf(stderr, "\tfor ascii, encoded (normal) SunView events,\n");
fprintf(stderr, " \tnon-encoded, or unencoded SunView events, resp.\n");
fprintf(stderr, "Current mode is %s.\n",
( translate == 0 ? "n (non-translated bytes)" :
( translate == 1 ? "a (ascii bytes)" :
( translate == 2 ? "e (encoded events)" :
/* translate == 3 */ "u (unencoded events)"))));
exit(1);
}

View File

@ -1,53 +0,0 @@
.\" $Xorg: kbd_mode.man,v 1.4 2001/02/09 02:04:43 xorgcvs Exp $
.\" Copyright 1987 Sun Microsystems, Inc.
.\" Copyright 1993, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\"
.\" $XFree86: xc/programs/Xserver/hw/sun/kbd_mode.man,v 1.6 2001/01/27 18:20:41 dawes Exp $
.\"
.TH KBD_MODE 1 __xorgversion__
.SH NAME
kbd_mode \- recover the Sun console keyboard
.SH SYNOPSIS
.B kbd_mode
[ -a -e -n -u ]
.SH DESCRIPTION
.I Kbd_mode
resets the Sun console keyboard to a rational state.
.SH OPTIONS
The following options are supported, see \fIkb(4S)\fP for details:
.TP 8
.B \-a
Causes ASCII to be reported.
.TP 8
.B \-e
Causes \fIFirm_events\fP to be reported.
.TP 8
.B \-n
Causes up/down key codes to be reported.
.TP 8
.B \-u
Causes undecoded keyboard values to be reported.
.SH SEE ALSO
kb(4S)