summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-11-02 03:21:37 +0200
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-11-02 03:21:37 +0200
commit18c246a13b887b865de6a17e6cd1c259b9bc383d (patch)
treef63590987fc40f49aea519a42f4d8c4af3b01c3f /hw/xfree86
parent794f2e7291ccb4e48f9fbfc8f08302e3aac0f79f (diff)
parent4843d823f4d38d8bd468ce3a8feddbff229ed416 (diff)
Merge branch 'input-hotplug'
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/Makefile.am11
-rw-r--r--hw/xfree86/common/Makefile.am12
-rw-r--r--hw/xfree86/common/xf86Config.c348
-rw-r--r--hw/xfree86/common/xf86Configure.c6
-rw-r--r--hw/xfree86/common/xf86Cursor.c9
-rw-r--r--hw/xfree86/common/xf86DGA.c48
-rw-r--r--hw/xfree86/common/xf86Debug.c2
-rw-r--r--hw/xfree86/common/xf86Events.c785
-rw-r--r--hw/xfree86/common/xf86Globals.c39
-rw-r--r--hw/xfree86/common/xf86Helper.c28
-rw-r--r--hw/xfree86/common/xf86InPriv.h3
-rw-r--r--hw/xfree86/common/xf86Init.c118
-rw-r--r--hw/xfree86/common/xf86Io.c470
-rw-r--r--hw/xfree86/common/xf86Kbd.c394
-rw-r--r--hw/xfree86/common/xf86KbdBSD.c1265
-rw-r--r--hw/xfree86/common/xf86KbdLnx.c650
-rw-r--r--hw/xfree86/common/xf86KbdMach.c316
-rw-r--r--hw/xfree86/common/xf86MiscExt.c78
-rw-r--r--hw/xfree86/common/xf86Module.h2
-rw-r--r--hw/xfree86/common/xf86Option.c4
-rw-r--r--hw/xfree86/common/xf86Priv.h17
-rw-r--r--hw/xfree86/common/xf86Privstr.h49
-rw-r--r--hw/xfree86/common/xf86Versions.c3
-rw-r--r--hw/xfree86/common/xf86Xinput.c1421
-rw-r--r--hw/xfree86/common/xf86Xinput.h41
-rw-r--r--hw/xfree86/loader/misym.c2
-rw-r--r--hw/xfree86/loader/xf86sym.c11
-rw-r--r--hw/xfree86/os-support/Makefile.am2
-rw-r--r--hw/xfree86/os-support/bsd/Makefile.am7
-rw-r--r--hw/xfree86/os-support/bsd/bsd_KbdMap.c1087
-rw-r--r--hw/xfree86/os-support/bsd/bsd_bell.c81
-rw-r--r--hw/xfree86/os-support/bsd/bsd_io.c293
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.c572
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.h4
-rw-r--r--hw/xfree86/os-support/drm/xf86drm.c955
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am6
-rw-r--r--hw/xfree86/os-support/linux/lnx_KbdMap.c606
-rw-r--r--hw/xfree86/os-support/linux/lnx_bell.c43
-rw-r--r--hw/xfree86/os-support/linux/lnx_io.c246
-rw-r--r--hw/xfree86/os-support/linux/lnx_kbd.c530
-rw-r--r--hw/xfree86/os-support/linux/lnx_kbd.h4
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_io.c165
-rw-r--r--hw/xfree86/os-support/sco/Makefile.am4
-rw-r--r--hw/xfree86/os-support/sco/sco_KbdMap.c304
-rw-r--r--hw/xfree86/os-support/sco/sco_io.c268
-rw-r--r--hw/xfree86/os-support/sco/sco_kbd.c530
-rw-r--r--hw/xfree86/os-support/sco/sco_kbd.h20
-rw-r--r--hw/xfree86/os-support/shared/at_scancode.c131
-rw-r--r--hw/xfree86/os-support/shared/kbd.c38
-rw-r--r--hw/xfree86/os-support/shared/std_kbdEv.c49
-rw-r--r--hw/xfree86/os-support/shared/sysv_kbd.c105
-rw-r--r--hw/xfree86/os-support/solaris/Makefile.am8
-rw-r--r--hw/xfree86/os-support/solaris/sun_bell.c184
-rw-r--r--hw/xfree86/os-support/solaris/sun_io.c159
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbd.c660
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbd.h72
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbdEv.c854
-rw-r--r--hw/xfree86/os-support/sysv/Makefile.am2
-rw-r--r--hw/xfree86/os-support/sysv/sysv_io.c77
-rw-r--r--hw/xfree86/os-support/sysv/sysv_mouse.c3
-rw-r--r--hw/xfree86/os-support/sysv/xqueue.c536
-rw-r--r--hw/xfree86/os-support/sysv/xqueue.h12
-rw-r--r--hw/xfree86/os-support/usl/Makefile.am8
-rw-r--r--hw/xfree86/os-support/usl/usl_KbdMap.c304
-rw-r--r--hw/xfree86/os-support/usl/usl_io.c171
-rw-r--r--hw/xfree86/os-support/usl/usl_kbd.c455
-rw-r--r--hw/xfree86/os-support/usl/usl_kbd.h14
-rw-r--r--hw/xfree86/os-support/usl/usl_mouse.c7
-rw-r--r--hw/xfree86/os-support/usl/usl_xqueue.c360
-rw-r--r--hw/xfree86/os-support/usl/usl_xqueue.h9
-rw-r--r--hw/xfree86/os-support/xf86OSKbd.h132
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h9
-rw-r--r--hw/xfree86/os-support/xf86_OSproc.h19
-rw-r--r--hw/xfree86/os-support/xf86drm.h1
-rw-r--r--hw/xfree86/os-support/xf86mm.h210
-rw-r--r--hw/xfree86/parser/Input.c5
-rw-r--r--hw/xfree86/parser/Keyboard.c308
-rw-r--r--hw/xfree86/parser/Makefile.am1
-rw-r--r--hw/xfree86/parser/configProcs.h2
-rw-r--r--hw/xfree86/parser/read.c7
-rw-r--r--hw/xfree86/utils/xorgcfg/interface.c3
-rw-r--r--hw/xfree86/utils/xorgcfg/keyboard-cfg.c7
-rw-r--r--hw/xfree86/utils/xorgcfg/mouse-cfg.c3
-rw-r--r--hw/xfree86/utils/xorgcfg/text-mode.c14
-rw-r--r--hw/xfree86/utils/xorgconfig/xorgconfig.c21
-rw-r--r--hw/xfree86/xorgconf.cpp14
86 files changed, 1970 insertions, 14863 deletions
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 79d2ec5c0..72befea19 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -58,12 +58,15 @@ Xorg_LDADD = $(XORG_LIBS) \
Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+BUILT_SOURCES = xorg.conf.example
+CLEAN = xorg.conf.example xorg.conf.example.pre
+EXTRA_DIST = xorgconf.cpp
if SOLARIS_ASM_INLINE
# Needs to be built before any files are compiled when using Sun compilers
# so in*/out* inline definitions are properly processed.
-BUILT_SOURCES = os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
+BUILT_SOURCES += os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il:
cd os-support/solaris ; make solaris-$(SOLARIS_INOUT_ARCH).il
@@ -84,10 +87,6 @@ endif
optionsdir = $(libdir)/X11
dist_options_DATA = Options
-BUILT_SOURCES = xorg.conf.example
-CLEAN = xorg.conf.example xorg.conf.example.pre
-EXTRA_DIST = xorgconf.cpp
-
CPP_FILES_FLAGS = \
-DRGBPATH=\"$(RGB_DB)\" \
-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
@@ -103,4 +102,4 @@ relink:
rm -f Xorg && $(MAKE) Xorg
xorg.conf.example.pre: xorgconf.cpp
- cp $< $@
+ cp $(srcdir)/xorgconf.cpp $@
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index d983ee9cc..57493f31f 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -21,8 +21,6 @@ RANDRSOURCES = xf86RandR.c
BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
-KBDSOURCES = xf86Kbd@XORG_OS_KBD@.c
-
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
xf86DefModeSet.c: $(srcdir)/modeline2c.pl $(MODEDEFSOURCES)
@@ -34,14 +32,13 @@ AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
xf86DoProbe.c xf86DoScanPci.c xf86Events.c \
- xf86Globals.c xf86Io.c xf86AutoConfig.c \
+ xf86Globals.c xf86AutoConfig.c \
xf86MiscExt.c xf86Option.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
xf86Helper.c xf86PM.c \
xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
$(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \
- $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES) \
- $(KBDSOURCES)
+ $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES)
nodist_libcommon_la_SOURCES = xf86DefModeSet.c
libinit_a_SOURCES = xf86Build.h xf86Init.c
@@ -59,11 +56,6 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
-# this is a hack for now. as above we don't have rules to build all of these
-# yet, but we want to make sure they all get into the distball. this should
-# eventually go away.
-DISTKBDSOURCES = xf86Kbd.c xf86KbdBSD.c xf86KbdLnx.c xf86KbdMach.c
-
EXTRA_DIST = \
atKeynames.h \
compiler.h \
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index bff9233f8..4138eb16c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -383,18 +383,6 @@ xf86DriverlistFromConfig()
return modulearray;
}
-
-Bool
-xf86BuiltinInputDriver(const char *name)
-{
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- if (xf86NameCmp(name, "keyboard") == 0)
- return TRUE;
- else
-#endif
- return FALSE;
-}
-
char **
xf86InputDriverlistFromConfig()
{
@@ -419,8 +407,7 @@ xf86InputDriverlistFromConfig()
if (xf86ConfigLayout.inputs) {
idp = xf86ConfigLayout.inputs;
while (idp->identifier) {
- if (!xf86BuiltinInputDriver(idp->driver))
- count++;
+ count++;
idp++;
}
}
@@ -435,10 +422,8 @@ xf86InputDriverlistFromConfig()
count = 0;
idp = xf86ConfigLayout.inputs;
while (idp->identifier) {
- if (!xf86BuiltinInputDriver(idp->driver)) {
- modulearray[count] = idp->driver;
- count++;
- }
+ modulearray[count] = idp->driver;
+ count++;
idp++;
}
modulearray[count] = NULL;
@@ -762,7 +747,8 @@ typedef enum {
FLAG_HANDLE_SPECIAL_KEYS,
FLAG_RANDR,
FLAG_AIGLX,
- FLAG_IGNORE_ABI
+ FLAG_IGNORE_ABI,
+ FLAG_ALLOW_EMPTY_INPUT,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -834,6 +820,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
+ {0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
{ -1, NULL, OPTV_NONE,
@@ -1031,6 +1019,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.aiglxFrom = X_CONFIG;
}
+ xf86Info.allowEmptyInput = FALSE;
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
+ xf86Info.allowEmptyInput = TRUE;
+
/* Make sure that timers don't overflow CARD32's after multiplying */
#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
@@ -1120,304 +1112,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
/*
- * XXX This function is temporary, and will be removed when the keyboard
- * driver is converted into a regular input driver.
- */
-static Bool
-configInputKbd(IDevPtr inputp)
-{
- char *s;
- MessageType from = X_DEFAULT;
- Bool customKeycodesDefault = FALSE;
- int verb = 0;
-#if defined(XQUEUE)
- char *kbdproto = "Xqueue";
-#else
- char *kbdproto = "standard";
-#endif
-
- /* Initialize defaults */
- xf86Info.xleds = 0L;
- xf86Info.kbdDelay = 500;
- xf86Info.kbdRate = 30;
-
- xf86Info.kbdProc = NULL;
- xf86Info.vtinit = NULL;
- xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
-#if defined(SVR4) && defined(i386)
- xf86Info.panix106 = FALSE;
-#endif
- xf86Info.kbdCustomKeycodes = FALSE;
-#ifdef WSCONS_SUPPORT
- xf86Info.kbdFd = -1;
-#endif
-#ifdef XKB
- if (!xf86IsPc98()) {
- xf86Info.xkbrules = __XKBDEFRULES__;
- xf86Info.xkbmodel = "pc105";
- xf86Info.xkblayout = "us";
- xf86Info.xkbvariant = NULL;
- xf86Info.xkboptions = NULL;
- } else {
- xf86Info.xkbrules = "xfree98";
- xf86Info.xkbmodel = "pc98";
- xf86Info.xkblayout = "nec/jp";
- xf86Info.xkbvariant = NULL;
- xf86Info.xkboptions = NULL;
- }
- xf86Info.xkbcomponents_specified = FALSE;
- /* Should discourage the use of these. */
- xf86Info.xkbkeymap = NULL;
- xf86Info.xkbtypes = NULL;
- xf86Info.xkbcompat = NULL;
- xf86Info.xkbkeycodes = NULL;
- xf86Info.xkbsymbols = NULL;
- xf86Info.xkbgeometry = NULL;
-#endif
-
- s = xf86SetStrOption(inputp->commonOptions, "Protocol", kbdproto);
- if (xf86NameCmp(s, "standard") == 0) {
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86KbdEvents;
- xfree(s);
- } else if (xf86NameCmp(s, "xqueue") == 0) {
-#ifdef __UNIXWARE__
- /*
- * To retain compatibility with older config files, on UnixWare, we
- * accept the xqueue protocol but use the normal keyboard procs.
- */
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86KbdEvents;
-#else
-#ifdef XQUEUE
- xf86Info.kbdProc = xf86XqueKbdProc;
- xf86Info.kbdEvents = xf86XqueEvents;
- xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
-#endif
-#endif
- xfree(s);
-#ifdef WSCONS_SUPPORT
- } else if (xf86NameCmp(s, "wskbd") == 0) {
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86WSKbdEvents;
- xfree(s);
- s = xf86SetStrOption(inputp->commonOptions, "Device", NULL);
- xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n");
- if (s == NULL) {
- xf86ConfigError("A \"device\" option is required with"
- " the \"wskbd\" keyboard protocol");
- return FALSE;
- }
- xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL);
- if (xf86Info.kbdFd == -1) {
- xf86ConfigError("cannot open \"%s\"", s);
- xfree(s);
- return FALSE;
- }
- xfree(s);
- /* Find out keyboard type */
- if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) {
- xf86ConfigError("cannot get keyboard type");
- close(xf86Info.kbdFd);
- return FALSE;
- }
- switch (xf86Info.wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- xf86Msg(X_PROBED, "Keyboard type: XT\n");
- break;
- case WSKBD_TYPE_PC_AT:
- xf86Msg(X_PROBED, "Keyboard type: AT\n");
- break;
- case WSKBD_TYPE_USB:
- xf86Msg(X_PROBED, "Keyboard type: USB\n");
- break;
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- xf86Msg(X_PROBED, "Keyboard type: ADB\n");
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN
- case WSKBD_TYPE_SUN:
- xf86Msg(X_PROBED, "Keyboard type: Sun\n");
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
- xf86Msg(X_PROBED, "Keyboard type: Sun5\n");
- break;
-#endif
- default:
- xf86ConfigError("Unsupported wskbd type \"%d\"",
- xf86Info.wsKbdType);
- close(xf86Info.kbdFd);
- return FALSE;
- }
-#endif
- } else {
- xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s);
- xfree(s);
- return FALSE;
- }
-
- s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL);
- if (s) {
- if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) {
- xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s);
- xfree(s);
- return FALSE;
- }
- xfree(s);
- }
-
- s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL);
- if (s) {
- char *l, *end;
- unsigned int i;
- l = strtok(s, " \t\n");
- while (l) {
- i = strtoul(l, &end, 0);
- if (*end == '\0')
- xf86Info.xleds |= 1L << (i - 1);
- else {
- xf86ConfigError("\"%s\" is not a valid XLeds value", l);
- xfree(s);
- return FALSE;
- }
- l = strtok(NULL, " \t\n");
- }
- xfree(s);
- }
-
-#ifdef XKB
- from = X_DEFAULT;
- if (noXkbExtension)
- from = X_CMDLINE;
- else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) {
- xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the "
- "ServerFlags section instead\n"
- "\tof in the \"keyboard\" InputDevice section.\n");
- noXkbExtension =
- xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE);
- from = X_CONFIG;
- }
- if (noXkbExtension)
- xf86Msg(from, "XKB: disabled\n");
-
-#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL))
-
- if (!noXkbExtension) {
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) {
- xf86Info.xkbkeymap = NULL_IF_EMPTY(s);
- xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" "
- "(overrides other XKB settings)\n", xf86Info.xkbkeymap);
- } else {
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) {
- xf86Info.xkbcompat = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) {
- xf86Info.xkbtypes = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) {
- xf86Info.xkbkeycodes = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) {
- xf86Info.xkbgeometry = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) {
- xf86Info.xkbsymbols = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) {
- xf86Info.xkbrules = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) {
- xf86Info.xkbmodel = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) {
- xf86Info.xkblayout = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) {
- xf86Info.xkbvariant = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) {
- xf86Info.xkboptions = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s);
- }
- }
- }
-#undef NULL_IF_EMPTY
-#endif
-#if defined(SVR4) && defined(i386)
- if ((xf86Info.panix106 =
- xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) {
- xf86Msg(X_CONFIG, "PANIX106: enabled\n");
- }
-#endif
-
- /*
- * This was once a compile time option (ASSUME_CUSTOM_KEYCODES)
- * defaulting to 1 on Linux/PPC. It is no longer necessary, but for
- * backwards compatibility we provide 'Option "CustomKeycodes"'
- * and try to autoprobe on Linux/PPC.
- */
- from = X_DEFAULT;
- verb = 2;
-#if defined(__linux__) && defined(__powerpc__)
- {
- FILE *f;
-
- f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r");
- if (f) {
- if (fgetc(f) == '0') {
- customKeycodesDefault = TRUE;
- from = X_PROBED;
- verb = 1;
- }
- fclose(f);
- }
- }
-#endif
- if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) {
- from = X_CONFIG;
- verb = 1;
- }
- xf86Info.kbdCustomKeycodes =
- xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes",
- customKeycodesDefault);
- xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n",
- xf86Info.kbdCustomKeycodes ? "enabled" : "disabled");
-
- return TRUE;
-}
-
-/*
* Locate the core input devices. These can be specified/located in
* the following ways, in order of priority:
*
@@ -1653,10 +1347,6 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
confInput = xf86findInputByDriver("kbd",
xf86configptr->conf_input_lst);
}
- if (!confInput) {
- confInput = xf86findInputByDriver("keyboard",
- xf86configptr->conf_input_lst);
- }
if (confInput) {
foundKeyboard = TRUE;
from = X_DEFAULT;
@@ -1974,8 +1664,6 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
servlayoutp->options = conf_layout->lay_option_lst;
from = X_DEFAULT;
- if (!checkCoreInputDevices(servlayoutp, FALSE))
- return FALSE;
return TRUE;
}
@@ -2034,7 +1722,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
indp = xnfalloc(sizeof(IDevRec));
indp->identifier = NULL;
servlayoutp->inputs = indp;
- if (!checkCoreInputDevices(servlayoutp, TRUE))
+ if (!xf86Info.allowEmptyInput && checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
return TRUE;
@@ -2563,10 +2251,6 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
inputp->commonOptions = conf_input->inp_option_lst;
inputp->extraOptions = NULL;
- /* XXX This is required until the keyboard driver is converted */
- if (!xf86NameCmp(inputp->driver, "keyboard"))
- return configInputKbd(inputp);
-
return TRUE;
}
@@ -2624,6 +2308,12 @@ addDefaultModes(MonPtr monitorp)
return TRUE;
}
+static void
+checkInput(serverLayoutPtr layout) {
+ if (!xf86Info.allowEmptyInput)
+ checkCoreInputDevices(layout, FALSE);
+}
+
/*
* load the config file and fill the global data structure
*/
@@ -2745,6 +2435,8 @@ xf86HandleConfigFile(Bool autoconfig)
return CONFIG_PARSE_ERROR;
}
+ checkInput(&xf86ConfigLayout);
+
/*
* Handle some command line options that can override some of the
* ServerFlags settings.
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index cb091080c..f1f173dd8 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -76,7 +76,7 @@ Bool foundMouse = FALSE;
#elif defined(__SCO__)
static char *DFLT_MOUSE_PROTO = "OSMouse";
#elif defined(__UNIXWARE__)
-static char *DFLT_MOUSE_PROTO = "Xqueue";
+static char *DFLT_MOUSE_PROTO = "OSMouse";
static char *DFLT_MOUSE_DEV = "/dev/mouse";
#elif defined(QNX4)
static char *DFLT_MOUSE_PROTO = "OSMouse";
@@ -265,11 +265,7 @@ configureInputSection (void)
parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
ptr->inp_identifier = "Keyboard0";
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- ptr->inp_driver = "keyboard";
-#else
ptr->inp_driver = "kbd";
-#endif
ptr->list.next = NULL;
/* Crude mechanism to auto-detect mouse (os dependent) */
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index dcdf46674..46d812804 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -77,14 +77,9 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = {
xf86CursorOffScreen,
xf86CrossScreen,
xf86WarpCursor,
-#ifdef XINPUT
- xf86eqEnqueue,
- xf86eqSwitchScreen
-#else
/* let miPointerInitialize take care of these */
NULL,
NULL
-#endif
};
static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
@@ -228,9 +223,9 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
return FALSE;
- pCursorScreen = miPointerCurrentScreen();
+ pCursorScreen = miPointerGetScreen(inputInfo.pointer);
if (pScreen == pCursorScreen)
- miPointerPosition(&px, &py);
+ miPointerGetPosition(inputInfo.pointer, &px, &py);
xf86EnterServerState(SETUP);
Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 55c85e630..204457fb1 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -47,6 +47,8 @@
#endif
#include "xf86Xinput.h"
+#include "mi.h"
+
static unsigned long DGAGeneration = 0;
static int DGAScreenIndex = -1;
@@ -907,22 +909,6 @@ DGAVTSwitch(void)
Bool
DGAStealKeyEvent(int index, xEvent *e)
{
- DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
- if(DGAScreenIndex < 0) /* no DGA */
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
- return FALSE;
-
- de.u.u.type = e->u.u.type + *XDGAEventBase;
- de.u.u.detail = e->u.u.detail;
- de.u.event.time = e->u.keyButtonPointer.time;
- xf86eqEnqueue ((xEvent *) &de);
- return TRUE;
}
static int DGAMouseX, DGAMouseY;
@@ -930,36 +916,6 @@ static int DGAMouseX, DGAMouseY;
Bool
DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
{
- DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
- if(DGAScreenIndex < 0) /* no DGA */
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
- return FALSE;
-
- DGAMouseX += dx;
- if (DGAMouseX < 0)
- DGAMouseX = 0;
- else if (DGAMouseX > screenInfo.screens[index]->width)
- DGAMouseX = screenInfo.screens[index]->width;
- DGAMouseY += dy;
- if (DGAMouseY < 0)
- DGAMouseY = 0;
- else if (DGAMouseY > screenInfo.screens[index]->height)
- DGAMouseY = screenInfo.screens[index]->height;
- de.u.u.type = e->u.u.type + *XDGAEventBase;
- de.u.u.detail = e->u.u.detail;
- de.u.event.time = e->u.keyButtonPointer.time;
- de.u.event.dx = dx;
- de.u.event.dy = dy;
- de.u.event.pad1 = DGAMouseX;
- de.u.event.pad2 = DGAMouseY;
- xf86eqEnqueue ((xEvent *) &de);
- return TRUE;
}
Bool
diff --git a/hw/xfree86/common/xf86Debug.c b/hw/xfree86/common/xf86Debug.c
index 2eb28876d..cb579343a 100644
--- a/hw/xfree86/common/xf86Debug.c
+++ b/hw/xfree86/common/xf86Debug.c
@@ -163,6 +163,7 @@ void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v)
}
+#if 0
_X_EXPORT void
xf86STimestamp(xf86TsPtr* timestamp)
{
@@ -194,3 +195,4 @@ xf86SPTimestamp(xf86TsPtr* timestamp, char *str)
gettimeofday((struct timeval*)*timestamp,NULL);
}
}
+#endif
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 831c68ad8..4a9f36926 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -104,23 +104,12 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
-#ifdef XINPUT
-#define __EqEnqueue(ev) xf86eqEnqueue(ev)
-#else
-#define __EqEnqueue(ev) mieqEnqueue(ev)
-#endif
-
-#define EqEnqueue(ev) { \
+#define EqEnqueue(pDev, ev) { \
int __sigstate = xf86BlockSIGIO (); \
- __EqEnqueue (ev); \
+ mieqEnqueue (pDev, ev); \
xf86UnblockSIGIO(__sigstate); \
}
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- EqEnqueue((ev))
-
/*
* The first of many hacks to get VT switching to work under
* Solaris 2.1 for x86. The basic problem is that Solaris is supposed
@@ -146,9 +135,6 @@ Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
extern fd_set EnabledDevices;
-#if defined(XQUEUE)
-extern void xf86XqueRequest(void);
-#endif
#ifdef XF86PM
extern void (*xf86OSPMClose)(void);
#endif
@@ -170,6 +156,12 @@ typedef struct x_IHRec {
static IHPtr InputHandlers = NULL;
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
/*
* TimeSinceLastInputEvent --
* Function used for screensaver purposes by the os module. Returns the
@@ -253,14 +245,10 @@ ProcessInputEvents ()
xf86Info.inputPending = FALSE;
-#ifdef XINPUT
- xf86eqProcessInputEvents();
-#else
mieqProcessInputEvents();
-#endif
- miPointerUpdate();
+ miPointerUpdateSprite(inputInfo.pointer);
- miPointerPosition(&x, &y);
+ miPointerGetPosition(inputInfo.pointer, &x, &y);
xf86SetViewport(xf86Info.currentScreen, x, y);
}
@@ -403,679 +391,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
}
}
-/*
- * xf86PostKbdEvent --
- * Translate the raw hardware KbdEvent into an XEvent, and tell DIX
- * about it. Scancode preprocessing and so on is done ...
- *
- * OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c
- * as some things differ, and I did not want to scatter this routine with
- * ifdefs further (hv).
- */
-
-#ifdef __linux__
-extern u_char SpecialServerMap[];
-#endif
-
-#if !defined(__UNIXOS2__)
-void
-xf86PostKbdEvent(unsigned key)
-{
- int scanCode = (key & 0x7f);
- int specialkey = 0;
- Bool down = (key & 0x80 ? FALSE : TRUE);
- KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
- Bool updateLeds = FALSE;
- Bool UsePrefix = FALSE;
- Bool Direction = FALSE;
- xEvent kevent;
- KeySym *keysym;
- int keycode;
- static int lockkeys = 0;
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- static Bool first_time = TRUE;
-#endif
-#if defined(__sparc__) && defined(__linux__)
- static int kbdSun = -1;
-#endif
- /* Disable any keyboard processing while in suspend */
- if (xf86inSuspend)
- return;
-
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- if (first_time)
- {
- first_time = FALSE;
- VTSwitchEnabled = (xf86Info.consType == SYSCONS)
- || (xf86Info.consType == PCVT);
- }
-#endif
-
-#if defined (__sparc__) && defined(__linux__)
- if (kbdSun == -1) {
- if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
- || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
- kbdSun = 1;
- else
- kbdSun = 0;
- }
- if (kbdSun)
- goto special;
-#endif /* __sparc__ && __linux__ */
-
-#ifdef __linux__
- if (xf86Info.kbdCustomKeycodes) {
- specialkey = SpecialServerMap[scanCode];
- goto customkeycodes;
- }
-#endif
-
- /*
- * First do some special scancode remapping ...
- */
- if (xf86Info.scanPrefix == 0) {
-
- switch (scanCode) {
- case KEY_Prefix0:
- case KEY_Prefix1:
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT
-#ifdef WSCONS_SUPPORT
- || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents)
-#endif
- ) {
-#endif
- xf86Info.scanPrefix = scanCode; /* special prefixes */
- return;
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- }
- break;
-#endif
- }
-#if defined (i386) && defined (SVR4)
- /*
- * PANIX returns DICOP standards based keycodes in using 106jp
- * keyboard. We need to remap some keys.
- */
- if(xf86Info.panix106 == TRUE){
- switch (scanCode) {
- case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */
- case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/
- case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */
- case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */
- case 0x6B: scanCode = KEY_Left; break; /* Cur Left */
- case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */
- case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */
- case 0x73: scanCode = KEY_RCtrl; break; /* not needed */
- }
- } else
-#endif /* i386 && SVR4 */
- {
- switch (scanCode) {
- case 0x59: scanCode = KEY_0x59; break;
- case 0x5a: scanCode = KEY_0x5A; break;
- case 0x5b: scanCode = KEY_0x5B; break;
- case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */
- case 0x5d: scanCode = KEY_0x5D; break;
- case 0x5e: scanCode = KEY_0x5E; break;
- case 0x5f: scanCode = KEY_0x5F; break;
- case 0x62: scanCode = KEY_0x62; break;
- case 0x63: scanCode = KEY_0x63; break;
- case 0x64: scanCode = KEY_0x64; break;
- case 0x65: scanCode = KEY_0x65; break;
- case 0x66: scanCode = KEY_0x66; break;
- case 0x67: scanCode = KEY_0x67; break;
- case 0x68: scanCode = KEY_0x68; break;
- case 0x69: scanCode = KEY_0x69; break;
- case 0x6a: scanCode = KEY_0x6A; break;
- case 0x6b: scanCode = KEY_0x6B; break;
- case 0x6c: scanCode = KEY_0x6C; break;
- case 0x6d: scanCode = KEY_0x6D; break;
- case 0x6e: scanCode = KEY_0x6E; break;
- case 0x6f: scanCode = KEY_0x6F; break;
- case 0x70: scanCode = KEY_0x70; break;
- case 0x71: scanCode = KEY_0x71; break;
- case 0x72: scanCode = KEY_0x72; break;
- case 0x73: scanCode = KEY_0x73; break;
- case 0x74: scanCode = KEY_0x74; break;
- case 0x75: scanCode = KEY_0x75; break;
- case 0x76: scanCode = KEY_0x76; break;
- }
- }
- }
-
- else if (
-#ifdef CSRG_BASED
- (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT
-#ifdef WSCONS_SUPPORT
- || (xf86Info.consType == WSCONS && xf86Info.kbdEvents !=
- xf86WSKbdEvents)
-#endif
- ) &&
-#endif
- (xf86Info.scanPrefix == KEY_Prefix0)) {
- xf86Info.scanPrefix = 0;
-
- switch (scanCode) {
- case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */
- case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */
- case 0x5b: scanCode = KEY_LMeta; break;
- case 0x5c: scanCode = KEY_RMeta; break;
- case 0x5d: scanCode = KEY_Menu; break;
- case KEY_F3: scanCode = KEY_F13; break;
- case KEY_F4: scanCode = KEY_F14; break;
- case KEY_F5: scanCode = KEY_F15; break;
- case KEY_F6: scanCode = KEY_F16; break;
- case KEY_F7: scanCode = KEY_F17; break;
- case KEY_KP_Plus: scanCode = KEY_KP_DEC; break;
- /*
- * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
- */
- case 0x2A:
- case 0x36:
- return;
- default:
- xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
- scanCode);
- /*
- * "Internet" keyboards are generating lots of new codes. Let them
- * pass. There is little consistency between them, so don't bother
- * with symbolic names at this level.
- */
- scanCode += 0x78;
- }
- }
-
- else if (xf86Info.scanPrefix == KEY_Prefix1)
- {
- xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
- return;
- }
-
- else if (xf86Info.scanPrefix == KEY_LCtrl)
- {
- xf86Info.scanPrefix = 0;
- if (scanCode != KEY_NumLock) return;
- scanCode = KEY_Pause; /* pause */
- }
-
-#ifndef __sparc64__
- /*
- * PC keyboards generate separate key codes for
- * Alt+Print and Control+Pause but in the X keyboard model
- * they need to get the same key code as the base key on the same
- * physical keyboard key.
- */
- if (scanCode == KEY_SysReqest)
- scanCode = KEY_Print;
- else if (scanCode == KEY_Break)
- scanCode = KEY_Pause;
-#endif
-
- /*
- * and now get some special keysequences
- */
-
- specialkey = scanCode;
-
-#ifdef __linux__
-customkeycodes:
-#endif
-#if defined(i386) || defined(__i386__)
- if (xf86IsPc98()) {
- switch (scanCode) {
- case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */
- case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */
- case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */
-
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
-
- case 0x62: specialkey = 0x3b; break; /* KEY_F1 */
- case 0x63: specialkey = 0x3c; break; /* KEY_F2 */
- case 0x64: specialkey = 0x3d; break; /* KEY_F3 */
- case 0x65: specialkey = 0x3e; break; /* KEY_F4 */
- case 0x66: specialkey = 0x3f; break; /* KEY_F5 */
- case 0x67: specialkey = 0x40; break; /* KEY_F6 */
- case 0x68: specialkey = 0x41; break; /* KEY_F7 */
- case 0x69: specialkey = 0x42; break; /* KEY_F8 */
- case 0x6a: specialkey = 0x43; break; /* KEY_F9 */
- case 0x6b: specialkey = 0x44; break; /* KEY_F10 */
- /* case 0x73: specialkey = 0x38; break; KEY_Alt */
- /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */
- default: specialkey = 0x00; break;
- }
- }
-#endif
-#if defined (__sparc__) && defined(__linux__)
-special:
- if (kbdSun) {
- switch (scanCode) {
- case 0x2b: specialkey = KEY_BackSpace; break;
- case 0x47: specialkey = KEY_KP_Minus; break;
- case 0x7d: specialkey = KEY_KP_Plus; break;
-
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
-
- case 0x05: specialkey = KEY_F1; break;
- case 0x06: specialkey = KEY_F2; break;
- case 0x08: specialkey = KEY_F3; break;
- case 0x0a: specialkey = KEY_F4; break;
- case 0x0c: specialkey = KEY_F5; break;
- case 0x0e: specialkey = KEY_F6; break;
- case 0x10: specialkey = KEY_F7; break;
- case 0x11: specialkey = KEY_F8; break;
- case 0x12: specialkey = KEY_F9; break;
- case 0x07: specialkey = KEY_F10; break;
- case 0x09: specialkey = KEY_F11; break;
- case 0x0b: specialkey = KEY_F12; break;
- default: specialkey = 0; break;
- }
- /*
- * XXX XXX XXX:
- *
- * I really don't know what's wrong here, but passing the real
- * scanCode offsets by one from XKB's point of view.
- *
- * (ecd@skynet.be, 980405)
- */
- scanCode--;
- }
-#endif /* defined (__sparc__) && defined(__linux__) */
-
-#ifdef XKB
- if ((xf86Info.ddxSpecialKeys == SKWhenNeeded &&
- !xf86Info.ActionKeyBindingsSet) ||
- noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) {
-#endif
- if (!(ModifierDown(ShiftMask)) &&
- ((ModifierDown(ControlMask | AltMask)) ||
- (ModifierDown(ControlMask | AltLangMask))))
- {
- switch (specialkey) {
-
- case KEY_BackSpace:
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
- break;
-
- /*
- * Check grabs
- */
- case KEY_KP_Divide:
- xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
- break;
- case KEY_KP_Multiply:
- xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
- break;
-
- /*
- * Video mode switches
- */
- case KEY_KP_Minus: /* Keypad - */
- if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- case KEY_KP_Plus: /* Keypad + */
- if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- /* Under QNX4, we set the vtPending flag for VT switching and
- * let the VT switch function do the rest...
- * This is a little different from the other OS'es.
- */
-#if defined(QNX4)
- case KEY_1:
- case KEY_2:
- case KEY_3:
- case KEY_4:
- case KEY_5:
- case KEY_6:
- case KEY_7:
- case KEY_8:
- case KEY_9:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
- if (down) {
- int vtno = specialkey - KEY_1 + 1;
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- }
- return;
- }
- break;
-#endif
-
-#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(__SCO__) || defined(__UNIXWARE__)
- /*
- * Under Linux, the raw keycodes are consumed before the kernel
- * does any processing on them, so we must emulate the vt switching
- * we want ourselves.
- */
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- case KEY_F11:
- case KEY_F12:
- if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
-#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)))
- && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
-#endif
- ) {
- int vtno = specialkey - KEY_F1 + 1;
- if (specialkey == KEY_F11 || specialkey == KEY_F12)
- vtno = specialkey - KEY_F11 + 11;
- if (down)
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- return;
- }
- break;
-#endif /* linux || BSD with VTs */
-
- /* just worth mentioning here: any 386bsd keyboard driver
- * (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC
- * before any application (e.g. XF86) will see it
- * OBS: syscons does not, nor does pcvt !
- */
- }
- }
-
- /*
- * Start of actual Solaris VT switching code.
- * This should pretty much emulate standard SVR4 switching keys.
- *
- * DWH 12/2/93
- */
-
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
- {
- switch (specialkey)
- {
- /*
- * syscons on *BSD doesn't have a VT #0 -- don't think Linux does
- * either
- */
-#if defined (sun) && defined (i386) && defined (SVR4)
- case KEY_H:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL);
- VTSysreqToggle = 0;
- return;
- }
- break;
-
- /*
- * Yah, I know the N, and P keys seem backwards, however that's
- * how they work under Solaris
- * XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1)
- */
-
- case KEY_N:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
- case KEY_P:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-#endif
-
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down)
- { int vtno = specialkey - KEY_F1 + 1;
- if (specialkey == KEY_F11 || specialkey == KEY_F12)
- vtno = specialkey - KEY_F11 + 11;
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
-
- case KEY_SysReqest:
- if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask)))
- VTSysreqToggle = TRUE;
- break;
-
- default:
- if (VTSysreqToggle)
- {
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- VTSysreqToggle = FALSE;
-
- }
- }
- }
-
-#endif /* USE_VT_SYSREQ */
-
-#ifdef __SCO__
- /*
- * With the console in raw mode, SCO will not switch consoles,
- * you get around this by activating the next console along, if
- * this fails then go back to console 0, if there is only one
- * then it doesn't matter, switching to yourself is a nop as far
- * as the console driver is concerned.
- * We could do something similar to linux here but SCO ODT uses
- * Ctrl-PrintScrn, so why change?
- */
- if (specialkey == KEY_Print && ModifierDown(ControlMask)) {
- if (down)
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- return;
- }
-#endif /* __SCO__ */
-#ifdef XKB
- }
-#endif
-
- /*
- * Now map the scancodes to real X-keycodes ...
- */
- keycode = scanCode + MIN_KEYCODE;
- keysym = (keyc->curKeySyms.map +
- keyc->curKeySyms.mapWidth *
- (keycode - keyc->curKeySyms.minKeyCode));
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- /*
- * Filter autorepeated caps/num/scroll lock keycodes.
- */
-#define CAPSFLAG 0x01
-#define NUMFLAG 0x02
-#define SCROLLFLAG 0x04
-#define MODEFLAG 0x08
- if( down ) {
- switch( keysym[0] ) {
- case XK_Caps_Lock :
- if (lockkeys & CAPSFLAG)
- return;
- else
- lockkeys |= CAPSFLAG;
- break;
-
- case XK_Num_Lock :
- if (lockkeys & NUMFLAG)
- return;
- else
- lockkeys |= NUMFLAG;
- break;
-
- case XK_Scroll_Lock :
- if (lockkeys & SCROLLFLAG)
- return;
- else
- lockkeys |= SCROLLFLAG;
- break;
- }
- if (keysym[1] == XF86XK_ModeLock)
- {
- if (lockkeys & MODEFLAG)
- return;
- else
- lockkeys |= MODEFLAG;
- }
-
- }
- else {
- switch( keysym[0] ) {
- case XK_Caps_Lock :
- lockkeys &= ~CAPSFLAG;
- break;
-
- case XK_Num_Lock :
- lockkeys &= ~NUMFLAG;
- break;
-
- case XK_Scroll_Lock :
- lockkeys &= ~SCROLLFLAG;
- break;
- }
- if (keysym[1] == XF86XK_ModeLock)
- lockkeys &= ~MODEFLAG;
- }
-
- /*
- * LockKey special handling:
- * ignore releases, toggle on & off on presses.
- * Don't deal with the Caps_Lock keysym directly, but check the lock modifier
- */
- if (keyc->modifierMap[keycode] & LockMask ||
- keysym[0] == XK_Scroll_Lock ||
- keysym[1] == XF86XK_ModeLock ||
- keysym[0] == XK_Num_Lock)
- {
- Bool flag;
-
- if (!down) return;
- if (KeyPressed(keycode)) {
- down = !down;
- flag = FALSE;
- }
- else
- flag = TRUE;
-
- if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag;
- if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag;
- if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag;
- if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag;
- updateLeds = TRUE;
- }
-
- if (!xf86Info.kbdCustomKeycodes) {
- /*
- * normal, non-keypad keys
- */
- if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
-#if !defined(CSRG_BASED) && \
- !defined(__GNU__) && \
- defined(KB_84)
- /*
- * magic ALT_L key on AT84 keyboards for multilingual support
- */
- if (xf86Info.kbdType == KB_84 &&
- ModifierDown(AltMask) &&
- keysym[2] != NoSymbol)
- {
- UsePrefix = TRUE;
- Direction = TRUE;
- }
-#endif /* !CSRG_BASED && ... */
- }
- }
- if (updateLeds) xf86UpdateKbdLeds();
-#ifdef XKB
- }
-#endif
-
- /*
- * check for an autorepeat-event
- */
- if (down && KeyPressed(keycode)) {
- KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed;
- if ((xf86Info.autoRepeat != AutoRepeatModeOn) ||
- keyc->modifierMap[keycode] ||
- (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) ))))
- return;
- }
-
-
- xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis();
- /*
- * And now send these prefixes ...
- * NOTE: There cannot be multiple Mode_Switch keys !!!!
- */
- if (UsePrefix)
- {
- ENQUEUE(&kevent,
- keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
- (Direction ? KeyPress : KeyRelease),
- XE_KEYBOARD);
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
- ENQUEUE(&kevent,
- keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
- (Direction ? KeyRelease : KeyPress),
- XE_KEYBOARD);
- }
- else
- {
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
- }
-}
-#endif /* !__UNIXOS2__ */
-
#define ModifierIsSet(k) ((modifiers & (k)) == (k))
_X_EXPORT Bool
@@ -1137,8 +452,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
if (XFD_ANYSET(&devicesWithInput)) {
- if (xf86Info.kbdEvents)
- (xf86Info.kbdEvents)();
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0 &&
@@ -1161,8 +474,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
InputInfoPtr pInfo;
- (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */
-
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0) {
@@ -1470,6 +781,65 @@ xf86SigMemDebug(int signo)
}
#endif
+static void
+xf86ReleaseKeys(DeviceIntPtr pDev)
+{
+ KeyClassPtr keyc = NULL;
+ KeySym *map = NULL;
+ xEvent ke;
+ int i = 0, j = 0, nevents = 0;
+
+ ErrorF("releasekeys: called on device %s (%d)\n", pDev->name, pDev->id);
+
+ if (!pDev || !pDev->key)
+ return;
+
+ keyc = pDev->key;
+ map = keyc->curKeySyms.map;
+
+ /*
+ * Hmm... here is the biggest hack of every time !
+ * It may be possible that a switch-vt procedure has finished BEFORE
+ * you released all keys neccessary to do this. That peculiar behavior
+ * can fool the X-server pretty much, cause it assumes that some keys
+ * were not released. TWM may stuck alsmost completly....
+ * OK, what we are doing here is after returning from the vt-switch
+ * exeplicitely unrelease all keyboard keys before the input-devices
+ * are reenabled.
+ */
+
+ for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
+ i < keyc->curKeySyms.maxKeyCode;
+ i++, map += keyc->curKeySyms.mapWidth) {
+ if (KeyPressed(i)) {
+ switch (*map) {
+ /* Don't release the lock keys */
+ case XK_Caps_Lock:
+ case XK_Shift_Lock:
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Kana_Lock:
+ break;
+ default:
+ if (pDev == inputInfo.keyboard) {
+ ke.u.keyButtonPointer.time = GetTimeInMillis();
+ ke.u.keyButtonPointer.rootX = 0;
+ ke.u.keyButtonPointer.rootY = 0;
+ ke.u.u.type = KeyRelease;
+ ke.u.u.detail = i;
+ (*pDev->public.processInputProc) (&ke, pDev, 1);
+ }
+ else {
+ nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+ for (j = 0; j < nevents; j++)
+ EqEnqueue(pDev, xf86Events + i);
+ }
+ break;
+ }
+ }
+ }
+}
+
/*
* xf86VTSwitch --
* Handle requests for switching the vt.
@@ -1515,7 +885,6 @@ xf86VTSwitch()
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
- DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);
@@ -1556,12 +925,14 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
#if !defined(__UNIXOS2__)
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86ReleaseKeys(pInfo->dev);
EnableDevice(pInfo->dev);
pInfo = pInfo->next;
}
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -1618,12 +989,14 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
#if !defined(__UNIXOS2__)
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86ReleaseKeys(pInfo->dev);
EnableDevice(pInfo->dev);
pInfo = pInfo->next;
}
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
@@ -1745,9 +1118,6 @@ xf86ReloadInputDevs(int sig)
signal(sig, (void(*)(int))xf86ReloadInputDevs);
- DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
-
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);
@@ -1758,6 +1128,11 @@ xf86ReloadInputDevs(int sig)
return;
}
+_X_EXPORT void
+DDXRingBell(int volume, int pitch, int duration) {
+ xf86OSRingBell(volume, pitch, duration);
+}
+
#ifdef WSCONS_SUPPORT
/* XXX Currently XKB is mandatory. */
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 745c06379..9b23710bb 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -93,36 +93,11 @@ InputInfoPtr xf86InputDevs = NULL;
/* Globals that video drivers may not access */
xf86InfoRec xf86Info = {
- NULL, /* pKeyboard */
- NULL, /* kbdProc */
- NULL, /* kbdEvents */
-1, /* consoleFd */
- -1, /* kbdFd */
-1, /* vtno */
- -1, /* kbdType */
- -1, /* kbdRate */
- -1, /* kbdDelay */
- -1, /* bell_pitch */
- -1, /* bell_duration */
- TRUE, /* autoRepeat */
- 0, /* leds */
- 0, /* xleds */
NULL, /* vtinit */
- 0, /* scanPrefix */
- FALSE, /* capsLock */
- FALSE, /* numLock */
- FALSE, /* scrollLock */
- FALSE, /* modeSwitchLock */
- FALSE, /* composeLock */
FALSE, /* vtSysreq */
SKWhenNeeded, /* ddxSpecialKeys */
- FALSE, /* ActionKeyBindingsSet */
-#if defined(SVR4) && defined(i386)
- FALSE, /* panix106 */
-#endif
-#if defined(__OpenBSD__) || defined(__NetBSD__)
- 0, /* wskbdType */
-#endif
NULL, /* pMouse */
#ifdef XINPUT
NULL, /* mouseLocal */
@@ -141,20 +116,6 @@ xf86InfoRec xf86Info = {
-1, /* screenFd */
-1, /* consType */
#endif
-#ifdef XKB
- NULL, /* xkbkeymap */
- NULL, /* xkbkeycodes */
- NULL, /* xkbtypes */
- NULL, /* xkbcompat */
- NULL, /* xkbsymbols */
- NULL, /* xkbgeometry */
- FALSE, /* xkbcomponents_specified */
- NULL, /* xkbrules */
- NULL, /* xkbmodel */
- NULL, /* xkblayout */
- NULL, /* xkbvariant */
- NULL, /* xkboptions */
-#endif
FALSE, /* allowMouseOpenFail */
TRUE, /* vidModeEnabled */
FALSE, /* vidModeAllowNonLocal */
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index c7d3fae7a..d7fc43731 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -141,6 +141,32 @@ xf86DeleteInputDriver(int drvIndex)
xf86InputDriverList[drvIndex] = NULL;
}
+InputDriverPtr
+xf86LookupInputDriver(const char *name)
+{
+ int i;
+
+ for (i = 0; i < xf86NumInputDrivers; i++) {
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
+ }
+ return NULL;
+}
+
+InputInfoPtr
+xf86LookupInput(const char *name)
+{
+ InputInfoPtr p;
+
+ for (p = xf86InputDevs; p != NULL; p = p->next) {
+ if (strcmp(name, p->name) == 0)
+ return p;
+ }
+
+ return NULL;
+}
+
_X_EXPORT void
xf86AddModuleInfo(ModuleInfoPtr info, pointer module)
{
@@ -2550,7 +2576,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
/*
* XXX quick hack to report correctly for OSs that can't do SilkenMouse
* yet. Should handle this differently so that alternate async methods
- * like Xqueue work correctly with this too.
+ * work correctly with this too.
*/
pScrn->silkenMouse = useSM && xf86SIGIOSupported();
if (serverGeneration == 1)
diff --git a/hw/xfree86/common/xf86InPriv.h b/hw/xfree86/common/xf86InPriv.h
index 58c18904e..62e4820cb 100644
--- a/hw/xfree86/common/xf86InPriv.h
+++ b/hw/xfree86/common/xf86InPriv.h
@@ -40,4 +40,7 @@ extern int xf86NumInputDrivers;
/* xf86Xinput.c */
void xf86ActivateDevice(InputInfoPtr pInfo);
+/* xf86Helper.c */
+InputDriverPtr xf86LookupInputDriver(const char *name);
+
#endif /* _xf86InPriv_h */
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 8f0a26dd7..33351f2c1 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -135,18 +135,6 @@ static int numFormats = 6;
#endif
static Bool formatsDone = FALSE;
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
-static InputDriverRec XF86KEYBOARD = {
- 1,
- "keyboard",
- NULL,
- NULL,
- NULL,
- NULL,
- 0
-};
-#endif
-
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
@@ -409,10 +397,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xfree(modulelist);
}
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* Setup the builtin input drivers */
- xf86AddInputDriver(&XF86KEYBOARD, NULL, 0);
-#endif
/* Load all input driver modules specified in the config file. */
if ((modulelist = xf86InputDriverlistFromConfig())) {
xf86LoadModules(modulelist, NULL);
@@ -984,21 +968,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
NULL);
}
-
-static InputDriverPtr
-MatchInput(IDevPtr pDev)
-{
- int i;
-
- for (i = 0; i < xf86NumInputDrivers; i++) {
- if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
- xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0)
- return xf86InputDriverList[i];
- }
- return NULL;
-}
-
-
/*
* InitInput --
* Initialize all supported input devices.
@@ -1012,7 +981,6 @@ InitInput(argc, argv)
IDevPtr pDev;
InputDriverPtr pDrv;
InputInfoPtr pInfo;
- static InputInfoPtr coreKeyboard = NULL, corePointer = NULL;
xf86Info.vtRequestsPending = FALSE;
xf86Info.inputPending = FALSE;
@@ -1020,19 +988,7 @@ InitInput(argc, argv)
if (serverGeneration == 1) {
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* XXX The keyboard driver is a special case for now. */
- if (!xf86NameCmp(pDev->driver, "keyboard")) {
- xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n");
- xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n");
- xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n",
- pDev->identifier);
-
- continue;
- }
-#endif
-
- if ((pDrv = MatchInput(pDev)) == NULL) {
+ if ((pDrv = xf86LookupInputDriver(pDev->driver)) == NULL) {
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
/* XXX For now, just continue. */
continue;
@@ -1054,80 +1010,18 @@ InitInput(argc, argv)
xf86DeleteInput(pInfo, 0);
continue;
}
- if (pInfo->flags & XI86_CORE_KEYBOARD) {
- if (coreKeyboard) {
- xf86Msg(X_ERROR,
- "Attempt to register more than one core keyboard (%s)\n",
- pInfo->name);
- pInfo->flags &= ~XI86_CORE_KEYBOARD;
- } else {
- if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
- /* XXX just a warning for now */
- xf86Msg(X_WARNING,
- "%s: does not have core keyboard capabilities\n",
- pInfo->name);
- }
- coreKeyboard = pInfo;
- }
- }
- if (pInfo->flags & XI86_CORE_POINTER) {
- if (corePointer) {
- xf86Msg(X_ERROR,
- "Attempt to register more than one core pointer (%s)\n",
- pInfo->name);
- pInfo->flags &= ~XI86_CORE_POINTER;
- } else {
- if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
- /* XXX just a warning for now */
- xf86Msg(X_WARNING,
- "%s: does not have core pointer capabilities\n",
- pInfo->name);
- }
- corePointer = pInfo;
- }
- }
}
- if (!corePointer) {
- xf86Msg(X_WARNING, "No core pointer registered\n");
- /* XXX register a dummy core pointer */
- }
-#ifdef NEW_KBD
- if (!coreKeyboard) {
- xf86Msg(X_WARNING, "No core keyboard registered\n");
- /* XXX register a dummy core keyboard */
- }
-#endif
}
/* Initialise all input devices. */
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86Msg(X_INFO, "evaluating device (%s)\n", pInfo->name);
xf86ActivateDevice(pInfo);
pInfo = pInfo->next;
}
- if (coreKeyboard) {
- xf86Info.pKeyboard = coreKeyboard->dev;
- xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/
- }
- else {
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* Only set this if we're allowing the old driver. */
- if (xf86Info.kbdProc != NULL)
- xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
-#endif
- }
- if (corePointer)
- xf86Info.pMouse = corePointer->dev;
- if (xf86Info.pKeyboard)
- RegisterKeyboardDevice(xf86Info.pKeyboard);
-
- miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
-#ifdef XINPUT
- xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
-#else
- mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
-#endif
+ mieqInit();
}
#ifndef SET_STDERR_NONBLOCKING
@@ -1247,12 +1141,6 @@ AbortDDX()
int i;
/*
- * try to deinitialize all input devices
- */
- if (xf86Info.kbdProc && xf86Info.pKeyboard)
- (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
-
- /*
* try to restore the original video state
*/
#ifdef HAS_USL_VTS
diff --git a/hw/xfree86/common/xf86Io.c b/hw/xfree86/common/xf86Io.c
deleted file mode 100644
index 86ac74522..000000000
--- a/hw/xfree86/common/xf86Io.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE 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.
- *
- */
-/*
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSlib.h"
-#include "mipointer.h"
-
-#ifdef XINPUT
-#include "xf86Xinput.h"
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#endif
-
-#ifdef XKB
-#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBsrv.h>
-#endif
-
-unsigned int xf86InitialCaps = 0;
-unsigned int xf86InitialNum = 0;
-unsigned int xf86InitialScroll = 0;
-
-#include "atKeynames.h"
-
-/*
- * xf86KbdBell --
- * Ring the terminal/keyboard bell for an amount of time proportional to
- * "loudness".
- */
-
-void
-xf86KbdBell(percent, pKeyboard, ctrl, unused)
- int percent; /* Percentage of full volume */
- DeviceIntPtr pKeyboard; /* Keyboard to ring */
- pointer ctrl;
- int unused;
-{
- xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration);
-}
-
-void
-xf86UpdateKbdLeds()
-{
- int leds = 0;
- if (xf86Info.capsLock) leds |= XLED1;
- if (xf86Info.numLock) leds |= XLED2;
- if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3;
- if (xf86Info.composeLock) leds |= XLED4;
- xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds);
- xf86KbdLeds();
-}
-
-void
-xf86KbdLeds ()
-{
- int leds, real_leds = 0;
-
-#if defined (__sparc__) && defined(__linux__)
- static int kbdSun = -1;
- if (kbdSun == -1) {
- if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) ||
- (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
- kbdSun = 1;
- else
- kbdSun = 0;
- }
- if (kbdSun) {
- if (xf86Info.leds & 0x08) real_leds |= XLED1;
- if (xf86Info.leds & 0x04) real_leds |= XLED3;
- if (xf86Info.leds & 0x02) real_leds |= XLED4;
- if (xf86Info.leds & 0x01) real_leds |= XLED2;
- leds = real_leds;
- real_leds = 0;
- } else {
- leds = xf86Info.leds;
- }
-#else
- leds = xf86Info.leds;
-#endif /* defined (__sparc__) */
-
-#ifdef LED_CAP
- if (leds & XLED1) real_leds |= LED_CAP;
- if (leds & XLED2) real_leds |= LED_NUM;
- if (leds & XLED3) real_leds |= LED_SCR;
-#ifdef LED_COMP
- if (leds & XLED4) real_leds |= LED_COMP;
-#else
- if (leds & XLED4) real_leds |= LED_SCR;
-#endif
-#endif
-#ifdef sun
- /* Pass through any additional LEDs, such as Kana LED on Sun Japanese kbd */
- real_leds |= (leds & 0xFFFFFFF0);
-#endif
- xf86SetKbdLeds(real_leds);
- (void)leds;
-}
-
-/*
- * xf86KbdCtrl --
- * Alter some of the keyboard control parameters. All special protocol
- * values are handled by dix (ProgChangeKeyboardControl)
- */
-
-void
-xf86KbdCtrl (pKeyboard, ctrl)
- DevicePtr pKeyboard; /* Keyboard to alter */
- KeybdCtrl *ctrl;
-{
- int leds;
- xf86Info.bell_pitch = ctrl->bell_pitch;
- xf86Info.bell_duration = ctrl->bell_duration;
- xf86Info.autoRepeat = ctrl->autoRepeat;
-
- xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE;
-
- leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds);
-#ifdef XKB
- } else {
- xf86Info.leds = leds;
- }
-#endif
-
- xf86KbdLeds();
-}
-
-/*
- * xf86InitKBD --
- * Reinitialize the keyboard. Only set Lockkeys according to ours leds.
- * Depress all other keys.
- */
-
-void
-xf86InitKBD(init)
-Bool init;
-{
- char leds = 0, rad;
- unsigned int i;
- xEvent kevent;
- DeviceIntPtr pKeyboard = xf86Info.pKeyboard;
- KeyClassRec *keyc = xf86Info.pKeyboard->key;
- KeySym *map = keyc->curKeySyms.map;
-
- kevent.u.keyButtonPointer.time = GetTimeInMillis();
- kevent.u.keyButtonPointer.rootX = 0;
- kevent.u.keyButtonPointer.rootY = 0;
-
- /*
- * Hmm... here is the biggest hack of every time !
- * It may be possible that a switch-vt procedure has finished BEFORE
- * you released all keys neccessary to do this. That peculiar behavior
- * can fool the X-server pretty much, cause it assumes that some keys
- * were not released. TWM may stuck alsmost completly....
- * OK, what we are doing here is after returning from the vt-switch
- * exeplicitely unrelease all keyboard keys before the input-devices
- * are reenabled.
- */
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth)
- if (KeyPressed(i))
- {
- switch (*map) {
- /* Don't release the lock keys */
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- break;
- default:
- kevent.u.u.detail = i;
- kevent.u.u.type = KeyRelease;
- (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1);
- }
- }
-
- xf86Info.scanPrefix = 0;
-
- if (init)
- {
- /*
- * we must deal here with the fact, that on some cases the numlock or
- * capslock key are enabled BEFORE the server is started up. So look
- * here at the state on the according LEDS to determine whether a
- * lock-key is already set.
- */
-
- xf86Info.capsLock = FALSE;
- xf86Info.numLock = FALSE;
- xf86Info.scrollLock = FALSE;
- xf86Info.modeSwitchLock = FALSE;
- xf86Info.composeLock = FALSE;
-
-#ifdef LED_CAP
-#ifdef INHERIT_LOCK_STATE
- leds = xf86Info.leds;
-
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth)
-
- switch(*map) {
-
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- if (leds & LED_CAP)
- {
- xf86InitialCaps = i;
- xf86Info.capsLock = TRUE;
- }
- break;
-
- case XK_Num_Lock:
- if (leds & LED_NUM)
- {
- xf86InitialNum = i;
- xf86Info.numLock = TRUE;
- }
- break;
-
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- if (leds & LED_SCR)
- {
- xf86InitialScroll = i;
- xf86Info.scrollLock = TRUE;
- }
- break;
- }
-#endif /* INHERIT_LOCK_STATE */
- xf86SetKbdLeds(leds);
-#endif /* LED_CAP */
- (void)leds;
-
- if (xf86Info.kbdDelay <= 375) rad = 0x00;
- else if (xf86Info.kbdDelay <= 625) rad = 0x20;
- else if (xf86Info.kbdDelay <= 875) rad = 0x40;
- else rad = 0x60;
-
- if (xf86Info.kbdRate <= 2) rad |= 0x1F;
- else if (xf86Info.kbdRate >= 30) rad |= 0x00;
- else rad |= ((58 / xf86Info.kbdRate) - 2);
-
- xf86SetKbdRepeat(rad);
- }
-}
-
-/*
- * xf86KbdProc --
- * Handle the initialization, etc. of a keyboard.
- */
-
-int
-xf86KbdProc (pKeyboard, what)
- DeviceIntPtr pKeyboard; /* Keyboard to manipulate */
- int what; /* What to do to it */
-{
- KeySymsRec keySyms;
- CARD8 modMap[MAP_LENGTH];
- int kbdFd;
-
- switch (what) {
-
- case DEVICE_INIT:
- /*
- * First open and find the current state of the keyboard.
- */
-
- xf86KbdInit();
-
- xf86KbdGetMapping(&keySyms, modMap);
-
-
-#ifndef XKB
- defaultKeyboardControl.leds = xf86GetKbdLeds();
-#else
- defaultKeyboardControl.leds = 0;
-#endif
-
- /*
- * Perform final initialization of the system private keyboard
- * structure and fill in various slots in the device record
- * itself which couldn't be filled in before.
- */
-
- pKeyboard->public.on = FALSE;
-
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-#ifdef XKB
- } else {
- XkbComponentNamesRec names;
- XkbDescPtr desc;
- Bool foundTerminate = FALSE;
- int keyc;
- if (xf86Info.xkbkeymap) {
- names.keymap = xf86Info.xkbkeymap;
- names.keycodes = NULL;
- names.types = NULL;
- names.compat = NULL;
- names.symbols = NULL;
- names.geometry = NULL;
- } else {
- names.keymap = NULL;
- names.keycodes = xf86Info.xkbkeycodes;
- names.types = xf86Info.xkbtypes;
- names.compat = xf86Info.xkbcompat;
- names.symbols = xf86Info.xkbsymbols;
- names.geometry = xf86Info.xkbgeometry;
- }
- if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
- && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
- xf86Info.xkbrules = NULL;
- }
- XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
- xf86Info.xkblayout, xf86Info.xkbvariant,
- xf86Info.xkboptions);
-
- XkbInitKeyboardDeviceStruct(pKeyboard,
- &names,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-
- /* Search keymap for Terminate action */
- desc = pKeyboard->key->xkbInfo->desc;
- for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) {
- int i;
- for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) {
- if (XkbKeyAction(desc, keyc, i)
- && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) {
- foundTerminate = TRUE;
- goto searchdone;
- }
- }
- }
-searchdone:
- xf86Info.ActionKeyBindingsSet = foundTerminate;
- if (!foundTerminate)
- xf86Msg(X_INFO, "Server_Terminate keybinding not found\n");
- }
-#endif
-
- xf86InitKBD(TRUE);
- break;
-
- case DEVICE_ON:
- /*
- * Set the keyboard into "direct" mode and turn on
- * event translation.
- */
-
- kbdFd = xf86KbdOn();
- /*
- * Discard any pending input after a VT switch to prevent the server
- * passing on parts of the VT switch sequence.
- */
- sleep(1);
-#if defined(WSCONS_SUPPORT)
- if (xf86Info.consType != WSCONS) {
-#endif
- if (kbdFd != -1) {
- char buf[16];
- read(kbdFd, buf, 16);
- }
-#if defined(WSCONS_SUPPORT)
- }
-#endif
-
-#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */
- if (kbdFd != -1)
- AddEnabledDevice(kbdFd);
-#endif /* __UNIXOS2__ */
-
- pKeyboard->public.on = TRUE;
- xf86InitKBD(FALSE);
- break;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- /*
- * Restore original keyboard directness and translation.
- */
-
- kbdFd = xf86KbdOff();
-
- if (kbdFd != -1)
- RemoveEnabledDevice(kbdFd);
-
- pKeyboard->public.on = FALSE;
- break;
-
- }
- return (Success);
-}
diff --git a/hw/xfree86/common/xf86Kbd.c b/hw/xfree86/common/xf86Kbd.c
deleted file mode 100644
index a86581c25..000000000
--- a/hw/xfree86/common/xf86Kbd.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE 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.
- *
- */
-/*
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifdef __UNIXOS2__
-#define I_NEED_OS2_H
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-#include "xf86Config.h"
-
-#include "xf86Keymap.h"
-
-#if defined(KDGKBTYPE) && \
- !defined(Lynx) && \
- !defined(__UNIXOS2__) && !defined(__mips__) && \
- !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__)
-#define HAS_GETKBTYPE
-#endif
-#if defined(GIO_KEYMAP) && \
- !defined(Lynx) && \
- !defined(__UNIXOS2__) && !defined(__mips__) && \
- !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \
- !defined(__QNX__)
-#define HAS_GETKEYMAP
-
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-
-/*
- * NOTE: Not all possible remappable symbols are remapped. There are two main
- * reasons:
- * a) The mapping between scancode and SYSV/386 - symboltable
- * is inconsistent between different versions and has some
- * BIG mistakes.
- * b) In X-Windows there is a difference between numpad-keys
- * and normal keys. SYSV/386 uses for both kinds of keys
- * the same symbol.
- *
- * Thus only the alpha keypad and the function keys are translated.
- * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
- */
-
-static unsigned char remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- };
-
-#endif /* HAS_GETKEYMAP */
-
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(key, pDev)
- unsigned int key;
- DevicePtr pDev;
-{
- return (TRUE);
-}
-
-
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-xf86KbdGetMapping (pKeySyms, pModMap)
- KeySymsPtr pKeySyms;
- CARD8 *pModMap;
-{
- KeySym *k;
-#ifdef HAS_GETKEYMAP
- keymap_t keymap;
-#endif
- int i;
- KeySym *pMap;
-
-#ifdef HAS_GETKBTYPE
- char type;
-
- xf86Info.kbdType =
- ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
- if (xf86Info.kbdType == KB_84)
- pMap = map84;
- else
- pMap = map;
-#else
-/* OS/2 sets the keyboard type during xf86OpenKbd */
-#ifndef __UNIXOS2__
- xf86Info.kbdType = 0;
-#endif
- pMap = map;
-#endif
-
-#ifdef HAS_GETKEYMAP
- /*
- * use the keymap, which can be gotten from our oringinal vt??.
- * ( ttymap(1) !!!! )
- */
- if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
- for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
-
- if (remap[i]) {
-
- k = pMap + (remap[i] << 2);
-
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-#endif
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- pKeySyms->map = pMap;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
diff --git a/hw/xfree86/common/xf86KbdBSD.c b/hw/xfree86/common/xf86KbdBSD.c
deleted file mode 100644
index 97a737db1..000000000
--- a/hw/xfree86/common/xf86KbdBSD.c
+++ /dev/null
@@ -1,1265 +0,0 @@
-/*
- * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
- * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * and from xf86KbdCODrv.c by Holger Veit
- *
- * 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, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE 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.
- */
-/*
- * Copyright (c) 1994-2002 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-
-#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP)
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-
-static unsigned char remap[NUM_KEYCODES] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes the ibm code page 437 coding for characters
- * > 0x80. They are returned in this form by PCVT */
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
-#if 1
- /* This has been checked against what syscons actually does */
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol
-#else
- /* The old table, supposedly for pcvt. */
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol
-#endif
- };
-
-#ifdef __OpenBSD__
-/* don't mark AltR and CtrlR for remapping, since they
- * cannot be remapped by pccons */
-static unsigned char pccons_remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes an iso8859_1 encoding for the characters
- * > 80, as returned by pccons */
-static KeySym latin1_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
- };
-#endif
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(key, pDev)
- unsigned int key;
- DevicePtr pDev;
-{
- return (TRUE);
-}
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-xf86KbdGetMapping (pKeySyms, pModMap)
- KeySymsPtr pKeySyms;
- CARD8 *pModMap;
-{
- KeySym *k;
- int i;
-
-#ifndef __bsdi__
- switch (xf86Info.consType) {
-
-#ifdef PCCONS_SUPPORT
- case PCCONS:
-#if defined(__OpenBSD__)
- /*
- * on OpenBSD, the pccons keymap is programmable, too
- */
- {
- pccons_keymap_t keymap[KB_NUM_KEYS];
- if (ioctl(xf86Info.consoleFd, CONSOLE_GET_KEYMAP, &keymap) != -1) {
- for (i = 0; i < KB_NUM_KEYS; i++)
- if (pccons_remap[i]) {
- k = map + (pccons_remap[i] << 2);
- switch (keymap[i].type) {
- case KB_ASCII:
- /* For ASCII keys, there is only one char in the keymap */
- k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]];
- k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]];
- k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]];
- k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]];
- break;
- case KB_SCROLL:
- k[0] = XK_Scroll_Lock;
- goto special;
- case KB_NUM:
- k[0] = XK_Num_Lock;
- goto special;
- case KB_CAPS:
- k[0] = XK_Caps_Lock;
- goto special;
- case KB_SHIFT:
- switch (keymap[i].unshift[0]) {
- case 1:
- /* left shift */
- k[0] = XK_Shift_L;
- break;
- case 2:
- /* right shift */
- k[0] = XK_Shift_R;
- break;
- default:
- k[0] = NoSymbol;
- }
- goto special;
- case KB_CTL:
- k[0] = XK_Control_L;
- goto special;
- case KB_ALT:
- k[0] = XK_Alt_L;
- goto special;
- case KB_FUNC:
- switch (keymap[i].unshift[2]) {
- case 'M':
- k[0] = XK_F1;
- break;
- case 'N':
- k[0] = XK_F2;
- break;
- case 'O':
- k[0] = XK_F3;
- break;
- case 'P':
- k[0] = XK_F4;
- break;
- case 'Q':
- k[0] = XK_F5;
- break;
- case 'R':
- k[0] = XK_F6;
- break;
- case 'S':
- k[0] = XK_F7;
- break;
- case 'T':
- k[0] = XK_F8;
- break;
- case 'U':
- k[0] = XK_F9;
- break;
- case 'V':
- k[0] = XK_F10;
- break;
- case 'W':
- k[0] = XK_F11;
- break;
- case 'X':
- k[0] = XK_F12;
- break;
- default:
- k[0] = NoSymbol;
- break;
- }
- goto special;
- default:
- k[0] = NoSymbol;
- special:
- k[1] = k[2] = k[3] = NoSymbol;
- }
- }
- } else {
- ErrorF("Can't read pccons keymap\n");
- }
- }
-#endif /* __OpenBSD__ */
- break;
-#endif
-
-/*
- * XXX wscons has no GIO_KEYMAP
- */
-#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP)
- case SYSCONS:
- case PCVT:
- {
- keymap_t keymap;
-
- if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
- for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
- if (remap[i]) {
- k = map + (remap[i] << 2);
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3])
- k[2] = k[3] = NoSymbol;
- }
- }
- }
- break;
-#endif /* SYSCONS || PCVT */
-
- }
-#endif /* !bsdi */
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- xf86Info.kbdType = 0;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-
-}
-
-#ifdef WSCONS_SUPPORT
-#include "atKeynames.h"
-
-static CARD8 wsUsbMap[] = {
- /* 0 */ KEY_NOTUSED,
- /* 1 */ KEY_NOTUSED,
- /* 2 */ KEY_NOTUSED,
- /* 3 */ KEY_NOTUSED,
- /* 4 */ KEY_A,
- /* 5 */ KEY_B,
- /* 6 */ KEY_C,
- /* 7 */ KEY_D,
- /* 8 */ KEY_E,
- /* 9 */ KEY_F,
- /* 10 */ KEY_G,
- /* 11 */ KEY_H,
- /* 12 */ KEY_I,
- /* 13 */ KEY_J,
- /* 14 */ KEY_K,
- /* 15 */ KEY_L,
- /* 16 */ KEY_M,
- /* 17 */ KEY_N,
- /* 18 */ KEY_O,
- /* 19 */ KEY_P,
- /* 20 */ KEY_Q,
- /* 21 */ KEY_R,
- /* 22 */ KEY_S,
- /* 23 */ KEY_T,
- /* 24 */ KEY_U,
- /* 25 */ KEY_V,
- /* 26 */ KEY_W,
- /* 27 */ KEY_X,
- /* 28 */ KEY_Y,
- /* 29 */ KEY_Z,
- /* 30 */ KEY_1, /* 1 !*/
- /* 31 */ KEY_2, /* 2 @ */
- /* 32 */ KEY_3, /* 3 # */
- /* 33 */ KEY_4, /* 4 $ */
- /* 34 */ KEY_5, /* 5 % */
- /* 35 */ KEY_6, /* 6 ^ */
- /* 36 */ KEY_7, /* 7 & */
- /* 37 */ KEY_8, /* 8 * */
- /* 38 */ KEY_9, /* 9 ( */
- /* 39 */ KEY_0, /* 0 ) */
- /* 40 */ KEY_Enter, /* Return */
- /* 41 */ KEY_Escape, /* Escape */
- /* 42 */ KEY_BackSpace, /* Backspace Delete */
- /* 43 */ KEY_Tab, /* Tab */
- /* 44 */ KEY_Space, /* Space */
- /* 45 */ KEY_Minus, /* - _ */
- /* 46 */ KEY_Equal, /* = + */
- /* 47 */ KEY_LBrace, /* [ { */
- /* 48 */ KEY_RBrace, /* ] } */
- /* 49 */ KEY_BSlash, /* \ | */
- /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */
- /* 51 */ KEY_SemiColon, /* ; : */
- /* 52 */ KEY_Quote, /* ' " */
- /* 53 */ KEY_Tilde, /* ` ~ */
- /* 54 */ KEY_Comma, /* , < */
- /* 55 */ KEY_Period, /* . > */
- /* 56 */ KEY_Slash, /* / ? */
- /* 57 */ KEY_CapsLock, /* Caps Lock */
- /* 58 */ KEY_F1, /* F1 */
- /* 59 */ KEY_F2, /* F2 */
- /* 60 */ KEY_F3, /* F3 */
- /* 61 */ KEY_F4, /* F4 */
- /* 62 */ KEY_F5, /* F5 */
- /* 63 */ KEY_F6, /* F6 */
- /* 64 */ KEY_F7, /* F7 */
- /* 65 */ KEY_F8, /* F8 */
- /* 66 */ KEY_F9, /* F9 */
- /* 67 */ KEY_F10, /* F10 */
- /* 68 */ KEY_F11, /* F11 */
- /* 69 */ KEY_F12, /* F12 */
- /* 70 */ KEY_Print, /* PrintScrn SysReq */
- /* 71 */ KEY_ScrollLock, /* Scroll Lock */
- /* 72 */ KEY_Pause, /* Pause Break */
- /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
- /* 74 */ KEY_Home, /* Home */
- /* 75 */ KEY_PgUp, /* Page Up */
- /* 76 */ KEY_Delete, /* Delete */
- /* 77 */ KEY_End, /* End */
- /* 78 */ KEY_PgDown, /* Page Down */
- /* 79 */ KEY_Right, /* Right Arrow */
- /* 80 */ KEY_Left, /* Left Arrow */
- /* 81 */ KEY_Down, /* Down Arrow */
- /* 82 */ KEY_Up, /* Up Arrow */
- /* 83 */ KEY_NumLock, /* Num Lock */
- /* 84 */ KEY_KP_Divide, /* Keypad / */
- /* 85 */ KEY_KP_Multiply, /* Keypad * */
- /* 86 */ KEY_KP_Minus, /* Keypad - */
- /* 87 */ KEY_KP_Plus, /* Keypad + */
- /* 88 */ KEY_KP_Enter, /* Keypad Enter */
- /* 89 */ KEY_KP_1, /* Keypad 1 End */
- /* 90 */ KEY_KP_2, /* Keypad 2 Down */
- /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
- /* 92 */ KEY_KP_4, /* Keypad 4 Left */
- /* 93 */ KEY_KP_5, /* Keypad 5 */
- /* 94 */ KEY_KP_6, /* Keypad 6 */
- /* 95 */ KEY_KP_7, /* Keypad 7 Home */
- /* 96 */ KEY_KP_8, /* Keypad 8 Up */
- /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
- /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
- /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
- /* 100 */ KEY_Less, /* < > on some keyboards */
- /* 101 */ KEY_Menu, /* Menu */
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_NOTUSED,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_NOTUSED,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_NOTUSED,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_NOTUSED,
- /* 116 */ KEY_NOTUSED,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_NOTUSED,
- /* 119 */ KEY_NOTUSED,
- /* 120 */ KEY_NOTUSED,
- /* 121 */ KEY_NOTUSED,
- /* 122 */ KEY_NOTUSED,
- /* 123 */ KEY_NOTUSED,
- /* 124 */ KEY_NOTUSED,
- /* 125 */ KEY_NOTUSED,
- /* 126 */ KEY_NOTUSED,
- /* 127 */ KEY_NOTUSED,
- /* 128 */ KEY_NOTUSED,
- /* 129 */ KEY_NOTUSED,
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
- /* 224 */ KEY_LCtrl, /* Left Control */
- /* 225 */ KEY_ShiftL, /* Left Shift */
- /* 226 */ KEY_Alt, /* Left Alt */
- /* 227 */ KEY_LMeta, /* Left Meta */
- /* 228 */ KEY_RCtrl, /* Right Control */
- /* 229 */ KEY_ShiftR, /* Right Shift */
- /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
- /* 231 */ KEY_LMeta, /* Right Meta XXX */
-};
-
-#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
-
-/* Map for adb keyboards */
-static CARD8 wsAdbMap[] = {
- /* 0 */ KEY_A,
- /* 1 */ KEY_S,
- /* 2 */ KEY_D,
- /* 3 */ KEY_F,
- /* 4 */ KEY_H,
- /* 5 */ KEY_G,
- /* 6 */ KEY_Z,
- /* 7 */ KEY_X,
- /* 8 */ KEY_C,
- /* 9 */ KEY_V,
- /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */
- /* 11 */ KEY_B,
- /* 12 */ KEY_Q,
- /* 13 */ KEY_W,
- /* 14 */ KEY_E,
- /* 15 */ KEY_R,
- /* 16 */ KEY_Y,
- /* 17 */ KEY_T,
- /* 18 */ KEY_1,
- /* 19 */ KEY_2,
- /* 20 */ KEY_3,
- /* 21 */ KEY_4,
- /* 22 */ KEY_6,
- /* 23 */ KEY_5,
- /* 24 */ KEY_Equal,
- /* 25 */ KEY_9,
- /* 26 */ KEY_7,
- /* 27 */ KEY_Minus,
- /* 28 */ KEY_8,
- /* 29 */ KEY_0,
- /* 30 */ KEY_RBrace,
- /* 31 */ KEY_O,
- /* 32 */ KEY_U,
- /* 33 */ KEY_LBrace,
- /* 34 */ KEY_I,
- /* 35 */ KEY_P,
- /* 36 */ KEY_Enter,
- /* 37 */ KEY_L,
- /* 38 */ KEY_J,
- /* 39 */ KEY_Quote,
- /* 40 */ KEY_K,
- /* 41 */ KEY_SemiColon,
- /* 42 */ KEY_BSlash,
- /* 43 */ KEY_Comma,
- /* 44 */ KEY_Slash,
- /* 45 */ KEY_N,
- /* 46 */ KEY_M,
- /* 47 */ KEY_Period,
- /* 48 */ KEY_Tab,
- /* 49 */ KEY_Space,
- /* 50 */ KEY_Tilde,
- /* 51 */ KEY_Delete,
- /* 52 */ KEY_AltLang,
- /* 53 */ KEY_Escape,
- /* 54 */ KEY_LCtrl,
- /* 55 */ KEY_Alt,
- /* 56 */ KEY_ShiftL,
- /* 57 */ KEY_CapsLock,
- /* 58 */ KEY_LMeta,
- /* 59 */ KEY_Left,
- /* 60 */ KEY_Right,
- /* 61 */ KEY_Down,
- /* 62 */ KEY_Up,
- /* 63 */ KEY_UNKNOWN, /* Fn */
- /* 64 */ KEY_NOTUSED,
- /* 65 */ KEY_KP_Decimal,
- /* 66 */ KEY_NOTUSED,
- /* 67 */ KEY_KP_Multiply,
- /* 68 */ KEY_NOTUSED,
- /* 69 */ KEY_KP_Plus,
- /* 70 */ KEY_NOTUSED,
- /* 71 */ KEY_UNKNOWN, /* Clear */
- /* 72 */ KEY_NOTUSED,
- /* 73 */ KEY_NOTUSED,
- /* 74 */ KEY_NOTUSED,
- /* 75 */ KEY_KP_Divide,
- /* 76 */ KEY_KP_Enter,
- /* 77 */ KEY_NOTUSED,
- /* 78 */ KEY_KP_Minus,
- /* 79 */ KEY_NOTUSED,
- /* 80 */ KEY_NOTUSED,
- /* 81 */ KEY_KP_Equal, /* Keypad = */
- /* 82 */ KEY_KP_0,
- /* 83 */ KEY_KP_1,
- /* 84 */ KEY_KP_2,
- /* 85 */ KEY_KP_3,
- /* 86 */ KEY_KP_4,
- /* 87 */ KEY_KP_5,
- /* 88 */ KEY_KP_6,
- /* 89 */ KEY_KP_7,
- /* 90 */ KEY_NOTUSED,
- /* 91 */ KEY_KP_8,
- /* 92 */ KEY_KP_9,
- /* 93 */ KEY_NOTUSED,
- /* 94 */ KEY_NOTUSED,
- /* 95 */ KEY_UNKNOWN, /* Keypad , */
- /* 96 */ KEY_F5,
- /* 97 */ KEY_F6,
- /* 98 */ KEY_F7,
- /* 99 */ KEY_F3,
- /* 100 */ KEY_F8,
- /* 101 */ KEY_F9,
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_F11,
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_KP_Enter,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_F10,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_F12,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_Home,
- /* 116 */ KEY_PgUp,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_F4,
- /* 119 */ KEY_End,
- /* 120 */ KEY_F2,
- /* 121 */ KEY_PgDown,
- /* 122 */ KEY_F1,
- /* 123 */ KEY_NOTUSED,
- /* 124 */ KEY_NOTUSED,
- /* 125 */ KEY_NOTUSED,
- /* 126 */ KEY_NOTUSED,
- /* 127 */ KEY_NOTUSED,
- /* 128 */ KEY_NOTUSED,
- /* 129 */ KEY_NOTUSED,
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
-};
-
-#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
-
-static CARD8 wsSunMap[] = {
- /* 0x00 */ KEY_NOTUSED,
- /* 0x01 */ KEY_NOTUSED, /* stop */
- /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */
- /* 0x03 */ KEY_NOTUSED, /* again */
- /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */
- /* 0x05 */ KEY_F1,
- /* 0x06 */ KEY_F2,
- /* 0x07 */ KEY_F10,
- /* 0x08 */ KEY_F3,
- /* 0x09 */ KEY_F11,
- /* 0x0a */ KEY_F4,
- /* 0x0b */ KEY_F12,
- /* 0x0c */ KEY_F5,
- /* 0x0d */ KEY_AltLang,
- /* 0x0e */ KEY_F6,
- /* 0x0f */ KEY_NOTUSED,
- /* 0x10 */ KEY_F7,
- /* 0x11 */ KEY_F8,
- /* 0x12 */ KEY_F9,
- /* 0x13 */ KEY_Alt,
- /* 0x14 */ KEY_Up,
- /* 0x15 */ KEY_Pause,
- /* 0x16 */ KEY_Print,
- /* 0x17 */ KEY_NOTUSED, /* props */
- /* 0x18 */ KEY_Left,
- /* 0x19 */ KEY_ScrollLock,
- /* 0x1a */ KEY_NOTUSED, /* undo */
- /* 0x1b */ KEY_Down,
- /* 0x1c */ KEY_Right,
- /* 0x1d */ KEY_Escape,
- /* 0x1e */ KEY_1,
- /* 0x1f */ KEY_2,
- /* 0x20 */ KEY_3,
- /* 0x21 */ KEY_4,
- /* 0x22 */ KEY_5,
- /* 0x23 */ KEY_6,
- /* 0x24 */ KEY_7,
- /* 0x25 */ KEY_8,
- /* 0x26 */ KEY_9,
- /* 0x27 */ KEY_0,
- /* 0x28 */ KEY_Minus,
- /* 0x29 */ KEY_Equal,
- /* 0x2a */ KEY_Tilde,
- /* 0x2b */ KEY_BackSpace,
- /* 0x2c */ KEY_Insert,
- /* 0x2d */ KEY_KP_Equal,
- /* 0x2e */ KEY_KP_Divide,
- /* 0x2f */ KEY_KP_Multiply,
- /* 0x30 */ KEY_NOTUSED,
- /* 0x31 */ KEY_NOTUSED, /* front */
- /* 0x32 */ KEY_KP_Decimal,
- /* 0x33 */ KEY_NOTUSED, /* copy */
- /* 0x34 */ KEY_Home,
- /* 0x35 */ KEY_Tab,
- /* 0x36 */ KEY_Q,
- /* 0x37 */ KEY_W,
- /* 0x38 */ KEY_E,
- /* 0x39 */ KEY_R,
- /* 0x3a */ KEY_T,
- /* 0x3b */ KEY_Y,
- /* 0x3c */ KEY_U,
- /* 0x3d */ KEY_I,
- /* 0x3e */ KEY_O,
- /* 0x3f */ KEY_P,
- /* 0x40 */ KEY_LBrace,
- /* 0x41 */ KEY_RBrace,
- /* 0x42 */ KEY_Delete,
- /* 0x43 */ KEY_NOTUSED, /* compose */
- /* 0x44 */ KEY_KP_7,
- /* 0x45 */ KEY_KP_8,
- /* 0x46 */ KEY_KP_9,
- /* 0x47 */ KEY_KP_Minus,
- /* 0x48 */ KEY_NOTUSED, /* open */
- /* 0x49 */ KEY_NOTUSED, /* paste */
- /* 0x4a */ KEY_End,
- /* 0x4b */ KEY_NOTUSED,
- /* 0x4c */ KEY_LCtrl,
- /* 0x4d */ KEY_A,
- /* 0x4e */ KEY_S,
- /* 0x4f */ KEY_D,
- /* 0x50 */ KEY_F,
- /* 0x51 */ KEY_G,
- /* 0x52 */ KEY_H,
- /* 0x53 */ KEY_J,
- /* 0x54 */ KEY_K,
- /* 0x55 */ KEY_L,
- /* 0x56 */ KEY_SemiColon,
- /* 0x57 */ KEY_Quote,
- /* 0x58 */ KEY_BSlash,
- /* 0x59 */ KEY_Enter,
- /* 0x5a */ KEY_KP_Enter,
- /* 0x5b */ KEY_KP_4,
- /* 0x5c */ KEY_KP_5,
- /* 0x5d */ KEY_KP_6,
- /* 0x5e */ KEY_KP_0,
- /* 0x5f */ KEY_NOTUSED, /* find */
- /* 0x60 */ KEY_PgUp,
- /* 0x61 */ KEY_NOTUSED, /* cut */
- /* 0x62 */ KEY_NumLock,
- /* 0x63 */ KEY_ShiftL,
- /* 0x64 */ KEY_Z,
- /* 0x65 */ KEY_X,
- /* 0x66 */ KEY_C,
- /* 0x67 */ KEY_V,
- /* 0x68 */ KEY_B,
- /* 0x69 */ KEY_N,
- /* 0x6a */ KEY_M,
- /* 0x6b */ KEY_Comma,
- /* 0x6c */ KEY_Period,
- /* 0x6d */ KEY_Slash,
- /* 0x6e */ KEY_ShiftR,
- /* 0x6f */ KEY_NOTUSED, /* linefeed */
- /* 0x70 */ KEY_KP_1,
- /* 0x71 */ KEY_KP_2,
- /* 0x72 */ KEY_KP_3,
- /* 0x73 */ KEY_NOTUSED,
- /* 0x74 */ KEY_NOTUSED,
- /* 0x75 */ KEY_NOTUSED,
- /* 0x76 */ KEY_NOTUSED, /* help */
- /* 0x77 */ KEY_CapsLock,
- /* 0x78 */ KEY_LMeta,
- /* 0x79 */ KEY_Space,
- /* 0x7a */ KEY_RMeta,
- /* 0x7b */ KEY_PgDown,
- /* 0x7c */ KEY_NOTUSED,
- /* 0x7d */ KEY_KP_Plus,
- /* 0x7e */ KEY_NOTUSED,
- /* 0x7f */ KEY_NOTUSED
-};
-
-#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
-
-/*
- * Translate raw wskbd keyboard event values to XFree86 standard keycodes
- * (based on the AT keyboard scan codes using the tables above
- */
-int
-WSKbdToKeycode(int keycode)
-{
- switch (xf86Info.wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- case WSKBD_TYPE_PC_AT:
- /* No translation needed */
- return keycode;
- case WSKBD_TYPE_USB:
- if (keycode < 0 || keycode >= WS_USB_MAP_SIZE)
- return KEY_UNKNOWN;
- else
- return wsUsbMap[keycode];
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE)
- return KEY_UNKNOWN;
- else
- return wsAdbMap[keycode];
-#endif
-#ifdef WSKBD_TYPE_SUN
- case WSKBD_TYPE_SUN:
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
-#endif
- if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE)
- return KEY_UNKNOWN;
- else
- return wsSunMap[keycode];
-#endif
- default:
- ErrorF("Unknown wskbd type %d\n", xf86Info.wsKbdType);
- return KEY_UNKNOWN;
- }
-}
-
-#endif /* WSCONS_SUPPORT */
diff --git a/hw/xfree86/common/xf86KbdLnx.c b/hw/xfree86/common/xf86KbdLnx.c
deleted file mode 100644
index 74cb42d0f..000000000
--- a/hw/xfree86/common/xf86KbdLnx.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Linux version of keymapping setup. The kernel (since 0.99.14) has support
- * for fully remapping the keyboard, but there are some differences between
- * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
- * remove the restriction on what keycodes can be remapped.
- * Orest Zborowski.
- */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE 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.
- *
- */
-/*
- * Copyright (c) 1994-2001 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-
-#include "xf86Keymap.h"
-
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
-{
- return (TRUE);
-}
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
-
-void
-xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KeySym *k;
- char type;
- int i;
-
- readKernelMapping(pKeySyms, pModMap);
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- xf86Info.kbdType =
- ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-#include <linux/keyboard.h>
-
-static KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
-};
-
-/*
- * Maps the AT keycodes to Linux keycodes
- */
-static unsigned char at2lnx[NUM_KEYCODES] =
-{
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
-};
-#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
-
-#define NUM_CUSTOMKEYS NR_KEYS
-
-u_char SpecialServerMap[NUM_CUSTOMKEYS];
-
-static void
-readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KeySym *k;
- int i;
- int maxkey;
- static unsigned char tbl[GLYPHS_PER_KEY] =
- {
- 0, /* unshifted */
- 1, /* shifted */
- 0, /* modeswitch unshifted */
- 0 /* modeswitch shifted */
- };
-
- /*
- * Read the mapping from the kernel.
- * Since we're still using the XFree86 scancode->AT keycode mapping
- * routines, we need to convert the AT keycodes to Linux keycodes,
- * then translate the Linux keysyms into X keysyms.
- *
- * First, figure out which tables to use for the modeswitch columns
- * above, from the XF86Config fields.
- */
- tbl[2] = 8; /* alt */
- tbl[3] = tbl[2] | 1;
-
- if (xf86Info.kbdCustomKeycodes) {
- k = map;
- maxkey = NUM_CUSTOMKEYS;
- }
- else {
- k = map+GLYPHS_PER_KEY;
- maxkey = NUM_AT2LNX;
- }
-
- for (i = 0; i < maxkey; ++i)
- {
- struct kbentry kbe;
- int j;
-
- if (xf86Info.kbdCustomKeycodes)
- kbe.kb_index = i;
- else
- kbe.kb_index = at2lnx[i];
-
- for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
- {
- unsigned short kval;
-
- *k = NoSymbol;
-
- kbe.kb_table = tbl[j];
- if (
- (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) ||
- ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value))
- {
- case KT_LATIN:
- case KT_LETTER:
- *k = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- *k = XK_F1 + kval;
- else switch (kbe.kb_value)
- {
- case K_FIND:
- *k = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- *k = XK_Insert;
- break;
- case K_REMOVE:
- *k = XK_Delete;
- break;
- case K_SELECT:
- *k = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- *k = XK_Prior;
- break;
- case K_PGDN:
- *k = XK_Next;
- break;
- case K_HELP:
- *k = XK_Help;
- break;
- case K_DO:
- *k = XK_Execute;
- break;
- case K_PAUSE:
- *k = XK_Pause;
- break;
- case K_MACRO:
- *k = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value)
- {
- case K_ENTER:
- *k = XK_Return;
- break;
- case K_BREAK:
- *k = XK_Break;
- break;
- case K_CAPS:
- *k = XK_Caps_Lock;
- break;
- case K_NUM:
- *k = XK_Num_Lock;
- break;
- case K_HOLD:
- *k = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- *k = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value)
- {
- case K_PPLUS:
- *k = XK_KP_Add;
- break;
- case K_PMINUS:
- *k = XK_KP_Subtract;
- break;
- case K_PSTAR:
- *k = XK_KP_Multiply;
- break;
- case K_PSLASH:
- *k = XK_KP_Divide;
- break;
- case K_PENTER:
- *k = XK_KP_Enter;
- break;
- case K_PCOMMA:
- *k = XK_KP_Separator;
- break;
- case K_PDOT:
- *k = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- *k = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- *k = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value)
- {
- case K_DGRAVE:
- *k = XK_dead_grave;
- break;
- case K_DACUTE:
- *k = XK_dead_acute;
- break;
- case K_DCIRCM:
- *k = XK_dead_circumflex;
- break;
- case K_DTILDE:
- *k = XK_dead_tilde;
- break;
- case K_DDIERE:
- *k = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value)
- {
- case K_DOWN:
- *k = XK_Down;
- break;
- case K_LEFT:
- *k = XK_Left;
- break;
- case K_RIGHT:
- *k = XK_Right;
- break;
- case K_UP:
- *k = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value)
- {
- case K_ALTGR:
- *k = XK_Alt_R;
- break;
- case K_ALT:
- *k = (kbe.kb_index == 0x64 ?
- XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- *k = (kbe.kb_index == 0x61 ?
- XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- *k = XK_Control_L;
- break;
- case K_CTRLR:
- *k = XK_Control_R;
- break;
- case K_SHIFT:
- *k = (kbe.kb_index == 0x36 ?
- XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- *k = XK_Shift_L;
- break;
- case K_SHIFTR:
- *k = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- *k = XK_Shift_Lock;
- break;
-
- default:
- break;
- }
- }
-
- if (k[-1] == k[-2]) k[-1] = NoSymbol;
- if (k[-2] == k[-3]) k[-2] = NoSymbol;
- if (k[-3] == k[-4]) k[-3] = NoSymbol;
- if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
- if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
- }
-
- if (!xf86Info.kbdCustomKeycodes)
- return;
-
- /*
- * Find the Mapping for the special server functions
- */
- for (i = 0; i < NUM_CUSTOMKEYS; ++i) {
- struct kbentry kbe;
- int special = 0;
-
- kbe.kb_index = i;
- kbe.kb_table = 0; /* Plain map */
- if (!ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
- switch (kbe.kb_value) {
- case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */
- special = KEY_BackSpace;
- break;
- case K_PMINUS:
- special = KEY_KP_Minus;
- break;
- case K_PPLUS:
- special = KEY_KP_Plus;
- break;
- case K_F1:
- special = KEY_F1;
- break;
- case K_F2:
- special = KEY_F2;
- break;
- case K_F3:
- special = KEY_F3;
- break;
- case K_F4:
- special = KEY_F4;
- break;
- case K_F5:
- special = KEY_F5;
- break;
- case K_F6:
- special = KEY_F6;
- break;
- case K_F7:
- special = KEY_F7;
- break;
- case K_F8:
- special = KEY_F8;
- break;
- case K_F9:
- special = KEY_F9;
- break;
- case K_F10:
- special = KEY_F10;
- break;
- case K_F11:
- special = KEY_F11;
- break;
- case K_F12:
- special = KEY_F12;
- break;
- case K_ALT:
- special = KEY_Alt;
- break;
- case K_ALTGR:
- special = KEY_AltLang;
- break;
- case K_CONS:
- special = KEY_SysReqest;
- break;
- }
- SpecialServerMap[i] = special;
- }
-}
diff --git a/hw/xfree86/common/xf86KbdMach.c b/hw/xfree86/common/xf86KbdMach.c
deleted file mode 100644
index 82e3c720e..000000000
--- a/hw/xfree86/common/xf86KbdMach.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- *****************************************************************************
- * HISTORY
- * Log: xf86KbdMach.c,v
- * Revision 2.1.2.1 92/06/25 10:32:08 moore
- * Incorporate the Elliot Dresselhaus's, Ernest Hua's and local changes
- * to run Thomas Roell's I386 color X11R5. Original code only worked
- * with SCO Unix. New code works with 2.5 and 3.0 Mach
- * [92/06/24 rvb]
- *
- * EndLog
- *
- *****************************************************************************
- */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE 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.
- *
- */
-/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-#include "xf86Config.h"
-
-#include "xf86Keymap.h"
-
-static KeySym ascii_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
- };
-
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(key, pDev)
- unsigned int key;
- DevicePtr pDev;
-{
- return (TRUE);
-}
-
-
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-xf86KbdGetMapping (pKeySyms, pModMap)
- KeySymsPtr pKeySyms;
- CARD8 *pModMap;
-{
- KeySym *k;
- struct kbentry kbe;
- char type;
- int i, j;
-
- for (i = 0; i < NUMKEYS; i++)
- {
- static int states[] = { NORM_STATE, SHIFT_STATE, ALT_STATE, SHIFT_ALT };
- int j;
-
- k = &map[i*4];
- kbe.kb_index = i;
-
- for (j = 0; j < 4; j++)
- {
- kbe.kb_state = states[j];
-
- if (ioctl (xf86Info.consoleFd, KDGKBENT, &kbe) != -1)
- continue;
-
- if (kbe.kb_value [0] == K_SCAN)
- {
- int keycode = -1;
- switch (kbe.kb_value [1])
- {
- case K_CTLSC: keycode = XK_Control_L; break;
- case K_LSHSC: keycode = XK_Shift_L; break;
- case K_RSHSC: keycode = XK_Shift_R; break;
- case K_ALTSC: keycode = XK_Alt_L; break;
- case K_CLCKSC: keycode = XK_Caps_Lock; break;
- case K_NLCKSC: keycode = XK_Num_Lock; break;
- default: break;
- }
- if (keycode > 0)
- k[j] = keycode;
- }
- else if (kbe.kb_value[1] != NC)
- {
- /* How to handle multiple characters?
- Ignore them for now. */
- }
- else
- {
- k[j] = ascii_to_x[kbe.kb_value[0]];
- }
- }
- }
-
- /*
- * Apply the special key mapping specified in XF86Config
- */
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
- switch (k[0]) {
- case XK_Alt_L:
- j = K_INDEX_LEFTALT;
- break;
- case XK_Alt_R:
- j = K_INDEX_RIGHTALT;
- break;
- case XK_Scroll_Lock:
- j = K_INDEX_SCROLLLOCK;
- break;
- case XK_Control_R:
- j = K_INDEX_RIGHTCTL;
- break;
- default:
- j = -1;
- }
- if (j >= 0)
- switch (xf86Info.specialKeyMap[j]) {
- case KM_META:
- if (k[0] == XK_Alt_R)
- k[1] = XK_Meta_R;
- else {
- k[0] = XK_Alt_L;
- k[1] = XK_Meta_L;
- }
- break;
- case KM_COMPOSE:
- k[0] = XK_Multi_key;
- break;
- case KM_MODESHIFT:
- k[0] = XK_Mode_switch;
- k[1] = NoSymbol;
- break;
- case KM_MODELOCK:
- k[0] = XK_Mode_switch;
- k[1] = XF86XK_ModeLock;
- break;
- case KM_SCROLLLOCK:
- k[0] = XK_Scroll_Lock;
- break;
- case KM_CONTROL:
- k[0] = XK_Control_R;
- break;
- }
- }
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- xf86Info.kbdType =
- ioctl(xf86Info.kbdFd, KDGKBDTYPE, &type) != -1 ? type : KB_VANILLAKB;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- if (xf86Info.serverNumLock)
- pKeySyms->maxKeyCode = MAX_KEYCODE;
- else
- pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
-
-}
diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c
index 7596fbea7..375226a83 100644
--- a/hw/xfree86/common/xf86MiscExt.c
+++ b/hw/xfree86/common/xf86MiscExt.c
@@ -89,6 +89,7 @@ typedef struct {
int rate;
int delay;
int serverNumLock; /* obsolete */
+ pointer private;
} kbdParamsRec, *kbdParamsPtr;
/*
@@ -256,53 +257,22 @@ _X_EXPORT Bool
MiscExtGetKbdSettings(pointer *kbd)
{
kbdParamsPtr kbdptr;
+ InputInfoPtr pInfo;
DEBUG_P("MiscExtGetKbdSettings");
- kbdptr = MiscExtCreateStruct(MISC_KEYBOARD);
- if (!kbdptr)
- return FALSE;
- kbdptr->type = xf86Info.kbdType;
- kbdptr->rate = xf86Info.kbdRate;
- kbdptr->delay = xf86Info.kbdDelay;
- *kbd = kbdptr;
- return TRUE;
+ return FALSE;
}
_X_EXPORT int
MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype)
{
- kbdParamsPtr kbd = keyboard;
-
- DEBUG_P("MiscExtGetKbdValue");
- switch (valtype) {
- case MISC_KBD_TYPE: return kbd->type;
- case MISC_KBD_RATE: return kbd->rate;
- case MISC_KBD_DELAY: return kbd->delay;
- case MISC_KBD_SERVNUMLOCK: return 0;
- }
return 0;
}
_X_EXPORT Bool
MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value)
{
- kbdParamsPtr kbd = keyboard;
-
- DEBUG_P("MiscExtSetKbdValue");
- switch (valtype) {
- case MISC_KBD_TYPE:
- kbd->type = value;
- return TRUE;
- case MISC_KBD_RATE:
- kbd->rate = value;
- return TRUE;
- case MISC_KBD_DELAY:
- kbd->delay = value;
- return TRUE;
- case MISC_KBD_SERVNUMLOCK:
- return TRUE;
- }
return FALSE;
}
@@ -365,7 +335,7 @@ MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
InputInfoPtr pInfo = xf86InputDevs;
while (pInfo) {
- if (xf86IsCorePointer(pInfo->dev))
+ if (pInfo->dev == inputInfo.pointer)
break;
pInfo = pInfo->next;
}
@@ -463,15 +433,13 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
if (!xf86MouseProtocolIDToName)
return MISC_RET_NOMODULE;
if (mse->type < MTYPE_MICROSOFT
- || ( mse->type > MTYPE_EXPPS2
- && (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE)))
+ || (mse->type > MTYPE_EXPPS2
+ && (mse->type != MTYPE_OSMOUSE)))
return MISC_RET_BADMSEPROTO;
#ifdef OSMOUSE_ONLY
if (mse->type != MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#else
- if (mse->type == MTYPE_XQUEUE)
- return MISC_RET_BADMSEPROTO;
if (mse->type == MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#endif /* OSMOUSE_ONLY */
@@ -492,7 +460,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
mse->flags &= ~MF_REOPEN;
}
if (mse->type != MTYPE_OSMOUSE
- && mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_PS_2
&& mse->type != MTYPE_BUSMOUSE
&& mse->type != MTYPE_IMPS2
@@ -513,7 +480,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
return MISC_RET_BADFLAGS;
if (mse->type != MTYPE_OSMOUSE
- && mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_BUSMOUSE)
{
if (mse->samplerate < 0)
@@ -586,37 +552,7 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
xf86ReplaceBoolOption(pInfo->options, "ClearRTS",
pMse->mouseFlags | MF_CLEAR_RTS);
}
- if (mse_or_kbd == MISC_KEYBOARD) {
- kbdParamsPtr kbd = structure;
-
- if (kbd->rate < 0)
- return MISC_RET_BADVAL;
- if (kbd->delay < 0)
- return MISC_RET_BADVAL;
- if (kbd->type < KTYPE_UNKNOWN || kbd->type > KTYPE_XQUEUE)
- return MISC_RET_BADKBDTYPE;
-
- if (xf86Info.kbdRate!=kbd->rate || xf86Info.kbdDelay!=kbd->delay) {
- char rad;
-
- xf86Info.kbdRate = kbd->rate;
- xf86Info.kbdDelay = kbd->delay;
- if (xf86Info.kbdDelay <= 375) rad = 0x00;
- else if (xf86Info.kbdDelay <= 625) rad = 0x20;
- else if (xf86Info.kbdDelay <= 875) rad = 0x40;
- else rad = 0x60;
-
- if (xf86Info.kbdRate <= 2) rad |= 0x1F;
- else if (xf86Info.kbdRate >= 30) rad |= 0x00;
- else rad |= ((58/xf86Info.kbdRate)-2);
-
- xf86SetKbdRepeat(rad);
- }
-#if 0 /* Not done yet */
- xf86Info.kbdType = kbd->kbdtype;
-#endif
- }
- return MISC_RET_SUCCESS;
+ return MISC_RET_BADVAL;
}
_X_EXPORT Bool
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index cf404fb89..3c3247e40 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -85,7 +85,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 6)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 0a4c11d8d..7afb63a4d 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -142,14 +142,14 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
if (defaultOpts) {
pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0);
}
- if (pInfo->conf_idev->commonOptions) {
+ if (pInfo->conf_idev && pInfo->conf_idev->commonOptions) {
tmp = xf86optionListDup(pInfo->conf_idev->commonOptions);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
else
pInfo->options = tmp;
}
- if (pInfo->conf_idev->extraOptions) {
+ if (pInfo->conf_idev && pInfo->conf_idev->extraOptions) {
tmp = xf86optionListDup(pInfo->conf_idev->extraOptions);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index e7c0a9f67..9279dbd7b 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -193,20 +193,6 @@ Bool xf86LoadModules(char **list, pointer *optlist);
int xf86SetVerbosity(int verb);
int xf86SetLogVerbosity(int verb);
-/* xf86Io.c */
-
-void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl,
- int unused);
-void xf86KbdLeds(void);
-void xf86UpdateKbdLeds(void);
-void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl);
-void xf86InitKBD(Bool init);
-int xf86KbdProc(DeviceIntPtr pKeyboard, int what);
-
-/* xf86Kbd.c */
-
-void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
-
/* xf86Lock.c */
#ifdef USE_XF86_SERVERLOCK
@@ -217,6 +203,9 @@ void xf86UnlockServer(void);
void xf86InitXkb(void);
+/* xf86Xinput.c */
+extern xEvent *xf86Events;
+
#endif /* _NO_XF86_PROTOTYPES */
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 67d4304c9..659e566e0 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -67,38 +67,11 @@ typedef enum {
*/
typedef struct {
-
- /* keyboard part */
- DeviceIntPtr pKeyboard;
- DeviceProc kbdProc; /* procedure for initializing */
- void (* kbdEvents)(void); /* proc for processing events */
int consoleFd;
- int kbdFd;
int vtno;
- int kbdType; /* AT84 / AT101 */
- int kbdRate;
- int kbdDelay;
- int bell_pitch;
- int bell_duration;
- Bool autoRepeat;
- unsigned long leds;
- unsigned long xleds;
char * vtinit;
- int scanPrefix; /* scancode-state */
- Bool capsLock;
- Bool numLock;
- Bool scrollLock;
- Bool modeSwitchLock;
- Bool composeLock;
Bool vtSysreq;
SpecialKeysInDDX ddxSpecialKeys;
- Bool ActionKeyBindingsSet;
-#if defined(SVR4) && defined(i386)
- Bool panix106;
-#endif /* SVR4 && i386 */
-#if defined(__OpenBSD__) || defined(__NetBSD__)
- int wsKbdType;
-#endif
/* mouse part */
DeviceIntPtr pMouse;
@@ -125,25 +98,6 @@ typedef struct {
int consType; /* Which console driver? */
#endif
-#ifdef XKB
- /*
- * would like to use an XkbComponentNamesRec here but can't without
- * pulling in a bunch of header files. :-(
- */
- char * xkbkeymap;
- char * xkbkeycodes;
- char * xkbtypes;
- char * xkbcompat;
- char * xkbsymbols;
- char * xkbgeometry;
- Bool xkbcomponents_specified;
- char * xkbrules;
- char * xkbmodel;
- char * xkblayout;
- char * xkbvariant;
- char * xkboptions;
-#endif
-
/* Other things */
Bool allowMouseOpenFail;
Bool vidModeEnabled; /* VidMode extension enabled */
@@ -179,6 +133,9 @@ typedef struct {
Bool allowClosedown;
ServerGrabInfoRec server;
} grabInfo;
+
+ Bool allowEmptyInput; /* Allow the server to start with no input
+ * devices. */
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension
diff --git a/hw/xfree86/common/xf86Versions.c b/hw/xfree86/common/xf86Versions.c
index e984e80c1..97a35590e 100644
--- a/hw/xfree86/common/xf86Versions.c
+++ b/hw/xfree86/common/xf86Versions.c
@@ -31,7 +31,6 @@
#include "xf86.h"
#include "xf86OSmouse.h"
-#include "xf86OSKbd.h"
static CARD32 registeredVersions[NUM_BUILTIN_IFS];
@@ -51,8 +50,6 @@ xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags)
switch (iface) {
case BUILTIN_IF_OSMOUSE:
return OS_MOUSE_VERSION_CURRENT;
- case BUILTIN_IF_OSKBD:
- return OS_KBD_VERSION_CURRENT;
default:
xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: "
"interface %d not handled\n", iface);
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c56475b12..be3368dff 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -38,7 +38,6 @@
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
@@ -63,6 +62,7 @@
#include "xf86Xinput.h"
#ifdef XINPUT
#include "XIstubs.h"
+#include "xf86Optrec.h"
#endif
#include "mipointer.h"
#include "xf86InPriv.h"
@@ -73,10 +73,6 @@
#include "dpmsproc.h"
#endif
-#ifdef XFreeXDGA
-#include "dgaproc.h"
-#endif
-
#include "exevents.h" /* AddInputDevice */
#include "exglobals.h"
@@ -92,131 +88,29 @@
#include <X11/Xpoll.h>
#include "xf86_OSproc.h" /* sigio stuff */
+#include "mi.h"
+
/******************************************************************************
* debugging macro
*****************************************************************************/
-#ifdef DBG
-#undef DBG
-#endif
#ifdef DEBUG
-#undef DEBUG
-#endif
-
-#define DEBUG 0
-
-#if DEBUG
static int debug_level = 0;
-
#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
#else
#define DBG(lvl, f)
#endif
-/******************************************************************************
- * macros
- *****************************************************************************/
-#define ENQUEUE(e) xf86eqEnqueue((e))
-
-/***********************************************************************
- *
- * xf86AlwaysCoreControl --
- *
- * Control proc for the integer feedback that controls the always
- * core feature.
- *
- ***********************************************************************
- */
-static void
-xf86AlwaysCoreControl(DeviceIntPtr device,
- IntegerCtrl *control)
-{
-}
-
-/***********************************************************************
- *
- * Core devices functions --
- *
- * Test if device is the core device by checking the
- * value of always core feedback and the inputInfo struct.
- *
- ***********************************************************************
- */
-_X_EXPORT int
-xf86IsCorePointer(DeviceIntPtr device)
-{
- return(device == inputInfo.pointer);
-}
-
-static int
-xf86ShareCorePointer(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- return((local->always_core_feedback &&
- local->always_core_feedback->ctrl.integer_displayed));
-}
+xEvent *xf86Events = NULL;
static Bool
xf86SendDragEvents(DeviceIntPtr device)
{
LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- if (inputInfo.pointer->button->buttonsDown > 0)
- return (local->flags & XI86_SEND_DRAG_EVENTS);
+ if (device->button->buttonsDown > 0)
+ return (local->flags & XI86_SEND_DRAG_EVENTS);
else
- return (TRUE);
-}
-
-int
-xf86IsCoreKeyboard(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- return((local->flags & XI86_ALWAYS_CORE) ||
- (device == inputInfo.keyboard));
-}
-
-_X_EXPORT void
-xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always)
-{
- if (always) {
- local->flags |= XI86_ALWAYS_CORE;
- } else {
- local->flags &= ~XI86_ALWAYS_CORE;
- }
-}
-
-static int xf86CoreButtonState;
-
-/***********************************************************************
- *
- * xf86CheckButton --
- *
- * Test if the core pointer button state is coherent with
- * the button event to send.
- *
- ***********************************************************************
- */
-Bool
-xf86CheckButton(int button,
- int down)
-{
- int check;
- int bit = (1 << (button - 1));
-
- check = xf86CoreButtonState & bit;
-
- DBG(5, ErrorF("xf86CheckButton "
- "button=%d down=%d state=%d check=%d returns ",
- button, down, xf86CoreButtonState, check));
- if ((check && down) || (!check && !down)) {
- DBG(5, ErrorF("FALSE\n"));
- return FALSE;
- }
- xf86CoreButtonState ^= bit;
-
- DBG(5, ErrorF("TRUE\n"));
- return TRUE;
+ return (TRUE);
}
/***********************************************************************
@@ -229,36 +123,26 @@ xf86CheckButton(int button,
*/
_X_EXPORT void
xf86ProcessCommonOptions(LocalDevicePtr local,
- pointer list)
+ pointer list)
{
- if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
- xf86SetBoolOption(list, "SendCoreEvents", 0)) {
- local->flags |= XI86_ALWAYS_CORE;
- xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
- }
-
- if (xf86SetBoolOption(list, "CorePointer", 0)) {
- local->flags |= XI86_CORE_POINTER;
- xf86Msg(X_CONFIG, "%s: Core Pointer\n", local->name);
- }
-
- if (xf86SetBoolOption(list, "CoreKeyboard", 0)) {
- local->flags |= XI86_CORE_KEYBOARD;
- xf86Msg(X_CONFIG, "%s: Core Keyboard\n", local->name);
+ if (!xf86SetBoolOption(list, "AlwaysCore", 0) ||
+ xf86SetBoolOption(list, "SendCoreEvents", 0) ||
+ xf86SetBoolOption(list, "CorePointer", 0) ||
+ xf86SetBoolOption(list, "CoreKeyboard", 0)) {
+ local->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
}
if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
- local->flags |= XI86_SEND_DRAG_EVENTS;
+ local->flags |= XI86_SEND_DRAG_EVENTS;
} else {
- xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
}
-
- local->history_size = xf86SetIntOption(list, "HistorySize", 0);
+}
- if (local->history_size > 0) {
- xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
- local->history_size);
- }
+void
+xf86AlwaysCoreControl(DeviceIntPtr pDev, IntegerCtrl *control)
+{
}
/***********************************************************************
@@ -275,14 +159,11 @@ xf86XinputFinalizeInit(DeviceIntPtr dev)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- local->dxremaind = 0.0;
- local->dyremaind = 0.0;
-
if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) {
- ErrorF("Unable to init integer feedback for always core feature\n");
+ ErrorF("Unable to init integer feedback for always core feature\n");
} else {
- local->always_core_feedback = dev->intfeed;
- dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
+ local->always_core_feedback = dev->intfeed;
+ dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
}
}
@@ -300,42 +181,26 @@ xf86ActivateDevice(LocalDevicePtr local)
DeviceIntPtr dev;
if (local->flags & XI86_CONFIGURED) {
- int open_on_init;
-
- open_on_init = local->flags &
- (XI86_OPEN_ON_INIT |
- XI86_ALWAYS_CORE | XI86_CORE_POINTER | XI86_CORE_KEYBOARD);
-
- dev = AddInputDevice(local->device_control,
- open_on_init);
- if (dev == NULL)
- FatalError("Too many input devices");
-
- local->atom = MakeAtom(local->type_name,
- strlen(local->type_name),
- TRUE);
- AssignTypeAndName (dev, local->atom, local->name);
- dev->public.devicePrivate = (pointer) local;
- local->dev = dev;
-
- xf86XinputFinalizeInit(dev);
-
- /*
- * XXX Can a single device instance be both core keyboard and
- * core pointer? If so, this should be changed.
- */
- if (local->flags & XI86_CORE_POINTER)
- RegisterPointerDevice(dev);
- else if (local->flags & XI86_CORE_KEYBOARD)
- RegisterKeyboardDevice(dev);
-#ifdef XINPUT
- else
- RegisterOtherDevice(dev);
-#endif
+ dev = AddInputDevice(local->device_control, TRUE);
+
+ if (dev == NULL)
+ FatalError("Too many input devices");
+
+ local->atom = MakeAtom(local->type_name,
+ strlen(local->type_name),
+ TRUE);
+ AssignTypeAndName(dev, local->atom, local->name);
+ dev->public.devicePrivate = (pointer) local;
+ local->dev = dev;
+
+ xf86XinputFinalizeInit(dev);
- if (serverGeneration == 1)
- xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
- local->name, local->type_name);
+ dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
+ RegisterOtherDevice(dev);
+
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ local->name, local->type_name);
}
}
@@ -366,190 +231,32 @@ xf86ActivateDevice(LocalDevicePtr local)
void
OpenInputDevice(DeviceIntPtr dev,
- ClientPtr client,
- int *status)
+ ClientPtr client,
+ int *status)
{
- if (!dev->inited) {
- *status = BadDevice;
- } else {
- if (!dev->public.on) {
- if (!EnableDevice(dev)) {
- *status = BadDevice;
- } else {
- /* to prevent ProcXOpenDevice to call EnableDevice again */
- dev->startup = FALSE;
- }
- }
- }
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- ***********************************************************************
- */
+ if (!dev->inited)
+ ActivateDevice(dev);
-int
-ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev)
-{
- /**********************************************************************
- * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return !Success;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- ***********************************************************************
- */
-
-int
-ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
-{
- /************************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
-
- /*
- * We don't allow axis swap or other exotic features.
- */
- if (x == 0 && y == 1) {
- LocalDevicePtr old_local = (LocalDevicePtr)old_dev->public.devicePrivate;
- LocalDevicePtr new_local = (LocalDevicePtr)new_dev->public.devicePrivate;
-
- InitFocusClassDeviceStruct(old_dev);
-
- /* Restore Extended motion history information */
- old_dev->valuator->GetMotionProc = old_local->motion_history_proc;
- old_dev->valuator->numMotionEvents = old_local->history_size;
-
- /* Save Extended motion history information */
- new_local->motion_history_proc = new_dev->valuator->GetMotionProc;
- new_local->history_size = new_dev->valuator->numMotionEvents;
-
- /* Set Core motion history information */
- new_dev->valuator->GetMotionProc = miPointerGetMotionEvents;
- new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
-
- return Success;
- }
- else
- return !Success;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXCloseDevice
- *
- * Take care of implementation-dependent details of closing a device.
- * Some implementations may actually close the device, others may just
- * remove this clients interest in that device.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- *
- ***********************************************************************
- */
+ if (!dev->public.on) {
+ if (EnableDevice(dev)) {
+ dev->startup = FALSE;
+ }
+ else {
+ ErrorF("couldn't enable device %s\n", dev->name);
+ *status = BadDevice;
+ return;
+ }
+ }
-void
-CloseInputDevice (DeviceIntPtr d, ClientPtr client)
-{
- ErrorF("ProcXCloseDevice to close or not ?\n");
+ *status = Success;
}
-
-/***********************************************************************
- *
- * Caller: ProcXListInputDevices
- *
- * This is the implementation-dependent routine to initialize an input
- * device to the point that information about it can be listed.
- * Some implementations open all input devices when the server is first
- * initialized, and never close them. Other implementations open only
- * the X pointer and keyboard devices during server initialization,
- * and only open other input devices when some client makes an
- * XOpenDevice request. If some other process has the device open, the
- * server may not be able to get information about the device to list it.
- *
- * This procedure should be used by implementations that do not initialize
- * all input devices at server startup. It should do device-dependent
- * initialization for any devices not previously initialized, and call
- * AddInputDevice for each of those devices so that a DeviceIntRec will be
- * created for them.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- * The commented-out sample code shows what you might do if you don't want
- * the default.
- *
- ***********************************************************************
- */
-
void
-AddOtherInputDevices ()
+CloseInputDevice(DeviceIntPtr dev,
+ ClientPtr client)
{
}
-
/****************************************************************************
*
* Caller: ProcXSetDeviceMode
@@ -591,9 +298,15 @@ SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
int
SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
- int first_valuator, int num_valuators)
+ int first_valuator, int num_valuators)
{
- return BadMatch;
+ LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
+
+ if (local->set_device_valuators)
+ return (*local->set_device_valuators)(local, valuators, first_valuator,
+ num_valuators);
+
+ return BadMatch;
}
@@ -612,251 +325,100 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
if (!local->control_proc) {
- return (BadMatch);
+ switch (control->control) {
+ case DEVICE_CORE:
+ case DEVICE_RESOLUTION:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return Success;
+ default:
+ return BadMatch;
+ }
}
else {
return (*local->control_proc)(local, control);
}
}
-#endif
-
-/*
- * adapted from mieq.c to support extended events
- *
- */
-#define QUEUE_SIZE 256
-
-typedef struct _Event {
- xEvent event;
-#ifdef XINPUT
- deviceValuator val;
-#endif
- ScreenPtr pScreen;
-} EventRec, *EventPtr;
-
-typedef struct _EventQueue {
- HWEventQueueType head, tail;
- CARD32 lastEventTime; /* to avoid time running backwards */
- Bool lastMotion;
- EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
-} EventQueueRec, *EventQueuePtr;
-
-static EventQueueRec xf86EventQueue;
-
-Bool
-xf86eqInit (DevicePtr pKbd, DevicePtr pPtr)
-{
- xf86EventQueue.head = xf86EventQueue.tail = 0;
- xf86EventQueue.lastEventTime = GetTimeInMillis ();
- xf86EventQueue.pKbd = pKbd;
- xf86EventQueue.pPtr = pPtr;
- xf86EventQueue.lastMotion = FALSE;
- xf86EventQueue.pEnqueueScreen = screenInfo.screens[0];
- xf86EventQueue.pDequeueScreen = xf86EventQueue.pEnqueueScreen;
- SetInputCheck (&xf86EventQueue.head, &xf86EventQueue.tail);
- return TRUE;
-}
-/*
- * Must be reentrant with ProcessInputEvents. Assumption: xf86eqEnqueue
- * will never be interrupted. If this is called from both signal
- * handlers and regular code, make sure the signal is suspended when
- * called from regular code.
- */
-
-_X_EXPORT void
-xf86eqEnqueue (xEvent *e)
-{
- int oldtail, newtail;
- Bool isMotion;
-#ifdef XINPUT
- int count;
-
- xf86AssertBlockedSIGIO ("xf86eqEnqueue");
- switch (e->u.u.type) {
- case KeyPress:
- case KeyRelease:
-#ifdef XFreeXDGA
- /* we do this here, because nobody seems to be calling
- xf86PostKeyEvent(). We can't steal MotionNotify events here
- because the motion-relative information has been lost already. */
- if(DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, e))
- return;
-#endif
- /* fall through */
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- count = 1;
- break;
- default:
-#ifdef XFreeXDGA
- if (DGAIsDgaEvent (e))
- {
- count = 1;
- break;
- }
-#endif
- if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS) {
- count = 1;
- }
- else {
- count = 2;
- }
- break;
- }
-#endif
-
- oldtail = xf86EventQueue.tail;
- isMotion = e->u.u.type == MotionNotify;
- if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head) {
- if (oldtail == 0)
- oldtail = QUEUE_SIZE;
- oldtail = oldtail - 1;
- }
- else {
- newtail = oldtail + 1;
- if (newtail == QUEUE_SIZE)
- newtail = 0;
- /* Toss events which come in late */
- if (newtail == xf86EventQueue.head)
- return;
- xf86EventQueue.tail = newtail;
- }
-
- xf86EventQueue.lastMotion = isMotion;
- xf86EventQueue.events[oldtail].event = *e;
-#ifdef XINPUT
- if (count == 2) {
- xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1));
- }
-#endif
- /*
- * Make sure that event times don't go backwards - this
- * is "unnecessary", but very useful
- */
- if (e->u.keyButtonPointer.time < xf86EventQueue.lastEventTime &&
- xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) {
-
- xf86EventQueue.events[oldtail].event.u.keyButtonPointer.time =
- xf86EventQueue.lastEventTime;
- }
- xf86EventQueue.events[oldtail].pScreen = xf86EventQueue.pEnqueueScreen;
-}
-
-/*
- * Call this from ProcessInputEvents()
- */
void
-xf86eqProcessInputEvents ()
+AddOtherInputDevices()
{
- EventRec *e;
- int x, y;
- struct {
- xEvent event;
-#ifdef XINPUT
- deviceValuator val;
-#endif
- } xe;
-#ifdef XINPUT
- DeviceIntPtr dev;
- int id, count;
- deviceKeyButtonPointer *dev_xe;
-#endif
-
- while (xf86EventQueue.head != xf86EventQueue.tail) {
- if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-#ifdef DPMSExtension
- else if (DPMSPowerLevel != DPMSModeOn)
- SetScreenSaverTimer();
-
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+}
#endif
- e = &xf86EventQueue.events[xf86EventQueue.head];
- /*
- * Assumption - screen switching can only occur on motion events
- */
- if (e->pScreen != xf86EventQueue.pDequeueScreen) {
- xf86EventQueue.pDequeueScreen = e->pScreen;
- x = e->event.u.keyButtonPointer.rootX;
- y = e->event.u.keyButtonPointer.rootY;
- if (xf86EventQueue.head == QUEUE_SIZE - 1)
- xf86EventQueue.head = 0;
- else
- ++xf86EventQueue.head;
- NewCurrentScreen (xf86EventQueue.pDequeueScreen, x, y);
- }
- else {
- xe.event = e->event;
- xe.val = e->val;
- if (xf86EventQueue.head == QUEUE_SIZE - 1)
- xf86EventQueue.head = 0;
- else
- ++xf86EventQueue.head;
- switch (xe.event.u.u.type) {
- case KeyPress:
- case KeyRelease:
- (*xf86EventQueue.pKbd->processInputProc)
- (&xe.event, (DeviceIntPtr)xf86EventQueue.pKbd, 1);
- break;
-#ifdef XINPUT
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- (*(inputInfo.pointer->public.processInputProc))
- (&xe.event, (DeviceIntPtr)inputInfo.pointer, 1);
- break;
-
- default:
-#ifdef XFreeXDGA
- if (DGADeliverEvent (xf86EventQueue.pDequeueScreen, &xe.event))
- break;
-#endif
- dev_xe = (deviceKeyButtonPointer *) &xe.event;
- id = dev_xe->deviceid & DEVICE_BITS;
- if (!(dev_xe->deviceid & MORE_EVENTS)) {
- count = 1;
- }
- else {
- count = 2;
- }
- dev = LookupDeviceIntRec(id);
- if (dev == NULL) {
- ErrorF("LookupDeviceIntRec id=0x%x not found\n", id);
-/* FatalError("xf86eqProcessInputEvents : device not found.\n");
- */
- break;
- }
- if (!dev->public.processInputProc) {
- FatalError("xf86eqProcessInputEvents : device has no input proc.\n");
- break;
- }
- (*dev->public.processInputProc)(&xe.event, dev, count);
-#else
- default:
- (*xf86EventQueue.pPtr->processInputProc)
- (&xe.event, (DeviceIntPtr)xf86EventQueue.pPtr, 1);
-#endif
- break;
- }
- }
- }
-}
+int
+NewInputDeviceRequest (InputOption *options)
+{
+ IDevRec *idev = NULL;
+ InputDriverPtr drv = NULL;
+ InputInfoPtr pInfo = NULL;
+ InputOption *option = NULL;
+ DeviceIntPtr dev = NULL;
+
+ idev = xcalloc(sizeof(*idev), 1);
+ if (!idev)
+ return BadAlloc;
+
+ for (option = options; option; option = option->next) {
+ if (strcmp(option->key, "driver") == 0) {
+ if (!xf86LoadOneModule(option->value, NULL))
+ return BadName;
+ drv = xf86LookupInputDriver(option->value);
+ if (!drv) {
+ xf86Msg(X_ERROR, "No input driver matching `%s'\n",
+ option->value);
+ return BadName;
+ }
+ idev->driver = xstrdup(option->value);
+ if (!idev->driver) {
+ xfree(idev);
+ return BadAlloc;
+ }
+ }
+ if (strcmp(option->key, "name") == 0 ||
+ strcmp(option->key, "identifier") == 0) {
+ idev->identifier = xstrdup(option->value);
+ if (!idev->identifier) {
+ xfree(idev);
+ return BadAlloc;
+ }
+ }
+ }
+
+ if (!drv->PreInit) {
+ xf86Msg(X_ERROR,
+ "Input driver `%s' has no PreInit function (ignoring)\n",
+ drv->driverName);
+ return BadImplementation;
+ }
+
+ idev->commonOptions = NULL;
+ for (option = options; option; option = option->next)
+ idev->commonOptions = xf86addNewOption(idev->commonOptions,
+ option->key, option->value);
+ idev->extraOptions = NULL;
+
+ pInfo = drv->PreInit(drv, idev, 0);
+
+ if (!pInfo) {
+ xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
+ return BadMatch;
+ }
+ else if (!(pInfo->flags & XI86_CONFIGURED)) {
+ xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+ idev->identifier);
+ xf86DeleteInput(pInfo, 0);
+ return BadMatch;
+ }
+
+ xf86ActivateDevice(pInfo);
+
+ dev = pInfo->dev;
+ dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ if (dev->inited && dev->startup)
+ EnableDevice(dev);
-void
-xf86eqSwitchScreen(ScreenPtr pScreen,
- Bool fromDIX)
-{
- xf86EventQueue.pEnqueueScreen = pScreen;
-
- if (fromDIX)
- xf86EventQueue.pDequeueScreen = pScreen;
+ return Success;
}
/*
@@ -865,479 +427,156 @@ xf86eqSwitchScreen(ScreenPtr pScreen,
_X_EXPORT void
xf86PostMotionEvent(DeviceIntPtr device,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- char *buff = 0;
- Time current;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_shared = xf86ShareCorePointer(device);
- Bool drag = xf86SendDragEvents(device);
- ValuatorClassPtr val = device->valuator;
- int valuator[6];
- int oldaxis[6];
- int *axisvals;
- int dx = 0, dy = 0;
- float mult;
- int x, y;
- int loop_start;
- int i;
- int num;
-
- DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) is_core=%s is_shared=%s is_absolute=%s\n",
- device, device->name,
- is_core ? "True" : "False",
- is_shared ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- xf86Info.lastEventTime = xev->time = current = GetTimeInMillis();
-
- if (!is_core) {
- if (HAS_MOTION_HISTORY(local)) {
- buff = ((char *)local->motion_history +
- (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
- }
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i = 0, nevents = 0;
+ Bool drag = xf86SendDragEvents(device);
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+ int *valuators = NULL;
+ int flags = 0;
- axisvals = val->axisVal;
+ if (is_absolute)
+ flags = POINTER_ABSOLUTE;
+ else
+ flags = POINTER_RELATIVE | POINTER_ACCELERATE;
- va_start(var, num_valuators);
+ valuators = xcalloc(sizeof(int), num_valuators);
- loop_start = first_valuator;
- for(loop=0; loop<num_valuators; loop++) {
-
- valuator[loop%6] = va_arg(var,int);
-
- if (loop % 6 == 5 || loop == num_valuators - 1) {
- num = loop % 6 + 1;
- /*
- * Adjust first two relative valuators
- */
- if (!is_absolute && num_valuators >= 2 && loop_start == 0) {
-
- dx = valuator[0];
- dy = valuator[1];
-
- /*
- * Accelerate
- */
- if (device->ptrfeed && device->ptrfeed->ctrl.num) {
- /* modeled from xf86Events.c */
- if (device->ptrfeed->ctrl.threshold) {
- if ((abs(dx) + abs(dy)) >= device->ptrfeed->ctrl.threshold) {
- local->dxremaind = ((float)dx * (float)(device->ptrfeed->ctrl.num)) /
- (float)(device->ptrfeed->ctrl.den) + local->dxremaind;
- valuator[0] = (int)local->dxremaind;
- local->dxremaind = local->dxremaind - (float)valuator[0];
-
- local->dyremaind = ((float)dy * (float)(device->ptrfeed->ctrl.num)) /
- (float)(device->ptrfeed->ctrl.den) + local->dyremaind;
- valuator[1] = (int)local->dyremaind;
- local->dyremaind = local->dyremaind - (float)valuator[1];
- }
- }
- else if (dx || dy) {
- mult = pow((float)(dx*dx+dy*dy),
- ((float)(device->ptrfeed->ctrl.num) /
- (float)(device->ptrfeed->ctrl.den) - 1.0) /
- 2.0) / 2.0;
- if (dx) {
- local->dxremaind = mult * (float)dx + local->dxremaind;
- valuator[0] = (int)local->dxremaind;
- local->dxremaind = local->dxremaind - (float)valuator[0];
- }
- if (dy) {
- local->dyremaind = mult * (float)dy + local->dyremaind;
- valuator[1] = (int)local->dyremaind;
- local->dyremaind = local->dyremaind - (float)valuator[1];
- }
- }
- DBG(6, ErrorF("xf86PostMotionEvent acceleration v0=%d v1=%d\n",
- valuator[0], valuator[1]));
- }
-
- /*
- * Map current position back to device space in case
- * the cursor was warped
- */
- if (is_core || is_shared)
- {
- miPointerPosition (&x, &y);
- if (local->reverse_conversion_proc)
- (*local->reverse_conversion_proc)(local, x, y, axisvals);
- else
- {
- axisvals[0] = x;
- axisvals[1] = y;
- }
- }
- }
-
- /*
- * Update axes
- */
- for (i = 0; i < num; i++)
- {
- oldaxis[i] = axisvals[loop_start + i];
- if (is_absolute)
- axisvals[loop_start + i] = valuator[i];
- else
- axisvals[loop_start + i] += valuator[i];
- }
-
- /*
- * Deliver extension event
- */
- if (!is_core) {
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
-
- xv->device_state = 0;
- xv->num_valuators = num;
- xv->first_valuator = loop_start;
- memcpy (&xv->valuator0, &axisvals[loop_start],
- sizeof(INT32)*xv->num_valuators);
-
- if (HAS_MOTION_HISTORY(local)) {
- *(Time*)buff = current;
- memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator,
- &axisvals[loop_start],
- sizeof(INT32)*xv->num_valuators);
- }
- ENQUEUE(xE);
- }
-
- /*
- * Deliver core event
- */
- if (is_core ||
- (is_shared && num_valuators >= 2 && loop_start == 0)) {
-#ifdef XFreeXDGA
- /*
- * Let DGA peek at the event and steal it
- */
- xev->type = MotionNotify;
- xev->detail = 0;
- if (is_absolute)
- {
- dx = axisvals[0] - oldaxis[0];
- dy = axisvals[1] - oldaxis[1];
- }
- if (DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum,
- xE, dx, dy))
- continue;
-#endif
- if (!(*local->conversion_proc)(local, loop_start, num,
- axisvals[0], axisvals[1],
- axisvals[2], axisvals[3],
- axisvals[4], axisvals[5],
- &x, &y))
- continue;
-
- if (drag)
- miPointerAbsoluteCursor (x, y, current);
- /*
- * Retrieve the position
- */
- miPointerPosition (&x, &y);
- if (local->reverse_conversion_proc)
- (*local->reverse_conversion_proc)(local, x, y, axisvals);
- else
- {
- axisvals[0] = x;
- axisvals[1] = y;
- }
- }
- loop_start += 6;
- }
- }
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
va_end(var);
- if (HAS_MOTION_HISTORY(local)) {
- local->last = (local->last + 1) % device->valuator->numMotionEvents;
- if (local->last == local->first)
- local->first = (local->first + 1) % device->valuator->numMotionEvents;
- }
- DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) is_core=%s is_shared=%s\n",
- device, device->name,
- is_core ? "True" : "False",
- is_shared ? "True" : "False"));
+
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
+ flags, first_valuator, num_valuators,
+ valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
xf86PostProximityEvent(DeviceIntPtr device,
- int is_in,
- int first_valuator,
- int num_valuators,
- ...)
+ int is_in,
+ int first_valuator,
+ int num_valuators,
+ ...)
{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- ValuatorClassPtr val = device->valuator;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_absolute = val && ((val->mode & 1) == Relative);
-
- DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- if (is_core) {
- return;
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ va_list var;
+ int i, nevents, *valuators = NULL;
- xev->type = is_in ? ProximityIn : ProximityOut;
- xev->detail = 0;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
+ valuators = xcalloc(sizeof(int), num_valuators);
- if ((device->valuator->mode & 1) == Relative) {
- num_valuators = 0;
- }
-
- if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
-
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- ENQUEUE(xE);
- }
- }
- va_end(var);
- }
- else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- ENQUEUE(xE);
- }
- DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ nevents = GetProximityEvents(xf86Events, device,
+ is_in ? ProximityIn : ProximityOut,
+ first_valuator, num_valuators, valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
xf86PostButtonEvent(DeviceIntPtr device,
- int is_absolute,
- int button,
- int is_down,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- ValuatorClassPtr val = device->valuator;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_shared = xf86ShareCorePointer(device);
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int *valuators = NULL;
+ int i = 0, nevents = 0;
- DBG(5, ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_core=%s is_shared=%s is_absolute=%s\n",
- device, device->name, button,
- is_down ? "True" : "False",
- is_core ? "True" : "False",
- is_shared ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- /* Check the core pointer button state not to send an inconsistent
- * event. This can happen with the AlwaysCore feature.
- */
- if ((is_core || is_shared) &&
- !xf86CheckButton(device->button->map[button], is_down))
- {
- return;
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ valuators = xcalloc(sizeof(int), num_valuators);
- if (!is_core) {
- xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease;
- xev->detail = button;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
-
- if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- ENQUEUE(xE);
-
- }
- }
- va_end(var);
- }
- else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- ENQUEUE(xE);
- }
- }
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
- /* removed rootX/rootY as DIX sets these fields */
- if (is_core || is_shared) {
- xE->u.u.type = is_down ? ButtonPress : ButtonRelease;
- xE->u.u.detail = device->button->map[button];
- xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis();
-
-#ifdef XFreeXDGA
- if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, 0, 0))
-#endif
- ENQUEUE(xE);
- }
- DBG(5, ErrorF("xf86PostButtonEvent END\n"));
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ nevents = GetPointerEvents(xf86Events, device,
+ is_down ? ButtonPress : ButtonRelease, button,
+ is_absolute ? POINTER_ABSOLUTE :
+ POINTER_RELATIVE,
+ first_valuator, num_valuators, valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
xf86PostKeyEvent(DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = va_arg(var, int);
- break;
- case 1:
- xv->valuator1 = va_arg(var, int);
- break;
- case 2:
- xv->valuator2 = va_arg(var, int);
- break;
- case 3:
- xv->valuator3 = va_arg(var, int);
- break;
- case 4:
- xv->valuator4 = va_arg(var, int);
- break;
- case 5:
- xv->valuator5 = va_arg(var, int);
- break;
- }
- if (((loop % 6 == 5) || (loop == num_valuators - 1))) {
- xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
- xev->detail = key_code;
-
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
- /* if the device is in the relative mode we don't have to send valuators */
- xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
-
- ENQUEUE(xE);
- /* if the device is in the relative mode only one event is needed */
- if (!is_absolute) break;
- }
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i = 0, nevents = 0, *valuators = NULL;
+
+ /* instil confidence in the user */
+ DebugF("this function has never been tested properly. if things go quite "
+ "badly south after this message, then xf86PostKeyEvent is "
+ "broken.\n");
+
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ if (is_absolute) {
+ valuators = xcalloc(sizeof(int), num_valuators);
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ nevents = GetKeyboardValuatorEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code, first_valuator,
+ num_valuators, valuators);
+ xfree(valuators);
}
- va_end(var);
+ else {
+ nevents = GetKeyboardEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code);
+ }
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@@ -1345,72 +584,18 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
unsigned int key_code,
int is_down)
{
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
-
- if (xf86IsCoreKeyboard(device)) {
- xev->type = is_down ? KeyPress : KeyRelease;
- } else {
- xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
- }
- xev->detail = key_code;
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ int nevents = 0, i = 0;
-#ifdef XFreeXDGA
- /* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */
-#endif
- ENQUEUE(xE);
-}
-
-/*
- * Motion history management.
- */
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
-_X_EXPORT void
-xf86MotionHistoryAllocate(LocalDevicePtr local)
-{
- ValuatorClassPtr valuator = local->dev->valuator;
-
- if (!HAS_MOTION_HISTORY(local))
- return;
- if (local->motion_history) xfree(local->motion_history);
- local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
- * valuator->numMotionEvents);
- local->first = 0;
- local->last = 0;
-}
+ nevents = GetKeyboardEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease, key_code);
-_X_EXPORT int
-xf86GetMotionEvents(DeviceIntPtr dev,
- xTimecoord *buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
-{
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- ValuatorClassPtr valuator = dev->valuator;
- int num = 0;
- int loop = local->first;
- int size;
- Time current;
-
- if (!HAS_MOTION_HISTORY(local))
- return 0;
-
- size = (sizeof(INT32) * valuator->numAxes + sizeof(Time));
-
- while (loop != local->last) {
- current = *(Time*)(((char *)local->motion_history)+loop*size);
- if (current > stop)
- return num;
- if (current >= start) {
- memcpy(((char *)buff)+size*num,
- ((char *)local->motion_history)+loop*size, size);
- num++;
- }
- loop = (loop + 1) % valuator->numMotionEvents;
- }
- return num;
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT LocalDevicePtr
@@ -1434,10 +619,10 @@ xf86FirstLocalDevice()
_X_EXPORT int
xf86ScaleAxis(int Cx,
- int Sxhigh,
- int Sxlow,
- int Rxhigh,
- int Rxlow )
+ int Sxhigh,
+ int Sxlow,
+ int Rxhigh,
+ int Rxlow )
{
int X;
int dSx = Sxhigh - Sxlow;
@@ -1472,9 +657,9 @@ xf86XInputSetScreen(LocalDevicePtr local,
int x,
int y)
{
- if ((xf86IsCorePointer(local->dev) || xf86ShareCorePointer(local->dev)) &&
- (miPointerCurrentScreen() != screenInfo.screens[screen_number])) {
- miPointerSetNewScreen (screen_number, x, y);
+ if (miPointerGetScreen(local->dev) !=
+ screenInfo.screens[screen_number]) {
+ miPointerSetScreen(local->dev, screen_number, x, y);
}
}
@@ -1483,17 +668,11 @@ _X_EXPORT void
xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res)
{
-#ifdef XINPUT
- if (maxval == -1) {
- if (axnum == 0)
- maxval = screenInfo.screens[0]->width - 1;
- else if (axnum == 1)
- maxval = screenInfo.screens[0]->height - 1;
- /* else? */
- }
+ if (!dev || !dev->valuator)
+ return;
+
InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
max_res);
-#endif
}
/*
@@ -1503,12 +682,14 @@ xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
_X_EXPORT void
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
-#ifdef XINPUT
- if (axnum == 0)
+ if (axnum == 0) {
dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
- else if (axnum == 1)
+ dev->valuator->lastx = dev->valuator->axisVal[0];
+ }
+ else if (axnum == 1) {
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
-#endif
+ dev->valuator->lasty = dev->valuator->axisVal[1];
+ }
}
/* end of xf86Xinput.c */
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 20bf0a9e1..fe65643ce 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -86,15 +86,6 @@
#define XI_PRIVATE(dev) \
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
-#ifdef DBG
-#undef DBG
-#endif
-#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
-
-#ifdef HAS_MOTION_HISTORY
-#undef HAS_MOTION_HISTORY
-#endif
-#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
#ifdef XINPUT
/* This holds the input driver entry and module information. */
@@ -118,7 +109,7 @@ typedef struct _LocalDeviceRec {
struct _LocalDeviceRec *next;
char * name;
int flags;
-
+
Bool (*device_control)(DeviceIntPtr device, int what);
void (*read_input)(struct _LocalDeviceRec *local);
int (*control_proc)(struct _LocalDeviceRec *local,
@@ -133,21 +124,20 @@ typedef struct _LocalDeviceRec {
Bool (*reverse_conversion_proc)(
struct _LocalDeviceRec *local,
int x, int y, int *valuators);
-
+ int (*set_device_valuators)
+ (struct _LocalDeviceRec *local,
+ int *valuators, int first_valuator,
+ int num_valuators);
+
int fd;
Atom atom;
DeviceIntPtr dev;
pointer private;
int private_flags;
- pointer motion_history;
- ValuatorMotionProcPtr motion_history_proc;
- unsigned int history_size; /* only for configuration purpose */
unsigned int first;
unsigned int last;
int old_x;
int old_y;
- float dxremaind;
- float dyremaind;
char * type_name;
IntegerFeedbackPtr always_core_feedback;
IDevPtr conf_idev;
@@ -166,16 +156,7 @@ typedef struct _DeviceAssocRec
extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
-int xf86IsCorePointer(DeviceIntPtr dev);
-int xf86IsCoreKeyboard(DeviceIntPtr dev);
-void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
-#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
-
void InitExtInput(void);
-Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
-void xf86eqEnqueue(struct _xEvent *event);
-void xf86eqProcessInputEvents (void);
-void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, ...);
void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
@@ -188,10 +169,6 @@ void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
...);
void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
int is_down);
-void xf86MotionHistoryAllocate(LocalDevicePtr local);
-int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
void xf86XinputFinalizeInit(DeviceIntPtr dev);
void xf86ActivateDevice(LocalDevicePtr local);
Bool xf86CheckButton(int button, int down);
@@ -211,10 +188,16 @@ void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
void xf86DeleteInputDriver(int drvIndex);
InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+InputDriverPtr xf86LookupInputDriver(const char *name);
+InputInfoPtr xf86LookupInput(const char *name);
void xf86DeleteInput(InputInfoPtr pInp, int flags);
/* xf86Option.c */
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts);
+/* Legacy hatred */
+#define SendCoreEvents 59
+#define DontSendCoreEvents 60
+
#endif /* _xf86Xinput_h */
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 3f959faa2..46d6a024d 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -191,8 +191,6 @@ _X_HIDDEN void *miLookupTab[] = {
SYMFUNC(miSegregateChildren)
SYMFUNC(miHookInitVisuals)
SYMFUNC(miPointerAbsoluteCursor)
- SYMFUNC(miPointerGetMotionEvents)
- SYMFUNC(miPointerGetMotionBufferSize)
SYMFUNC(miOverlayCopyUnderlay)
SYMFUNC(miOverlaySetTransFunction)
SYMFUNC(miOverlayCollectUnderlayRegions)
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index a498cccbd..3051dedaf 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -70,7 +70,6 @@
# include "xf86Xinput.h"
#endif
#include "xf86OSmouse.h"
-#include "xf86OSKbd.h"
#include "xf86xv.h"
#include "xf86xvmc.h"
#include "xf86cmap.h"
@@ -280,7 +279,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86SerialModemClearBits)
SYMFUNC(xf86LoadKernelModule)
SYMFUNC(xf86OSMouseInit)
- SYMFUNC(xf86OSKbdPreInit)
SYMFUNC(xf86AgpGARTSupported)
SYMFUNC(xf86GetAGPInfo)
SYMFUNC(xf86AcquireGART)
@@ -290,10 +288,8 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86BindGARTMemory)
SYMFUNC(xf86UnbindGARTMemory)
SYMFUNC(xf86EnableAGP)
- SYMFUNC(xf86SoundKbdBell)
SYMFUNC(xf86GARTCloseScreen)
#ifdef XINPUT
- /* XISB routines (Merged from Metrolink tree) */
SYMFUNC(XisbNew)
SYMFUNC(XisbFree)
SYMFUNC(XisbRead)
@@ -696,22 +692,15 @@ _X_HIDDEN void *xfree86LookupTab[] = {
/* xf86Xinput.c */
#ifdef XINPUT
SYMFUNC(xf86ProcessCommonOptions)
- SYMFUNC(xf86IsCorePointer)
SYMFUNC(xf86PostMotionEvent)
SYMFUNC(xf86PostProximityEvent)
SYMFUNC(xf86PostButtonEvent)
SYMFUNC(xf86PostKeyEvent)
SYMFUNC(xf86PostKeyboardEvent)
- SYMFUNC(xf86GetMotionEvents)
- SYMFUNC(xf86MotionHistoryAllocate)
SYMFUNC(xf86FirstLocalDevice)
- SYMFUNC(xf86eqEnqueue)
SYMFUNC(xf86ActivateDevice)
-/* The following segment merged from Metrolink tree */
SYMFUNC(xf86XInputSetScreen)
SYMFUNC(xf86ScaleAxis)
- SYMFUNC(xf86XInputSetSendCoreEvents)
-/* End merged segment */
#endif
#ifdef DPMSExtension
SYMFUNC(DPMSGet)
diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am
index e64703a53..131c49526 100644
--- a/hw/xfree86/os-support/Makefile.am
+++ b/hw/xfree86/os-support/Makefile.am
@@ -6,7 +6,7 @@ SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
DIST_SUBDIRS = bsd bus drm misc linux lynxos solaris sysv sco usl hurd
sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h xf86_ansic.h xf86_libc.h \
- assyntax.h xf86OSKbd.h xf86OSmouse.h
+ assyntax.h xf86OSmouse.h
EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib xf86drm.h
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 20885e866..e456328df 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -55,19 +55,15 @@ AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS)
INCLUDES = $(XORG_INCS)
libbsd_la_SOURCES = \
- $(srcdir)/../shared/at_scancode.c \
$(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c \
- $(srcdir)/../shared/std_kbdEv.c \
$(srcdir)/../shared/stdPci.c \
$(srcdir)/../shared/vidmem.c \
bsd_VTsw.c \
bsd_init.c \
- bsd_io.c \
- bsd_kbd.c \
- bsd_KbdMap.c \
bsd_mouse.c \
+ bsd_bell.c \
$(ARCH_SOURCES) \
$(AGP_SOURCES) \
$(APM_SOURCES) \
@@ -80,7 +76,6 @@ libbsd_la_SOURCES = \
EXTRA_DIST = \
bsd_apm.c \
bsd_jstk.c \
- bsd_kbd.h \
bsd_kqueue_apm.c \
bsdResource.c \
memrange.h \
diff --git a/hw/xfree86/os-support/bsd/bsd_KbdMap.c b/hw/xfree86/os-support/bsd/bsd_KbdMap.c
deleted file mode 100644
index d225c1f38..000000000
--- a/hw/xfree86/os-support/bsd/bsd_KbdMap.c
+++ /dev/null
@@ -1,1087 +0,0 @@
-/* $XFree86$ */
-
-/*
- * Slightly modified xf86KbdBSD.c which is
- *
- * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
- * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * and from xf86KbdCODrv.c by Holger Veit
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-#include "bsd_kbd.h"
-
-#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP)
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-
-static unsigned char remap[NUM_KEYCODES] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes the ibm code page 437 coding for characters
- * > 0x80. They are returned in this form by PCVT */
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- /* This has been checked against what syscons actually does */
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol
-};
-
-#ifdef __OpenBSD__
-/* don't mark AltR and CtrlR for remapping, since they
- * cannot be remapped by pccons */
-static unsigned char pccons_remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes an iso8859_1 encoding for the characters
- * > 80, as returned by pccons */
-static KeySym latin1_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
- };
-#endif
-
-#ifdef SYSCONS_SUPPORT
-static
-unsigned char sysconsCODEMap[] = {
- KEY_KP_Enter, KEY_RCtrl, KEY_KP_Divide, KEY_Print,
- KEY_AltLang, KEY_KP_7, KEY_KP_8, KEY_KP_9,
- KEY_KP_4, KEY_KP_6, KEY_KP_1, KEY_KP_2,
- KEY_KP_3, KEY_KP_0, KEY_KP_Decimal, KEY_Pause,
- KEY_LMeta, KEY_RMeta, KEY_Menu, KEY_Break
-};
-static
-TransMapRec sysconsCODE = {
- 0x59,
- 0x6d,
- sysconsCODEMap
-};
-#endif
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-
-#ifdef WSCONS_SUPPORT
-
-static CARD8 wsUsbMap[] = {
- /* 0 */ KEY_NOTUSED,
- /* 1 */ KEY_NOTUSED,
- /* 2 */ KEY_NOTUSED,
- /* 3 */ KEY_NOTUSED,
- /* 4 */ KEY_A,
- /* 5 */ KEY_B,
- /* 6 */ KEY_C,
- /* 7 */ KEY_D,
- /* 8 */ KEY_E,
- /* 9 */ KEY_F,
- /* 10 */ KEY_G,
- /* 11 */ KEY_H,
- /* 12 */ KEY_I,
- /* 13 */ KEY_J,
- /* 14 */ KEY_K,
- /* 15 */ KEY_L,
- /* 16 */ KEY_M,
- /* 17 */ KEY_N,
- /* 18 */ KEY_O,
- /* 19 */ KEY_P,
- /* 20 */ KEY_Q,
- /* 21 */ KEY_R,
- /* 22 */ KEY_S,
- /* 23 */ KEY_T,
- /* 24 */ KEY_U,
- /* 25 */ KEY_V,
- /* 26 */ KEY_W,
- /* 27 */ KEY_X,
- /* 28 */ KEY_Y,
- /* 29 */ KEY_Z,
- /* 30 */ KEY_1, /* 1 !*/
- /* 31 */ KEY_2, /* 2 @ */
- /* 32 */ KEY_3, /* 3 # */
- /* 33 */ KEY_4, /* 4 $ */
- /* 34 */ KEY_5, /* 5 % */
- /* 35 */ KEY_6, /* 6 ^ */
- /* 36 */ KEY_7, /* 7 & */
- /* 37 */ KEY_8, /* 8 * */
- /* 38 */ KEY_9, /* 9 ( */
- /* 39 */ KEY_0, /* 0 ) */
- /* 40 */ KEY_Enter, /* Return */
- /* 41 */ KEY_Escape, /* Escape */
- /* 42 */ KEY_BackSpace, /* Backspace Delete */
- /* 43 */ KEY_Tab, /* Tab */
- /* 44 */ KEY_Space, /* Space */
- /* 45 */ KEY_Minus, /* - _ */
- /* 46 */ KEY_Equal, /* = + */
- /* 47 */ KEY_LBrace, /* [ { */
- /* 48 */ KEY_RBrace, /* ] } */
- /* 49 */ KEY_BSlash, /* \ | */
- /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */
- /* 51 */ KEY_SemiColon, /* ; : */
- /* 52 */ KEY_Quote, /* ' " */
- /* 53 */ KEY_Tilde, /* ` ~ */
- /* 54 */ KEY_Comma, /* , < */
- /* 55 */ KEY_Period, /* . > */
- /* 56 */ KEY_Slash, /* / ? */
- /* 57 */ KEY_CapsLock, /* Caps Lock */
- /* 58 */ KEY_F1, /* F1 */
- /* 59 */ KEY_F2, /* F2 */
- /* 60 */ KEY_F3, /* F3 */
- /* 61 */ KEY_F4, /* F4 */
- /* 62 */ KEY_F5, /* F5 */
- /* 63 */ KEY_F6, /* F6 */
- /* 64 */ KEY_F7, /* F7 */
- /* 65 */ KEY_F8, /* F8 */
- /* 66 */ KEY_F9, /* F9 */
- /* 67 */ KEY_F10, /* F10 */
- /* 68 */ KEY_F11, /* F11 */
- /* 69 */ KEY_F12, /* F12 */
- /* 70 */ KEY_Print, /* PrintScrn SysReq */
- /* 71 */ KEY_ScrollLock, /* Scroll Lock */
- /* 72 */ KEY_Pause, /* Pause Break */
- /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
- /* 74 */ KEY_Home, /* Home */
- /* 75 */ KEY_PgUp, /* Page Up */
- /* 76 */ KEY_Delete, /* Delete */
- /* 77 */ KEY_End, /* End */
- /* 78 */ KEY_PgDown, /* Page Down */
- /* 79 */ KEY_Right, /* Right Arrow */
- /* 80 */ KEY_Left, /* Left Arrow */
- /* 81 */ KEY_Down, /* Down Arrow */
- /* 82 */ KEY_Up, /* Up Arrow */
- /* 83 */ KEY_NumLock, /* Num Lock */
- /* 84 */ KEY_KP_Divide, /* Keypad / */
- /* 85 */ KEY_KP_Multiply, /* Keypad * */
- /* 86 */ KEY_KP_Minus, /* Keypad - */
- /* 87 */ KEY_KP_Plus, /* Keypad + */
- /* 88 */ KEY_KP_Enter, /* Keypad Enter */
- /* 89 */ KEY_KP_1, /* Keypad 1 End */
- /* 90 */ KEY_KP_2, /* Keypad 2 Down */
- /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
- /* 92 */ KEY_KP_4, /* Keypad 4 Left */
- /* 93 */ KEY_KP_5, /* Keypad 5 */
- /* 94 */ KEY_KP_6, /* Keypad 6 */
- /* 95 */ KEY_KP_7, /* Keypad 7 Home */
- /* 96 */ KEY_KP_8, /* Keypad 8 Up */
- /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
- /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
- /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
- /* 100 */ KEY_Less, /* < > on some keyboards */
- /* 101 */ KEY_Menu, /* Menu */
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_NOTUSED,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_NOTUSED,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_NOTUSED,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_NOTUSED,
- /* 116 */ KEY_NOTUSED,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_NOTUSED,
- /* 119 */ KEY_NOTUSED,
- /* 120 */ KEY_NOTUSED,
- /* 121 */ KEY_NOTUSED,
- /* 122 */ KEY_NOTUSED,
- /* 123 */ KEY_NOTUSED,
- /* 124 */ KEY_NOTUSED,
- /* 125 */ KEY_NOTUSED,
- /* 126 */ KEY_NOTUSED,
- /* 127 */ KEY_NOTUSED,
- /* 128 */ KEY_NOTUSED,
- /* 129 */ KEY_NOTUSED,
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
- /* 224 */ KEY_LCtrl, /* Left Control */
- /* 225 */ KEY_ShiftL, /* Left Shift */
- /* 226 */ KEY_Alt, /* Left Alt */
- /* 227 */ KEY_LMeta, /* Left Meta */
- /* 228 */ KEY_RCtrl, /* Right Control */
- /* 229 */ KEY_ShiftR, /* Right Shift */
- /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
- /* 231 */ KEY_LMeta, /* Right Meta XXX */
-};
-#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
-
-static
-TransMapRec wsUsb = {
- 0,
- WS_USB_MAP_SIZE,
- wsUsbMap
-};
-
-/* Map for adb keyboards */
-static CARD8 wsAdbMap[] = {
- /* 0 */ KEY_A,
- /* 1 */ KEY_S,
- /* 2 */ KEY_D,
- /* 3 */ KEY_F,
- /* 4 */ KEY_H,
- /* 5 */ KEY_G,
- /* 6 */ KEY_Z,
- /* 7 */ KEY_X,
- /* 8 */ KEY_C,
- /* 9 */ KEY_V,
- /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */
- /* 11 */ KEY_B,
- /* 12 */ KEY_Q,
- /* 13 */ KEY_W,
- /* 14 */ KEY_E,
- /* 15 */ KEY_R,
- /* 16 */ KEY_Y,
- /* 17 */ KEY_T,
- /* 18 */ KEY_1,
- /* 19 */ KEY_2,
- /* 20 */ KEY_3,
- /* 21 */ KEY_4,
- /* 22 */ KEY_6,
- /* 23 */ KEY_5,
- /* 24 */ KEY_Equal,
- /* 25 */ KEY_9,
- /* 26 */ KEY_7,
- /* 27 */ KEY_Minus,
- /* 28 */ KEY_8,
- /* 29 */ KEY_0,
- /* 30 */ KEY_RBrace,
- /* 31 */ KEY_O,
- /* 32 */ KEY_U,
- /* 33 */ KEY_LBrace,
- /* 34 */ KEY_I,
- /* 35 */ KEY_P,
- /* 36 */ KEY_Enter,
- /* 37 */ KEY_L,
- /* 38 */ KEY_J,
- /* 39 */ KEY_Quote,
- /* 40 */ KEY_K,
- /* 41 */ KEY_SemiColon,
- /* 42 */ KEY_BSlash,
- /* 43 */ KEY_Comma,
- /* 44 */ KEY_Slash,
- /* 45 */ KEY_N,
- /* 46 */ KEY_M,
- /* 47 */ KEY_Period,
- /* 48 */ KEY_Tab,
- /* 49 */ KEY_Space,
- /* 50 */ KEY_Tilde,
- /* 51 */ KEY_Delete,
- /* 52 */ KEY_AltLang,
- /* 53 */ KEY_Escape,
- /* 54 */ KEY_LCtrl,
- /* 55 */ KEY_Alt,
- /* 56 */ KEY_ShiftL,
- /* 57 */ KEY_CapsLock,
- /* 58 */ KEY_LMeta,
- /* 59 */ KEY_Left,
- /* 60 */ KEY_Right,
- /* 61 */ KEY_Down,
- /* 62 */ KEY_Up,
- /* 63 */ KEY_UNKNOWN, /* Fn */
- /* 64 */ KEY_NOTUSED,
- /* 65 */ KEY_KP_Decimal,
- /* 66 */ KEY_NOTUSED,
- /* 67 */ KEY_KP_Multiply,
- /* 68 */ KEY_NOTUSED,
- /* 69 */ KEY_KP_Plus,
- /* 70 */ KEY_NOTUSED,
- /* 71 */ KEY_UNKNOWN, /* Clear */
- /* 72 */ KEY_NOTUSED,
- /* 73 */ KEY_NOTUSED,
- /* 74 */ KEY_NOTUSED,
- /* 75 */ KEY_KP_Divide,
- /* 76 */ KEY_KP_Enter,
- /* 77 */ KEY_NOTUSED,
- /* 78 */ KEY_KP_Minus,
- /* 79 */ KEY_NOTUSED,
- /* 80 */ KEY_NOTUSED,
- /* 81 */ KEY_KP_Equal, /* Keypad = */
- /* 82 */ KEY_KP_0,
- /* 83 */ KEY_KP_1,
- /* 84 */ KEY_KP_2,
- /* 85 */ KEY_KP_3,
- /* 86 */ KEY_KP_4,
- /* 87 */ KEY_KP_5,
- /* 88 */ KEY_KP_6,
- /* 89 */ KEY_KP_7,
- /* 90 */ KEY_NOTUSED,
- /* 91 */ KEY_KP_8,
- /* 92 */ KEY_KP_9,
- /* 93 */ KEY_NOTUSED,
- /* 94 */ KEY_NOTUSED,
- /* 95 */ KEY_UNKNOWN, /* Keypad , */
- /* 96 */ KEY_F5,
- /* 97 */ KEY_F6,
- /* 98 */ KEY_F7,
- /* 99 */ KEY_F3,
- /* 100 */ KEY_F8,
- /* 101 */ KEY_F9,
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_F11,
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_KP_Enter,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_F10,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_F12,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_Home,
- /* 116 */ KEY_PgUp,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_F4,
- /* 119 */ KEY_End,
- /* 120 */ KEY_F2,
- /* 121 */ KEY_PgDown,
- /* 122 */ KEY_F1
-};
-#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
-
-static
-TransMapRec wsAdb = {
- 0,
- WS_ADB_MAP_SIZE,
- wsAdbMap
-};
-
-static CARD8 wsSunMap[] = {
- /* 0x00 */ KEY_Help,
- /* 0x01 */ KEY_L1, /* stop */
- /* 0x02 */ KEY_AudioLower, /* BrightnessDown / S-VolumeDown */
- /* 0x03 */ KEY_L2, /* again */
- /* 0x04 */ KEY_AudioRaise, /* BridgtnessUp / S-VolumeUp */
- /* 0x05 */ KEY_F1,
- /* 0x06 */ KEY_F2,
- /* 0x07 */ KEY_F10,
- /* 0x08 */ KEY_F3,
- /* 0x09 */ KEY_F11,
- /* 0x0a */ KEY_F4,
- /* 0x0b */ KEY_F12,
- /* 0x0c */ KEY_F5,
- /* 0x0d */ KEY_AltLang,
- /* 0x0e */ KEY_F6,
- /* 0x0f */ KEY_NOTUSED,
- /* 0x10 */ KEY_F7,
- /* 0x11 */ KEY_F8,
- /* 0x12 */ KEY_F9,
- /* 0x13 */ KEY_Alt,
- /* 0x14 */ KEY_Up,
- /* 0x15 */ KEY_Pause,
- /* 0x16 */ KEY_Print,
- /* 0x17 */ KEY_ScrollLock,
- /* 0x18 */ KEY_Left,
- /* 0x19 */ KEY_L3, /* props */
- /* 0x1a */ KEY_L4, /* undo */
- /* 0x1b */ KEY_Down,
- /* 0x1c */ KEY_Right,
- /* 0x1d */ KEY_Escape,
- /* 0x1e */ KEY_1,
- /* 0x1f */ KEY_2,
- /* 0x20 */ KEY_3,
- /* 0x21 */ KEY_4,
- /* 0x22 */ KEY_5,
- /* 0x23 */ KEY_6,
- /* 0x24 */ KEY_7,
- /* 0x25 */ KEY_8,
- /* 0x26 */ KEY_9,
- /* 0x27 */ KEY_0,
- /* 0x28 */ KEY_Minus,
- /* 0x29 */ KEY_Equal,
- /* 0x2a */ KEY_Tilde,
- /* 0x2b */ KEY_BackSpace,
- /* 0x2c */ KEY_Insert,
- /* 0x2d */ KEY_Mute, /* Audio Mute */
- /* 0x2e */ KEY_KP_Divide,
- /* 0x2f */ KEY_KP_Multiply,
- /* 0x30 */ KEY_NOTUSED,
- /* 0x31 */ KEY_L5, /* front */
- /* 0x32 */ KEY_KP_Decimal,
- /* 0x33 */ KEY_L6, /* copy */
- /* 0x34 */ KEY_Home,
- /* 0x35 */ KEY_Tab,
- /* 0x36 */ KEY_Q,
- /* 0x37 */ KEY_W,
- /* 0x38 */ KEY_E,
- /* 0x39 */ KEY_R,
- /* 0x3a */ KEY_T,
- /* 0x3b */ KEY_Y,
- /* 0x3c */ KEY_U,
- /* 0x3d */ KEY_I,
- /* 0x3e */ KEY_O,
- /* 0x3f */ KEY_P,
- /* 0x40 */ KEY_LBrace,
- /* 0x41 */ KEY_RBrace,
- /* 0x42 */ KEY_Delete,
- /* 0x43 */ KEY_Menu, /* compose */
- /* 0x44 */ KEY_KP_7,
- /* 0x45 */ KEY_KP_8,
- /* 0x46 */ KEY_KP_9,
- /* 0x47 */ KEY_KP_Minus,
- /* 0x48 */ KEY_L7, /* open */
- /* 0x49 */ KEY_L8, /* paste */
- /* 0x4a */ KEY_End,
- /* 0x4b */ KEY_NOTUSED,
- /* 0x4c */ KEY_LCtrl,
- /* 0x4d */ KEY_A,
- /* 0x4e */ KEY_S,
- /* 0x4f */ KEY_D,
- /* 0x50 */ KEY_F,
- /* 0x51 */ KEY_G,
- /* 0x52 */ KEY_H,
- /* 0x53 */ KEY_J,
- /* 0x54 */ KEY_K,
- /* 0x55 */ KEY_L,
- /* 0x56 */ KEY_SemiColon,
- /* 0x57 */ KEY_Quote,
- /* 0x58 */ KEY_BSlash,
- /* 0x59 */ KEY_Enter,
- /* 0x5a */ KEY_KP_Enter,
- /* 0x5b */ KEY_KP_4,
- /* 0x5c */ KEY_KP_5,
- /* 0x5d */ KEY_KP_6,
- /* 0x5e */ KEY_KP_0,
- /* 0x5f */ KEY_L9, /* find */
- /* 0x60 */ KEY_PgUp,
- /* 0x61 */ KEY_L10, /* cut */
- /* 0x62 */ KEY_NumLock,
- /* 0x63 */ KEY_ShiftL,
- /* 0x64 */ KEY_Z,
- /* 0x65 */ KEY_X,
- /* 0x66 */ KEY_C,
- /* 0x67 */ KEY_V,
- /* 0x68 */ KEY_B,
- /* 0x69 */ KEY_N,
- /* 0x6a */ KEY_M,
- /* 0x6b */ KEY_Comma,
- /* 0x6c */ KEY_Period,
- /* 0x6d */ KEY_Slash,
- /* 0x6e */ KEY_ShiftR,
- /* 0x6f */ KEY_NOTUSED, /* linefeed */
- /* 0x70 */ KEY_KP_1,
- /* 0x71 */ KEY_KP_2,
- /* 0x72 */ KEY_KP_3,
- /* 0x73 */ KEY_NOTUSED,
- /* 0x74 */ KEY_NOTUSED,
- /* 0x75 */ KEY_NOTUSED,
- /* 0x76 */ KEY_NOTUSED, /* help */
- /* 0x77 */ KEY_CapsLock,
- /* 0x78 */ KEY_LMeta,
- /* 0x79 */ KEY_Space,
- /* 0x7a */ KEY_RMeta,
- /* 0x7b */ KEY_PgDown,
- /* 0x7c */ KEY_Less, /* < > on some keyboards */
- /* 0x7d */ KEY_KP_Plus,
- /* 0x7e */ KEY_NOTUSED,
- /* 0x7f */ KEY_NOTUSED
-};
-#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
-
-static
-TransMapRec wsSun = {
- 0,
- WS_SUN_MAP_SIZE,
- wsSunMap
-};
-
-#endif /* WSCONS_SUPPORT */
-
-/*ARGSUSED*/
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- KeySym *k;
- int i;
-
-#ifndef __bsdi__
- switch (pKbd->consType) {
-
-#ifdef PCCONS_SUPPORT
- case PCCONS:
-#if defined(__OpenBSD__)
- /*
- * on OpenBSD, the pccons keymap is programmable, too
- */
- {
- pccons_keymap_t keymap[KB_NUM_KEYS];
- if (ioctl(pInfo->fd, CONSOLE_GET_KEYMAP, &keymap) != -1) {
- for (i = 0; i < KB_NUM_KEYS; i++)
- if (pccons_remap[i]) {
- k = map + (pccons_remap[i] << 2);
- switch (keymap[i].type) {
- case KB_ASCII:
- /* For ASCII keys, there is only one char in the keymap */
- k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]];
- k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]];
- k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]];
- k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]];
- break;
- case KB_SCROLL:
- k[0] = XK_Scroll_Lock;
- goto special;
- case KB_NUM:
- k[0] = XK_Num_Lock;
- goto special;
- case KB_CAPS:
- k[0] = XK_Caps_Lock;
- goto special;
- case KB_SHIFT:
- switch (keymap[i].unshift[0]) {
- case 1:
- /* left shift */
- k[0] = XK_Shift_L;
- break;
- case 2:
- /* right shift */
- k[0] = XK_Shift_R;
- break;
- default:
- k[0] = NoSymbol;
- }
- goto special;
- case KB_CTL:
- k[0] = XK_Control_L;
- goto special;
- case KB_ALT:
- k[0] = XK_Alt_L;
- goto special;
- case KB_FUNC:
- switch (keymap[i].unshift[2]) {
- case 'M':
- k[0] = XK_F1;
- break;
- case 'N':
- k[0] = XK_F2;
- break;
- case 'O':
- k[0] = XK_F3;
- break;
- case 'P':
- k[0] = XK_F4;
- break;
- case 'Q':
- k[0] = XK_F5;
- break;
- case 'R':
- k[0] = XK_F6;
- break;
- case 'S':
- k[0] = XK_F7;
- break;
- case 'T':
- k[0] = XK_F8;
- break;
- case 'U':
- k[0] = XK_F9;
- break;
- case 'V':
- k[0] = XK_F10;
- break;
- case 'W':
- k[0] = XK_F11;
- break;
- case 'X':
- k[0] = XK_F12;
- break;
- default:
- k[0] = NoSymbol;
- break;
- }
- goto special;
- default:
- k[0] = NoSymbol;
- special:
- k[1] = k[2] = k[3] = NoSymbol;
- }
- }
- } else {
- ErrorF("Can't read pccons keymap\n");
- }
- }
-#endif /* __OpenBSD__ */
- break;
-#endif
-
-/*
- * XXX wscons has no GIO_KEYMAP
- */
-#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP)
- case SYSCONS:
- case PCVT:
- {
- keymap_t keymap;
-
- if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) {
- for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
- if (remap[i]) {
- k = map + (remap[i] << 2);
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3])
- k[2] = k[3] = NoSymbol;
- }
- }
- }
- break;
-#endif /* SYSCONS || PCVT */
-
- }
-#endif /* !bsdi */
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- pKbd->kbdType = 0;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-
- switch(pKbd->consType) {
-#ifdef SYSCONS_SUPPORT
- case SYSCONS:
- if (pKbd->CustomKeycodes)
- pKbd->scancodeMap = &sysconsCODE;
- else
- pKbd->RemapScanCode = ATScancode;
- break;
-#endif
-#if defined(PCCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case PCCONS:
- case PCVT:
- pKbd->RemapScanCode = ATScancode;
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- if (!pKbd->isConsole) {
- switch (pKbd->wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- case WSKBD_TYPE_PC_AT:
- pKbd->RemapScanCode = ATScancode;
- break;
- case WSKBD_TYPE_USB:
- pKbd->scancodeMap = &wsUsb;
- break;
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- pKbd->scancodeMap = &wsAdb;
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
-#endif
- case WSKBD_TYPE_SUN:
- pKbd->scancodeMap = &wsSun;
- break;
-#endif
- default:
- ErrorF("Unknown wskbd type %d\n", pKbd->wsKbdType);
- }
- } else {
- pKbd->RemapScanCode = ATScancode;
- }
- break;
-#endif
- }
- return;
-}
diff --git a/hw/xfree86/os-support/bsd/bsd_bell.c b/hw/xfree86/os-support/bsd/bsd_bell.c
new file mode 100644
index 000000000..60c2ffc8b
--- /dev/null
+++ b/hw/xfree86/os-support/bsd/bsd_bell.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Dawes <dawes@xfree86.org>
+ *
+ * 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, and that the names of Rich Murphey and David Dawes
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Dawes make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE 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.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <termios.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef WSCONS_SUPPORT
+#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
+#endif
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+#ifdef WSCONS_SUPPORT
+ struct wskbd_bell_data wsb;
+#endif
+
+ if (loudness && pitch)
+ {
+#ifdef PCCONS_SUPPORT
+ int data[2];
+#endif
+
+ switch (xf86Info.consType) {
+
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ data[0] = pitch;
+ data[1] = (duration * loudness) / 50;
+ ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
+ break;
+#endif
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration*loudness/50)<<16));
+ break;
+#endif
+#if defined (WSCONS_SUPPORT)
+ case WSCONS:
+ wsb.which = WSKBD_BELL_DOALL;
+ wsb.pitch = pitch;
+ wsb.period = duration;
+ wsb.volume = loudness;
+ ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
+ &wsb);
+ break;
+#endif
+ }
+ }
+}
diff --git a/hw/xfree86/os-support/bsd/bsd_io.c b/hw/xfree86/os-support/bsd/bsd_io.c
deleted file mode 100644
index b433d7ba3..000000000
--- a/hw/xfree86/os-support/bsd/bsd_io.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and that the names of Rich Murphey and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Rich Murphey and
- * David Dawes make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE 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.
- *
- */
-/* $XConsortium: bsd_io.c /main/11 1996/10/19 18:06:07 kaleb $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <termios.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#ifdef WSCONS_SUPPORT
-#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
-#endif
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
-#ifdef WSCONS_SUPPORT
- struct wskbd_bell_data wsb;
-#endif
-
- if (loudness && pitch)
- {
-#ifdef PCCONS_SUPPORT
- int data[2];
-#endif
-
- switch (xf86Info.consType) {
-
-#ifdef PCCONS_SUPPORT
- case PCCONS:
- data[0] = pitch;
- data[1] = (duration * loudness) / 50;
- ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
- break;
-#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration*loudness/50)<<16));
- break;
-#endif
-#if defined (WSCONS_SUPPORT)
- case WSCONS:
- wsb.which = WSKBD_BELL_DOALL;
- wsb.pitch = pitch;
- wsb.period = duration;
- wsb.volume = loudness;
- ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
- &wsb);
- break;
-#endif
- }
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- switch (xf86Info.consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(KBD_FD(xf86Info), WSKBDIO_SETLEDS, &leds);
- break;
-#endif
- }
-}
-
-int
-xf86GetKbdLeds()
-{
- int leds = 0;
-
- switch (xf86Info.consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(KBD_FD(xf86Info), WSKBDIO_GETLEDS, &leds);
- break;
-#endif
- }
- return(leds);
-}
-
-void
-xf86SetKbdRepeat(char rad)
-{
- switch (xf86Info.consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSETRAD, rad);
- break;
-#endif
- }
-}
-
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
-static struct termios kbdtty;
-#endif
-
-void
-xf86KbdInit()
-{
- switch (xf86Info.consType) {
-
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case PCCONS:
- case SYSCONS:
- case PCVT:
- tcgetattr(xf86Info.consoleFd, &kbdtty);
- break;
-#endif
-#if defined WSCONS_SUPPORT
- case WSCONS:
- if (xf86Info.kbdFd != -1)
- xf86FlushInput(xf86Info.kbdFd);
- else
- tcgetattr(xf86Info.consoleFd, &kbdtty);
- break;
-#endif
- }
-}
-
-int
-xf86KbdOn()
-{
- struct termios nTty;
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
-
- switch (xf86Info.consType) {
-
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
- case SYSCONS:
- case PCCONS:
- case PCVT:
- nTty = kbdtty;
- nTty.c_iflag = IGNPAR | IGNBRK;
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
-
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
-#endif
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- if (xf86Info.kbdFd == -1) {
- nTty = kbdtty;
- nTty.c_iflag = IGNPAR | IGNBRK;
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
- option = WSKBD_RAW;
- if (ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE,
- &option) == -1)
- FatalError("can't switch keyboard to raw mode. "
- "Enable support for it in the kernel\n"
- "or use for example:\n\n"
- "Option \"Protocol\" \"wskbd\"\n"
- "Option \"Device\" \"/dev/wskbd0\"\n"
- "\nin your XF86Config(5) file\n");
- } else {
- return xf86Info.kbdFd;
- }
-#endif
- }
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
- switch (xf86Info.consType) {
-
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_XLATE);
- /* FALL THROUGH */
-#endif
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
- case PCCONS:
- tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- if (xf86Info.kbdFd != -1) {
- return xf86Info.kbdFd;
- } else {
- option = WSKBD_TRANSLATED;
- ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
- }
- break;
-#endif
- }
- return(xf86Info.consoleFd);
-}
-
-#ifdef WSCONS_SUPPORT
-
-#define NUMEVENTS 64
-
-void
-xf86WSKbdEvents(void)
-{
- static struct wscons_event events[NUMEVENTS];
- int n, i;
-
- n = read(xf86Info.kbdFd, events, sizeof events);
- if (n <= 0)
- return;
- n /= sizeof(struct wscons_event);
- for (i = 0; i < n; i++)
- xf86PostWSKbdEvent(&events[i]);
-}
-
-#endif /* WSCONS_SUPPORT */
-
-
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c
deleted file mode 100644
index 65d577eb8..000000000
--- a/hw/xfree86/os-support/bsd/bsd_kbd.c
+++ /dev/null
@@ -1,572 +0,0 @@
-
-/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- * Author: Ivan Pascal.
- *
- * Based on the code from bsd_io.c which is
- * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <termios.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "bsd_kbd.h"
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static KbdProtocolRec protocols[] = {
- {"standard", PROT_STD },
-#ifdef WSCONS_SUPPORT
- {"wskbd", PROT_WSCONS },
-#endif
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-typedef struct {
- struct termios kbdtty;
-} BsdKbdPrivRec, *BsdKbdPrivPtr;
-
-static
-int KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- switch (pKbd->consType) {
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT)
- case PCCONS:
- case SYSCONS:
- case PCVT:
-#if defined WSCONS_SUPPORT
- case WSCONS:
-#endif
- tcgetattr(pInfo->fd, &(priv->kbdtty));
-#endif
- break;
- }
- }
-
- return Success;
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int real_leds = 0;
-
-#ifdef LED_CAP
- if (leds & XLED1) real_leds |= LED_CAP;
-#endif
-#ifdef LED_NUM
- if (leds & XLED2) real_leds |= LED_NUM;
-#endif
-#ifdef LED_SCR
- if (leds & XLED3) real_leds |= LED_SCR;
- if (leds & XLED4) real_leds |= LED_SCR;
-#endif
-
- switch (pKbd->consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDSETLED, real_leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(pInfo->fd, WSKBDIO_SETLEDS, &real_leds);
- break;
-#endif
- }
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int leds = 0, real_leds = 0;
-
- switch (pKbd->consType) {
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDGETLED, &real_leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(pInfo->fd, WSKBDIO_GETLEDS, &real_leds);
- break;
-#endif
- }
-
-#ifdef LED_CAP
- if (real_leds & LED_CAP) leds |= XLED1;
-#endif
-#ifdef LED_NUM
- if (real_leds & LED_NUM) leds |= XLED2;
-#endif
-#ifdef LED_SCR
- if (real_leds & LED_SCR) leds |= XLED3;
-#endif
-
- return(leds);
-}
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- switch (pKbd->consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDSETRAD, rad);
- break;
-#endif
- }
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
- struct termios nTty;
-#endif
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
- if (pKbd->isConsole) {
- switch (pKbd->consType) {
-
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- case SYSCONS:
- case PCCONS:
- case PCVT:
-#ifdef WSCONS_SUPPORT
- case WSCONS:
-#endif
- nTty = priv->kbdtty;
- nTty.c_iflag = IGNPAR | IGNBRK;
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- if (tcsetattr(pInfo->fd, TCSANOW, &nTty) < 0) {
- xf86Msg(X_ERROR, "KbdOn: tcsetattr: %s\n",
- strerror(errno));
- }
- break;
-#endif
- }
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT)
- switch (pKbd->consType) {
- case SYSCONS:
- case PCVT:
-#ifdef K_CODE
- if (pKbd->CustomKeycodes)
- ioctl(pInfo->fd, KDSKBMODE, K_CODE);
- else
- ioctl(pInfo->fd, KDSKBMODE, K_RAW);
-#else
- ioctl(pInfo->fd, KDSKBMODE, K_RAW);
-#endif
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- option = WSKBD_RAW;
- if (ioctl(pInfo->fd, WSKBDIO_SETMODE, &option) == -1) {
- FatalError("can't switch keyboard to raw mode. "
- "Enable support for it in the kernel\n"
- "or use for example:\n\n"
- "Option \"Protocol\" \"wskbd\"\n"
- "Option \"Device\" \"/dev/wskbd0\"\n"
- "\nin your xorg.conf(5) file\n");
- }
- break;
-#endif
- }
- }
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
- if (pKbd->isConsole) {
- switch (pKbd->consType) {
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDSKBMODE, K_XLATE);
- /* FALL THROUGH */
-#endif
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
- case PCCONS:
- tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- option = WSKBD_TRANSLATED;
- ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
- tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
- break;
-#endif
- }
- }
- return Success;
-}
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-#ifdef WSCONS_SUPPORT
- struct wskbd_bell_data wsb;
-#endif
-
- if (loudness && pitch) {
- switch (pKbd->consType) {
-#ifdef PCCONS_SUPPORT
- case PCCONS:
- { int data[2];
- data[0] = pitch;
- data[1] = (duration * loudness) / 50;
- ioctl(pInfo->fd, CONSOLE_X_BELL, data);
- break;
- }
-#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration*loudness/50)<<16));
- break;
-#endif
-#if defined (WSCONS_SUPPORT)
- case WSCONS:
- wsb.which = WSKBD_BELL_DOALL;
- wsb.pitch = pitch;
- wsb.period = duration;
- wsb.volume = loudness;
- ioctl(pInfo->fd, WSKBDIO_COMPLEXBELL, &wsb);
- break;
-#endif
- }
- }
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static
-Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
-#ifdef VT_ACTIVATE
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- return TRUE;
- }
-#endif
- case KEY_F11:
- case KEY_F12:
-#ifdef VT_ACTIVATE
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- return TRUE;
- }
-#endif
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
-
- return FALSE;
-}
-
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++)
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f,
- rBuf[i] & 0x80 ? FALSE : TRUE);
- }
-}
-
-#ifdef WSCONS_SUPPORT
-
-static void
-WSReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- struct wscons_event events[64];
- int type;
- int blocked, n, i;
-
- if ((n = read( pInfo->fd, events, sizeof(events))) > 0) {
- n /= sizeof(struct wscons_event);
- for (i = 0; i < n; i++) {
- type = events[i].type;
- if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) {
- /* It seems better to block SIGIO there */
- blocked = xf86BlockSIGIO();
- pKbd->PostEvent(pInfo, (unsigned int)(events[i].value),
- type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE);
- xf86UnblockSIGIO(blocked);
- }
- } /* for */
- }
-}
-
-static void
-printWsType(char *type, char *devname)
-{
- xf86Msg(X_PROBED, "%s: Keyboard type: %s\n", type, devname);
-}
-#endif
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
- pInfo->read_input = stdReadInput;
- break;
-#ifdef WSCONS_SUPPORT
- case PROT_WSCONS:
- pInfo->read_input = WSReadInput;
- break;
-#endif
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- if (prot == PROT_WSCONS) {
- xf86Msg(X_ERROR,"A \"device\" option is required with"
- " the \"wskbd\" keyboard protocol\n");
- return FALSE;
- } else {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- pKbd->consType = xf86Info.consType;
- }
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- pKbd->consType = xf86Info.consType;
- xfree(s);
- }
-
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (pKbd->isConsole &&
- ((pKbd->consType == SYSCONS) || (pKbd->consType == PCVT)))
- pKbd->vtSwitchSupported = TRUE;
-#endif
-
-#ifdef WSCONS_SUPPORT
- if( prot == PROT_WSCONS) {
- pKbd->consType = WSCONS;
- /* Find out keyboard type */
- if (ioctl(pInfo->fd, WSKBDIO_GTYPE, &(pKbd->wsKbdType)) == -1) {
- xf86Msg(X_ERROR, "%s: cannot get keyboard type", pInfo->name);
- close(pInfo->fd);
- return FALSE;
- }
- switch (pKbd->wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- printWsType("XT", pInfo->name);
- break;
- case WSKBD_TYPE_PC_AT:
- printWsType("AT", pInfo->name);
- break;
- case WSKBD_TYPE_USB:
- printWsType("USB", pInfo->name);
- break;
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- printWsType("ADB", pInfo->name);
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN
- case WSKBD_TYPE_SUN:
- printWsType("Sun", pInfo->name);
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
- xf86Msg(X_PROBED, "Keyboard type: Sun5\n");
- break;
-#endif
- default:
- xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"",
- pInfo->name, pKbd->wsKbdType);
- close(pInfo->fd);
- return FALSE;
- }
- }
-#endif
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
-
- pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = NULL;
-
- pKbd->OpenKeyboard = OpenKeyboard;
- pKbd->vtSwitchSupported = FALSE;
- pKbd->CustomKeycodes = FALSE;
-
- pKbd->private = xcalloc(sizeof(BsdKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.h b/hw/xfree86/os-support/bsd/bsd_kbd.h
deleted file mode 100644
index b2ae179e1..000000000
--- a/hw/xfree86/os-support/bsd/bsd_kbd.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-
diff --git a/hw/xfree86/os-support/drm/xf86drm.c b/hw/xfree86/os-support/drm/xf86drm.c
index 214e58ba7..e990e286b 100644
--- a/hw/xfree86/os-support/drm/xf86drm.c
+++ b/hw/xfree86/os-support/drm/xf86drm.c
@@ -33,6 +33,7 @@
#ifdef HAVE_XORG_CONFIG_H
+#include <libdrm-config.h>
#include <xorg-config.h>
#endif
@@ -2305,3 +2306,957 @@ int drmRemoveSIGIOHandler(int fd)
return xf86RemoveSIGIOHandler(fd);
}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_EMIT
+ * DRM_FENCE_FLAG_SHAREABLE
+ * DRM_FENCE_MASK_DRIVER
+ */
+
+int drmFenceCreate(int fd, unsigned flags, int class,unsigned type,
+ drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.type = type;
+ arg.class = class;
+ arg.op = drm_fence_create;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->handle = arg.handle;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->flags = arg.flags;
+ fence->signaled = 0;
+ return 0;
+}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_SHAREABLE
+ * DRM_FENCE_MASK_DRIVER
+ */
+
+int drmFenceBuffers(int fd, unsigned flags, drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.flags = flags;
+ arg.op = drm_fence_buffers;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->handle = arg.handle;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->flags = arg.flags;
+ fence->signaled = 0;
+ return 0;
+}
+
+int drmFenceDestroy(int fd, const drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.op = drm_fence_destroy;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ return 0;
+}
+
+int drmFenceReference(int fd, unsigned handle, drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = handle;
+ arg.op = drm_fence_reference;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->handle = arg.handle;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->flags = arg.flags;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+int drmFenceUnreference(int fd, const drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.op = drm_fence_unreference;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ return 0;
+}
+
+int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.type = flush_type;
+ arg.op = drm_fence_flush;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+int drmFenceUpdate(int fd, drmFence *fence)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.op = drm_fence_signaled;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+int drmFenceSignaled(int fd, drmFence *fence, unsigned fenceType,
+ int *signaled)
+{
+ int
+ ret;
+
+ if ((fence->flags & DRM_FENCE_FLAG_SHAREABLE) ||
+ ((fenceType & fence->signaled) != fenceType)) {
+
+ ret = drmFenceFlush(fd, fence, fenceType);
+ if (ret)
+ return ret;
+ }
+
+ *signaled = ((fenceType & fence->signaled) == fenceType);
+
+ return 0;
+}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_SHAREABLE
+ * DRM_FENCE_MASK_DRIVER
+ */
+
+
+int drmFenceEmit(int fd, unsigned flags, drmFence *fence, unsigned emit_type)
+{
+ drm_fence_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.flags = flags;
+ arg.handle = fence->handle;
+ arg.type = emit_type;
+ arg.op = drm_fence_emit;
+ if (ioctl(fd, DRM_IOCTL_FENCE, &arg))
+ return -errno;
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+/*
+ * Valid flags are
+ * DRM_FENCE_FLAG_WAIT_LAZY
+ * DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS
+ */
+
+int drmFenceWait(int fd, unsigned flags, drmFence *fence, unsigned flush_type)
+{
+ drm_fence_arg_t arg;
+ int ret;
+
+ if (flush_type == 0) {
+ flush_type = fence->type;
+ }
+
+ if (!(fence->flags & DRM_FENCE_FLAG_SHAREABLE)) {
+ if ((flush_type & fence->signaled) == flush_type) {
+ return 0;
+ }
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = fence->handle;
+ arg.type = flush_type;
+ arg.flags = flags;
+ arg.op = drm_fence_wait;
+ do {
+ ret = ioctl(fd, DRM_IOCTL_FENCE, &arg);
+ } while (ret != 0 && errno == EAGAIN);
+
+ if (ret)
+ return -errno;
+
+ fence->class = arg.class;
+ fence->type = arg.type;
+ fence->signaled = arg.signaled;
+ return 0;
+}
+
+static int drmAdjustListNodes(drmBOList *list)
+{
+ drmBONode *node;
+ drmMMListHead *l;
+ int ret = 0;
+
+ while(list->numCurrent < list->numTarget) {
+ node = (drmBONode *) malloc(sizeof(*node));
+ if (!node) {
+ ret = -ENOMEM;
+ break;
+ }
+ list->numCurrent++;
+ DRMLISTADD(&node->head, &list->free);
+ }
+
+ while(list->numCurrent > list->numTarget) {
+ l = list->free.next;
+ if (l == &list->free)
+ break;
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ free(node);
+ list->numCurrent--;
+ }
+ return ret;
+}
+
+void drmBOFreeList(drmBOList *list)
+{
+ drmBONode *node;
+ drmMMListHead *l;
+
+ l = list->list.next;
+ while(l != &list->list) {
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ free(node);
+ l = list->free.next;
+ list->numCurrent--;
+ list->numOnList--;
+ }
+
+ l = list->free.next;
+ while(l != &list->free) {
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ free(node);
+ l = list->free.next;
+ list->numCurrent--;
+ }
+}
+
+int drmBOResetList(drmBOList *list) {
+
+ drmMMListHead *l;
+ int ret;
+
+ ret = drmAdjustListNodes(list);
+ if (ret)
+ return ret;
+
+ l = list->list.next;
+ while(l != &list->list) {
+ DRMLISTDEL(l);
+ DRMLISTADD(l, &list->free);
+ list->numOnList--;
+ l = list->list.next;
+ }
+ return drmAdjustListNodes(list);
+}
+
+static drmBONode *drmAddListItem(drmBOList *list, drmBO *item,
+ unsigned long arg0,
+ unsigned long arg1)
+{
+ drmBONode *node;
+ drmMMListHead *l;
+
+ l = list->free.next;
+ if (l == &list->free) {
+ node = (drmBONode *) malloc(sizeof(*node));
+ if (!node) {
+ return NULL;
+ }
+ list->numCurrent++;
+ } else {
+ DRMLISTDEL(l);
+ node = DRMLISTENTRY(drmBONode, l, head);
+ }
+ node->buf = item;
+ node->arg0 = arg0;
+ node->arg1 = arg1;
+ DRMLISTADD(&node->head, &list->list);
+ list->numOnList++;
+ return node;
+}
+
+void *drmBOListIterator(drmBOList *list)
+{
+ void *ret = list->list.next;
+
+ if (ret == &list->list)
+ return NULL;
+ return ret;
+}
+
+void *drmBOListNext(drmBOList *list, void *iterator)
+{
+ void *ret;
+
+ drmMMListHead *l = (drmMMListHead *) iterator;
+ ret = l->next;
+ if (ret == &list->list)
+ return NULL;
+ return ret;
+}
+
+drmBO *drmBOListBuf(void *iterator)
+{
+ drmBONode *node;
+ drmMMListHead *l = (drmMMListHead *) iterator;
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ return node->buf;
+}
+
+
+int drmBOCreateList(int numTarget, drmBOList *list)
+{
+ DRMINITLISTHEAD(&list->list);
+ DRMINITLISTHEAD(&list->free);
+ list->numTarget = numTarget;
+ list->numCurrent = 0;
+ list->numOnList = 0;
+ return drmAdjustListNodes(list);
+}
+
+static void drmBOCopyReply(const drm_bo_arg_reply_t *rep,
+ drmBO *buf)
+{
+ buf->handle = rep->handle;
+ buf->flags = rep->flags;
+ buf->size = rep->size;
+ buf->offset = rep->offset;
+ buf->mapHandle = rep->arg_handle;
+ buf->mask = rep->mask;
+ buf->start = rep->buffer_start;
+ buf->fenceFlags = rep->fence_flags;
+ buf->replyFlags = rep->rep_flags;
+ buf->pageAlignment = rep->page_alignment;
+}
+
+
+
+int drmBOCreate(int fd, unsigned long start, unsigned long size,
+ unsigned pageAlignment, void *user_buffer, drm_bo_type_t type,
+ unsigned mask,
+ unsigned hint, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret;
+
+ memset(buf, 0, sizeof(*buf));
+ memset(&arg, 0, sizeof(arg));
+ req->mask = mask;
+ req->hint = hint;
+ req->size = size;
+ req->type = type;
+ req->page_alignment = pageAlignment;
+
+ buf->virtual = NULL;
+
+ switch(type) {
+ case drm_bo_type_dc:
+ req->buffer_start = start;
+ break;
+ case drm_bo_type_user:
+ req->buffer_start = (unsigned long) user_buffer;
+ buf->virtual = user_buffer;
+ break;
+ case drm_bo_type_fake:
+ req->buffer_start = start;
+ break;
+ default:
+ return -EINVAL;
+ }
+ req->op = drm_bo_create;
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret != 0 && errno == EAGAIN);
+
+ if (ret)
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ fprintf(stderr, "Error %d\n", rep->ret);
+ return rep->ret;
+ }
+
+ drmBOCopyReply(rep, buf);
+ buf->mapVirtual = NULL;
+ buf->mapCount = 0;
+
+ return 0;
+}
+
+int drmBODestroy(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+ if (buf->mapVirtual && (buf->type != drm_bo_type_fake)) {
+ (void) drmUnmap(buf->mapVirtual, buf->start + buf->size);
+ buf->mapVirtual = NULL;
+ buf->virtual = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_destroy;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg))
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ return rep->ret;
+ }
+
+ buf->handle = 0;
+ return 0;
+}
+
+int drmBOReference(int fd, unsigned handle, drmBO *buf)
+{
+
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = handle;
+ req->op = drm_bo_reference;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg))
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ return rep->ret;
+ }
+
+ drmBOCopyReply(rep, buf);
+ buf->type = drm_bo_type_dc;
+ buf->mapVirtual = NULL;
+ buf->mapCount = 0;
+ buf->virtual = NULL;
+
+ return 0;
+}
+
+int drmBOUnReference(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+
+ if (buf->mapVirtual && (buf->type != drm_bo_type_fake)) {
+ (void) munmap(buf->mapVirtual, buf->start + buf->size);
+ buf->mapVirtual = NULL;
+ buf->virtual = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_unreference;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg))
+ return -errno;
+ if (!arg.handled) {
+ return -EFAULT;
+ }
+ if (rep->ret) {
+ return rep->ret;
+ }
+
+ buf->handle = 0;
+ return 0;
+}
+
+/*
+ * Flags can be DRM_BO_FLAG_READ, DRM_BO_FLAG_WRITE or'ed together
+ * Hint currently be DRM_BO_HINT_DONT_BLOCK, which makes the
+ * call return an -EBUSY if it can' immediately honor the mapping request.
+ */
+
+int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
+ void **address)
+{
+
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ /*
+ * Make sure we have a virtual address of the buffer.
+ */
+
+ if (!buf->virtual && buf->type != drm_bo_type_fake) {
+ drmAddress virtual;
+ virtual = mmap(0, buf->size + buf->start,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, buf->mapHandle);
+ if (virtual == MAP_FAILED) {
+ ret = -errno;
+ }
+ if (ret)
+ return ret;
+ buf->mapVirtual = virtual;
+ buf->virtual = ((char *) virtual) + buf->start;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->mask = mapFlags;
+ req->hint = mapHint;
+ req->op = drm_bo_map;
+
+ /*
+ * May hang if the buffer object is busy.
+ * This IOCTL synchronizes the buffer.
+ */
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret != 0 && errno == EAGAIN);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+
+ drmBOCopyReply(rep, buf);
+ buf->mapFlags = mapFlags;
+ ++buf->mapCount;
+ *address = buf->virtual;
+
+ return 0;
+}
+
+int drmBOUnmap(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_unmap;
+
+ if (ioctl(fd, DRM_IOCTL_BUFOBJ, &arg)) {
+ return -errno;
+ }
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+
+ return 0;
+}
+
+int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask,
+ unsigned hint)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->mask = flags;
+ req->hint = hint;
+ req->arg_handle = mask; /* Encode mask in the arg_handle field :/ */
+ req->op = drm_bo_validate;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret && errno == EAGAIN);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+
+ drmBOCopyReply(rep, buf);
+ return 0;
+}
+
+
+int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->mask = flags;
+ req->arg_handle = fenceHandle;
+ req->op = drm_bo_validate;
+
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ return 0;
+}
+
+int drmBOInfo(int fd, drmBO *buf)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_info;
+
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ drmBOCopyReply(rep, buf);
+ return 0;
+}
+
+int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint)
+{
+ drm_bo_arg_t arg;
+ drm_bo_arg_request_t *req = &arg.d.req;
+ drm_bo_arg_reply_t *rep = &arg.d.rep;
+ int ret = 0;
+
+ if ((buf->flags & DRM_BO_FLAG_SHAREABLE) ||
+ (buf->replyFlags & DRM_BO_REP_BUSY)) {
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->op = drm_bo_wait_idle;
+ req->hint = hint;
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
+ } while (ret && errno == EAGAIN);
+
+ if (ret)
+ return ret;
+ if (!arg.handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ drmBOCopyReply(rep, buf);
+ }
+ return 0;
+}
+
+int drmBOBusy(int fd, drmBO *buf, int *busy)
+{
+ if (!(buf->flags & DRM_BO_FLAG_SHAREABLE) &&
+ !(buf->replyFlags & DRM_BO_REP_BUSY)) {
+ *busy = 0;
+ return 0;
+ } else {
+ int ret = drmBOInfo(fd, buf);
+ if (ret)
+ return ret;
+ *busy = (buf->replyFlags & DRM_BO_REP_BUSY);
+ return 0;
+ }
+}
+
+
+int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags,
+ unsigned mask,
+ int *newItem)
+{
+ drmBONode *node, *cur;
+ drmMMListHead *l;
+
+ *newItem = 0;
+ cur = NULL;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+ if (node->buf == buf) {
+ cur = node;
+ break;
+ }
+ }
+ if (!cur) {
+ cur = drmAddListItem(list, buf, flags, mask);
+ if (!cur) {
+ drmMsg("Out of memory creating validate list node.\n");
+ return -ENOMEM;
+ }
+ *newItem = 1;
+ cur->arg0 = flags;
+ cur->arg1 = mask;
+ } else {
+ unsigned memMask = (cur->arg1 | mask) & DRM_BO_MASK_MEM;
+ unsigned memFlags = cur->arg0 & flags & memMask;
+
+ if (!memFlags) {
+ drmMsg("Incompatible memory location requests "
+ "on validate list.\n");
+ drmMsg("Previous flag: 0x%08lx, mask: 0x%08lx\n",
+ cur->arg0, cur->arg1);
+ drmMsg("Current flag: 0x%08lx, mask: 0x%08lx\n",
+ flags, mask);
+ return -EINVAL;
+ }
+ if (mask & cur->arg1 & ~DRM_BO_MASK_MEM & (cur->arg0 ^ flags)) {
+ drmMsg("Incompatible buffer flag requests "
+ "on validate list.\n");
+ drmMsg("Previous flag: 0x%08lx, mask: 0x%08lx\n",
+ cur->arg0, cur->arg1);
+ drmMsg("Current flag: 0x%08lx, mask: 0x%08lx\n",
+ flags, mask);
+ return -EINVAL;
+ }
+ cur->arg1 |= mask;
+ cur->arg0 = memFlags | ((cur->arg0 | flags) &
+ cur->arg1 & ~DRM_BO_MASK_MEM);
+ }
+ return 0;
+}
+
+
+int drmBOValidateList(int fd, drmBOList *list)
+{
+
+ drmBONode *node;
+ drmMMListHead *l;
+ drm_bo_arg_t *arg, *first;
+ drm_bo_arg_request_t *req;
+ drm_bo_arg_reply_t *rep;
+ drm_u64_t *prevNext = NULL;
+ drmBO *buf;
+ int ret;
+
+ first = NULL;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ arg = &node->bo_arg;
+ req = &arg->d.req;
+
+ if (!first)
+ first = arg;
+
+ if (prevNext)
+ *prevNext = (unsigned long) arg;
+
+ memset(arg, 0, sizeof(*arg));
+ prevNext = &arg->next;
+ req->handle = node->buf->handle;
+ req->op = drm_bo_validate;
+ req->mask = node->arg0;
+ req->hint = 0;
+ req->arg_handle = node->arg1;
+ }
+
+ if (!first)
+ return 0;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, first);
+ } while (ret && errno == EAGAIN);
+
+
+ if (ret)
+ return -errno;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+ arg = &node->bo_arg;
+ rep = &arg->d.rep;
+
+ if (!arg->handled) {
+ drmMsg("Unhandled request\n");
+ return -EFAULT;
+ }
+ if (rep->ret)
+ return rep->ret;
+
+ buf = node->buf;
+ drmBOCopyReply(rep, buf);
+ }
+
+ return 0;
+}
+
+
+int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle)
+{
+
+ drmBONode *node;
+ drmMMListHead *l;
+ drm_bo_arg_t *arg, *first;
+ drm_bo_arg_request_t *req;
+ drm_bo_arg_reply_t *rep;
+ drm_u64_t *prevNext = NULL;
+ int ret;
+
+ first = NULL;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ arg = &node->bo_arg;
+ req = &arg->d.req;
+
+ if (!first)
+ first = arg;
+
+ if (prevNext)
+ *prevNext = (unsigned long) arg;
+
+ memset(arg, 0, sizeof(*arg));
+ prevNext = &arg->next;
+ req->handle = node->buf->handle;
+ req->op = drm_bo_fence;
+ req->mask = node->arg0;
+ req->arg_handle = fenceHandle;
+ }
+
+ if (!first)
+ return 0;
+
+ ret = ioctl(fd, DRM_IOCTL_BUFOBJ, first);
+
+ if (ret)
+ return -errno;
+
+ for (l = list->list.next; l != &list->list; l = l->next) {
+ node = DRMLISTENTRY(drmBONode, l, head);
+
+ arg = &node->bo_arg;
+ rep = &arg->d.rep;
+
+ if (!arg->handled)
+ return -EFAULT;
+ if (rep->ret)
+ return rep->ret;
+ drmBOCopyReply(rep, node->buf);
+ }
+
+ return 0;
+}
+
+int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize,
+ unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_init;
+ arg.req.p_offset = pOffset;
+ arg.req.p_size = pSize;
+ arg.req.mem_type = memType;
+
+ if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg))
+ return -errno;
+
+ return 0;
+}
+
+int drmMMTakedown(int fd, unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_takedown;
+ arg.req.mem_type = memType;
+
+ if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg))
+ return -errno;
+
+ return 0;
+}
+
+int drmMMLock(int fd, unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+ int ret;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_lock;
+ arg.req.mem_type = memType;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg);
+ } while (ret && errno == EAGAIN);
+
+ return ret;
+}
+
+int drmMMUnlock(int fd, unsigned memType)
+{
+ drm_mm_init_arg_t arg;
+ int ret;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.req.op = mm_unlock;
+ arg.req.mem_type = memType;
+
+ do{
+ ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg);
+ } while (ret && errno == EAGAIN);
+
+ return ret;
+}
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 7f7102295..0301a743b 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -21,17 +21,15 @@ APM_SOURCES = lnx_apm.c
XORG_CFLAGS += -DHAVE_APM
endif
-liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_io.c lnx_kbd.c lnx_mouse.c \
- lnx_pci.c lnx_agp.c lnx_kmod.c lnx_KbdMap.c \
+liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
+ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
$(srcdir)/../shared/bios_mmap.c \
$(srcdir)/../shared/VTsw_usl.c \
- $(srcdir)/../shared/std_kbdEv.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigio.c \
$(srcdir)/../shared/stdResource.c \
$(srcdir)/../shared/libc_wrapper.c \
- $(srcdir)/../shared/at_scancode.c \
$(ACPI_SOURCES) \
$(APM_SOURCES) \
$(PLATFORM_PCI_SUPPORT)
diff --git a/hw/xfree86/os-support/linux/lnx_KbdMap.c b/hw/xfree86/os-support/linux/lnx_KbdMap.c
deleted file mode 100644
index a2a2e224d..000000000
--- a/hw/xfree86/os-support/linux/lnx_KbdMap.c
+++ /dev/null
@@ -1,606 +0,0 @@
-/* $XFree86$ */
-
-/*
- * Slightly modified xf86KbdLnx.c which is
- *
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-
-#include "xf86Keymap.h"
-
-#include "lnx_kbd.h"
-
-/*ARGSUSED*/
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-static void readKernelMapping(InputInfoPtr pInfo,
- KeySymsPtr pKeySyms, CARD8 *pModMap);
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- KeySym *k;
- char type;
- int i;
-
- readKernelMapping(pInfo, pKeySyms, pModMap);
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- pKbd->kbdType = ioctl(pInfo->fd, KDGKBTYPE, &type) != -1 ? type : KB_101;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-#include <linux/keyboard.h>
-
-static KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
-};
-
-/*
- * Maps the AT keycodes to Linux keycodes
- */
-static unsigned char at2lnx[] =
-{
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
-};
-#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
-
-#define NUM_CUSTOMKEYS NR_KEYS
-
-static void
-readKernelMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- KeySym *k;
- int i;
- int maxkey;
- static unsigned char tbl[GLYPHS_PER_KEY] =
- {
- 0, /* unshifted */
- 1, /* shifted */
- 0, /* modeswitch unshifted */
- 0 /* modeswitch shifted */
- };
-
- /*
- * Read the mapping from the kernel.
- * Since we're still using the XFree86 scancode->AT keycode mapping
- * routines, we need to convert the AT keycodes to Linux keycodes,
- * then translate the Linux keysyms into X keysyms.
- *
- * First, figure out which tables to use for the modeswitch columns
- * above, from the XF86Config fields.
- */
- tbl[2] = 8; /* alt */
- tbl[3] = tbl[2] | 1;
-
- if (pKbd->CustomKeycodes) {
- k = map;
- maxkey = NUM_CUSTOMKEYS;
- }
- else {
- k = map+GLYPHS_PER_KEY;
- maxkey = NUM_AT2LNX;
- }
-
- for (i = 0; i < maxkey; ++i)
- {
- struct kbentry kbe;
- int j;
-
- if (pKbd->CustomKeycodes)
- kbe.kb_index = i;
- else
- kbe.kb_index = at2lnx[i];
-
- for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
- {
- unsigned short kval;
-
- *k = NoSymbol;
-
- kbe.kb_table = tbl[j];
- if (
- (!pKbd->CustomKeycodes && kbe.kb_index == 0) ||
- ioctl(pInfo->fd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value))
- {
- case KT_LATIN:
- case KT_LETTER:
- *k = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- *k = XK_F1 + kval;
- else switch (kbe.kb_value)
- {
- case K_FIND:
- *k = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- *k = XK_Insert;
- break;
- case K_REMOVE:
- *k = XK_Delete;
- break;
- case K_SELECT:
- *k = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- *k = XK_Prior;
- break;
- case K_PGDN:
- *k = XK_Next;
- break;
- case K_HELP:
- *k = XK_Help;
- break;
- case K_DO:
- *k = XK_Execute;
- break;
- case K_PAUSE:
- *k = XK_Pause;
- break;
- case K_MACRO:
- *k = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value)
- {
- case K_ENTER:
- *k = XK_Return;
- break;
- case K_BREAK:
- *k = XK_Break;
- break;
- case K_CAPS:
- *k = XK_Caps_Lock;
- break;
- case K_NUM:
- *k = XK_Num_Lock;
- break;
- case K_HOLD:
- *k = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- *k = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value)
- {
- case K_PPLUS:
- *k = XK_KP_Add;
- break;
- case K_PMINUS:
- *k = XK_KP_Subtract;
- break;
- case K_PSTAR:
- *k = XK_KP_Multiply;
- break;
- case K_PSLASH:
- *k = XK_KP_Divide;
- break;
- case K_PENTER:
- *k = XK_KP_Enter;
- break;
- case K_PCOMMA:
- *k = XK_KP_Separator;
- break;
- case K_PDOT:
- *k = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- *k = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- *k = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value)
- {
- case K_DGRAVE:
- *k = XK_dead_grave;
- break;
- case K_DACUTE:
- *k = XK_dead_acute;
- break;
- case K_DCIRCM:
- *k = XK_dead_circumflex;
- break;
- case K_DTILDE:
- *k = XK_dead_tilde;
- break;
- case K_DDIERE:
- *k = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value)
- {
- case K_DOWN:
- *k = XK_Down;
- break;
- case K_LEFT:
- *k = XK_Left;
- break;
- case K_RIGHT:
- *k = XK_Right;
- break;
- case K_UP:
- *k = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value)
- {
- case K_ALTGR:
- *k = XK_Alt_R;
- break;
- case K_ALT:
- *k = (kbe.kb_index == 0x64 ?
- XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- *k = (kbe.kb_index == 0x61 ?
- XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- *k = XK_Control_L;
- break;
- case K_CTRLR:
- *k = XK_Control_R;
- break;
- case K_SHIFT:
- *k = (kbe.kb_index == 0x36 ?
- XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- *k = XK_Shift_L;
- break;
- case K_SHIFTR:
- *k = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- *k = XK_Shift_Lock;
- break;
-
- default:
- break;
- }
- }
-
- if (k[-1] == k[-2]) k[-1] = NoSymbol;
- if (k[-2] == k[-3]) k[-2] = NoSymbol;
- if (k[-3] == k[-4]) k[-3] = NoSymbol;
- if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
- if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
- }
-
- if (!pKbd->CustomKeycodes)
- return;
-
- /*
- * Find the Mapping for the special server functions
- */
- pKbd->specialMap = (TransMapPtr) xcalloc(NUM_CUSTOMKEYS, 1);
- if (pKbd->specialMap != NULL) {
- pKbd->specialMap->end = NUM_CUSTOMKEYS;
- pKbd->specialMap->map = (unsigned char*) xcalloc(NUM_CUSTOMKEYS, 1);
- if (pKbd->specialMap == NULL) {
- xfree(pKbd->specialMap);
- pKbd->specialMap = NULL;
- }
- }
- if (pKbd->specialMap == NULL) {
- xf86Msg(X_ERROR, "%s can't allocate \"special map\"\n", pInfo->name);
- return;
- }
-
- for (i = 0; i < NUM_CUSTOMKEYS; ++i) {
- struct kbentry kbe;
- int special = 0;
-
- kbe.kb_index = i;
- kbe.kb_table = 0; /* Plain map */
- if (!ioctl(pInfo->fd, KDGKBENT, &kbe))
- switch (kbe.kb_value) {
- case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */
- special = KEY_BackSpace;
- break;
- case K_PMINUS:
- special = KEY_KP_Minus;
- break;
- case K_PPLUS:
- special = KEY_KP_Plus;
- break;
- case K_F1:
- special = KEY_F1;
- break;
- case K_F2:
- special = KEY_F2;
- break;
- case K_F3:
- special = KEY_F3;
- break;
- case K_F4:
- special = KEY_F4;
- break;
- case K_F5:
- special = KEY_F5;
- break;
- case K_F6:
- special = KEY_F6;
- break;
- case K_F7:
- special = KEY_F7;
- break;
- case K_F8:
- special = KEY_F8;
- break;
- case K_F9:
- special = KEY_F9;
- break;
- case K_F10:
- special = KEY_F10;
- break;
- case K_F11:
- special = KEY_F11;
- break;
- case K_F12:
- special = KEY_F12;
- break;
- case K_ALT:
- special = KEY_Alt;
- break;
- case K_ALTGR:
- special = KEY_AltLang;
- break;
- case K_CONS:
- special = KEY_SysReqest;
- break;
- }
- pKbd->specialMap->map[i] = special;
- }
-}
diff --git a/hw/xfree86/os-support/linux/lnx_bell.c b/hw/xfree86/os-support/linux/lnx_bell.c
new file mode 100644
index 000000000..6ef881bf7
--- /dev/null
+++ b/hw/xfree86/os-support/linux/lnx_bell.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * 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 this copyright notice and this permission notice appear in
+ * supporting electronic 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 COPYRIGHT HOLDERS OR AUTHORS 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.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ if (xf86Info.consoleFd == -1 || !pitch || !loudness)
+ return;
+
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * loudness / 50) << 16));
+}
diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c
deleted file mode 100644
index 836aaa15b..000000000
--- a/hw/xfree86/os-support/linux/lnx_io.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and that the names of Orest Zborowski and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Orest Zborowski
- * and David Dawes make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * OREST ZBOROWSKI AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID DAWES BE LIABLE
- * 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.
- *
- */
-/* $XConsortium: lnx_io.c /main/8 1996/10/19 18:06:28 kaleb $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
-}
-
-int
-xf86GetKbdLeds()
-{
- int leds = 0;
-
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- return(leds);
-}
-
-static int
-KDKBDREP_ioctl_ok(int rate, int delay) {
-#if defined(KDKBDREP) && !defined(__sparc__)
- /* This ioctl is defined in <linux/kd.h> but is not
- implemented anywhere - must be in some m68k patches. */
- struct kbd_repeat kbdrep_s;
-
- /* don't change, just test */
- kbdrep_s.LNX_KBD_PERIOD_NAME = -1;
- kbdrep_s.delay = -1;
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
- /* do the change */
- if (rate == 0) /* switch repeat off */
- kbdrep_s.LNX_KBD_PERIOD_NAME = 0;
- else
- kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */
- if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1)
- kbdrep_s.LNX_KBD_PERIOD_NAME = 1;
- kbdrep_s.delay = delay;
- if (kbdrep_s.delay < 1)
- kbdrep_s.delay = 1;
-
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
-
- return 1; /* success! */
-#else /* no KDKBDREP */
- return 0;
-#endif /* KDKBDREP */
-}
-
-static int
-KIOCSRATE_ioctl_ok(int rate, int delay) {
-#ifdef KIOCSRATE
- struct kbd_rate kbdrate_s;
- int fd;
-
- fd = open("/dev/kbd", O_RDONLY);
- if (fd == -1)
- return 0;
-
- kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */
- kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */
- if (kbdrate_s.rate > 50)
- kbdrate_s.rate = 50;
-
- if (ioctl( fd, KIOCSRATE, &kbdrate_s )) {
- return 0;
- }
-
- close( fd );
-
- return 1;
-#else /* no KIOCSRATE */
- return 0;
-#endif /* KIOCSRATE */
-}
-
-void xf86SetKbdRepeat(char rad)
-{
-#ifdef __sparc__
- int rate = 500; /* Default rate */
- int delay = 200; /* Default delay */
-#else
- int rate = 300; /* Default rate */
- int delay = 250; /* Default delay */
-#endif
-
-#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
- int i;
- int timeout;
- int value = 0x7f; /* Maximum delay with slowest rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-#endif
-
- if (xf86Info.kbdRate >= 0)
- rate = xf86Info.kbdRate * 10;
- if (xf86Info.kbdDelay >= 0)
- delay = xf86Info.kbdDelay;
-
- if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */
- return;
-
- if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */
- return;
-
- if (xf86IsPc98())
- return;
-
-#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
-
- /* The ioport way */
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- timeout = KBC_TIMEOUT;
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- if (timeout == 0)
- return;
-
- outb(0x60, 0xf3); /* set typematic rate */
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- usleep(10000);
- outb(0x60, value);
-
-#endif /* __alpha__ || __i386__ || __ia64__ */
-}
-
-static int kbdtrans;
-static struct termios kbdtty;
-
-void
-xf86KbdInit()
-{
- ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
- tcgetattr (xf86Info.consoleFd, &kbdtty);
-}
-
-int
-xf86KbdOn()
-{
- struct termios nTty;
-
-#ifdef __powerpc__
- if (xf86Info.kbdCustomKeycodes)
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW);
- else
-#endif
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
-
- nTty = kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
- ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
- return(xf86Info.consoleFd);
-}
-
diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c
deleted file mode 100644
index a4890d2df..000000000
--- a/hw/xfree86/os-support/linux/lnx_kbd.c
+++ /dev/null
@@ -1,530 +0,0 @@
-
-/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- * Author: Ivan Pascal.
- *
- * Based on the code from lnx_io.c which is
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#if defined(DO_OS_FONTRESTORE)
-#include "lnx.h"
-#endif
-#include "lnx_kbd.h"
-
-#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
-
-static KbdProtocolRec protocols[] = {
- {"standard", PROT_STD },
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
- ioctl(pInfo->fd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
- }
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- int real_leds = 0;
-
-#if defined (__sparc__)
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- if (pKbd->sunKbd) {
- if (leds & 0x08) real_leds |= XLED1;
- if (leds & 0x04) real_leds |= XLED3;
- if (leds & 0x02) real_leds |= XLED4;
- if (leds & 0x01) real_leds |= XLED2;
- leds = real_leds;
- real_leds = 0;
- }
-#endif /* defined (__sparc__) */
-#ifdef LED_CAP
- if (leds & XLED1) real_leds |= LED_CAP;
- if (leds & XLED2) real_leds |= LED_NUM;
- if (leds & XLED3) real_leds |= LED_SCR;
-#ifdef LED_COMP
- if (leds & XLED4) real_leds |= LED_COMP;
-#else
- if (leds & XLED4) real_leds |= LED_SCR;
-#endif
-#endif
- ioctl(pInfo->fd, KDSETLED, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- int real_leds, leds = 0;
-
- ioctl(pInfo->fd, KDGETLED, &real_leds);
-
- if (real_leds & LED_CAP) leds |= XLED1;
- if (real_leds & LED_NUM) leds |= XLED2;
- if (real_leds & LED_SCR) leds |= XLED3;
-
- return(leds);
-}
-
-static int
-KDKBDREP_ioctl_ok(int rate, int delay) {
-#if defined(KDKBDREP) && !defined(__sparc__)
- /* This ioctl is defined in <linux/kd.h> but is not
- implemented anywhere - must be in some m68k patches. */
- struct kbd_repeat kbdrep_s;
-
- /* don't change, just test */
- kbdrep_s.LNX_KBD_PERIOD_NAME = -1;
- kbdrep_s.delay = -1;
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
-
- /* do the change */
- if (rate == 0) /* switch repeat off */
- kbdrep_s.LNX_KBD_PERIOD_NAME = 0;
- else
- kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */
- if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1)
- kbdrep_s.LNX_KBD_PERIOD_NAME = 1;
- kbdrep_s.delay = delay;
- if (kbdrep_s.delay < 1)
- kbdrep_s.delay = 1;
-
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
-
- return 1; /* success! */
-#else /* no KDKBDREP */
- return 0;
-#endif /* KDKBDREP */
-}
-
-static int
-KIOCSRATE_ioctl_ok(int rate, int delay) {
-#ifdef KIOCSRATE
- struct kbd_rate kbdrate_s;
- int fd;
-
- fd = open("/dev/kbd", O_RDONLY);
- if (fd == -1)
- return 0;
-
- kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */
- kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */
- if (kbdrate_s.rate > 50)
- kbdrate_s.rate = 50;
-
- if (ioctl( fd, KIOCSRATE, &kbdrate_s )) {
- return 0;
- }
-
- close( fd );
-
- return 1;
-#else /* no KIOCSRATE */
- return 0;
-#endif /* KIOCSRATE */
-}
-
-#undef rate
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- int timeout;
- int value = 0x7f; /* Maximum delay with slowest rate */
-
-#ifdef __sparc__
- int rate = 500; /* Default rate */
- int delay = 200; /* Default delay */
-#else
- int rate = 300; /* Default rate */
- int delay = 250; /* Default delay */
-#endif
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (pKbd->rate >= 0)
- rate = pKbd->rate * 10;
- if (pKbd->delay >= 0)
- delay = pKbd->delay;
-
- if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */
- return;
-
- if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */
- return;
-
- if (xf86IsPc98())
- return;
-
-#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
-
- if (!xorgHWAccess) {
- if (xf86EnableIO())
- xorgHWAccess = TRUE;
- else
- return;
- }
-
- /* The ioport way */
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- timeout = KBC_TIMEOUT;
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- if (timeout == 0)
- return;
-
- outb(0x60, 0xf3); /* set typematic rate */
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- usleep(10000);
- outb(0x60, value);
-
-#endif /* __alpha__ || __i386__ || __ia64__ */
-}
-
-typedef struct {
- int kbdtrans;
- struct termios kbdtty;
-} LnxKbdPrivRec, *LnxKbdPrivPtr;
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- ioctl (pInfo->fd, KDGKBMODE, &(priv->kbdtrans));
- tcgetattr (pInfo->fd, &(priv->kbdtty));
- }
- if (!pKbd->CustomKeycodes) {
- pKbd->RemapScanCode = ATScancode;
- }
-
- return Success;
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private;
- struct termios nTty;
-
- if (pKbd->isConsole) {
- if (pKbd->CustomKeycodes)
- ioctl(pInfo->fd, KDSKBMODE, K_MEDIUMRAW);
- else
- ioctl(pInfo->fd, KDSKBMODE, K_RAW);
-
- nTty = priv->kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(pInfo->fd, TCSANOW, &nTty);
- }
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- ioctl(pInfo->fd, KDSKBMODE, priv->kbdtrans);
- tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
- }
- return Success;
-}
-
-static int
-GetSpecialKey(InputInfoPtr pInfo, int scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int specialkey = scanCode;
-
-#if defined (__sparc__)
- if (pKbd->sunKbd) {
- switch (scanCode) {
- case 0x2b: specialkey = KEY_BackSpace; break;
- case 0x47: specialkey = KEY_KP_Minus; break;
- case 0x7d: specialkey = KEY_KP_Plus; break;
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
- case 0x05: specialkey = KEY_F1; break;
- case 0x06: specialkey = KEY_F2; break;
- case 0x08: specialkey = KEY_F3; break;
- case 0x0a: specialkey = KEY_F4; break;
- case 0x0c: specialkey = KEY_F5; break;
- case 0x0e: specialkey = KEY_F6; break;
- case 0x10: specialkey = KEY_F7; break;
- case 0x11: specialkey = KEY_F8; break;
- case 0x12: specialkey = KEY_F9; break;
- case 0x07: specialkey = KEY_F10; break;
- case 0x09: specialkey = KEY_F11; break;
- case 0x0b: specialkey = KEY_F12; break;
- default: specialkey = 0; break;
- }
- return specialkey;
- }
-#endif
-
- if (pKbd->CustomKeycodes) {
- specialkey = pKbd->specialMap->map[scanCode];
- }
- return specialkey;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static
-Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- return TRUE;
- }
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
- return FALSE;
-}
-
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++)
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f,
- rBuf[i] & 0x80 ? FALSE : TRUE);
- }
-}
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
- pInfo->read_input = stdReadInput;
- break;
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
-
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- xfree(s);
- }
-
- if (pKbd->isConsole)
- pKbd->vtSwitchSupported = TRUE;
-
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
-
- pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = GetSpecialKey;
-
- pKbd->OpenKeyboard = OpenKeyboard;
- pKbd->vtSwitchSupported = FALSE;
-
- pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
-
-#if defined(__powerpc__)
- {
- FILE *f;
- f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r");
- if (f) {
- if (fgetc(f) == '0')
- pKbd->CustomKeycodes = TRUE;
- fclose(f);
- }
- }
-#endif
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/linux/lnx_kbd.h b/hw/xfree86/os-support/linux/lnx_kbd.h
deleted file mode 100644
index b2ae179e1..000000000
--- a/hw/xfree86/os-support/linux/lnx_kbd.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-
diff --git a/hw/xfree86/os-support/lynxos/lynx_io.c b/hw/xfree86/os-support/lynxos/lynx_io.c
deleted file mode 100644
index 818104634..000000000
--- a/hw/xfree86/os-support/lynxos/lynx_io.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 1993 by Thomas Mueller
- *
- * 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, and that the name of Thomas Mueller not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Mueller makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS MUELLER BE LIABLE 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.
- *
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#if defined(KDMKTONE) || defined(KIOCSOUND)
-/* Lynx 2.2.1 has sophisticated atc stuff.... */
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
-#ifdef KDMKTONE
- /*
- * If we have KDMKTONE use it to avoid putting the server
- * to sleep
- */
- ioctl(xf86Info.consoleFd, KDMKTONE,
- (pitch & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
-#else
- ioctl(xf86Info.consoleFd, KIOCSOUND, pitch);
- usleep(xf86Info.bell_duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
-#endif
- }
-}
-
-#else
-
-/* this is pulled from /sys/drivers/vt100/atbeep.c */
-
-#define SPEAKER_CONTROL 0x61
-#define TIMER_CONTROL 0x43
-#define TIMER_DATA 0x42
-#define TIMER_LOAD_CMD 0xb6
-
-#define TIMER_CONSTANT 1193280
-#define FREQ_LO(f) ((TIMER_CONSTANT / (f)) % 256)
-#define FREQ_HI(f) ((TIMER_CONSTANT / (f)) / 256)
-
-void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- int flo = FREQ_LO(pitch);
- int fhi = FREQ_HI(pitch);
-
- outb(TIMER_CONTROL, TIMER_LOAD_CMD);
- outb(TIMER_DATA, flo);
- outb(TIMER_DATA, fhi);
-
- /* speaker on */
- outb(SPEAKER_CONTROL, inb(SPEAKER_CONTROL) | 3);
- usleep(xf86Info.bell_duration * loudness * 20);
- /* speaker off */
- outb(SPEAKER_CONTROL, inb(SPEAKER_CONTROL) & ~3);
-}
-#endif
-
-void
-xf86SetKbdLeds(int leds)
-{
-#ifdef KBD_SET_LEDS
- ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds);
-#endif
-}
-
-int
-xf86GetKbdLeds()
-{
-#ifdef KBD_SET_LEDS
- int leds;
-
- if (ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds) < 0)
- return 0;
-
- return leds;
-#endif
- return 0;
-}
-
-void
-xf86SetKbdRepeat(char rad)
-{
-}
-
-static struct termio kbdtty;
-
-void
-xf86KbdInit()
-{
- ioctl(xf86Info.consoleFd, TCGETA, &kbdtty);
-}
-
-int
-xf86KbdOn()
-{
- struct termio nTty;
-
- /* set CAPS_LOCK to behave as CAPS_LOCK not as CTRL */
- write(xf86Info.consoleFd, "\033<", 2);
-
- /* enable scan mode */
- ioctl(xf86Info.consoleFd, TIO_ENSCANMODE, NULL);
-
- nTty = kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- ioctl(xf86Info.consoleFd, TCSETA, &nTty);
-
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
- /* disable scan mode */
- ioctl(xf86Info.consoleFd, TIO_DISSCANMODE, NULL);
- ioctl(xf86Info.consoleFd, TCSETA, &kbdtty);
- return(xf86Info.consoleFd);
-}
-
-#include "xf86OSKbd.h"
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/sco/Makefile.am b/hw/xfree86/os-support/sco/Makefile.am
index 1271c9d34..9cb5011fb 100644
--- a/hw/xfree86/os-support/sco/Makefile.am
+++ b/hw/xfree86/os-support/sco/Makefile.am
@@ -1,10 +1,6 @@
EXTRA_DIST = \
VTsw_sco.c \
- sco_KbdMap.c \
sco_init.c \
- sco_io.c \
sco_iop.c \
- sco_kbd.c \
- sco_kbd.h \
sco_mouse.c \
sco_video.c
diff --git a/hw/xfree86/os-support/sco/sco_KbdMap.c b/hw/xfree86/os-support/sco/sco_KbdMap.c
deleted file mode 100644
index 6a0e9de04..000000000
--- a/hw/xfree86/os-support/sco/sco_KbdMap.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $XFree86$ */
-/*
- * Copyright 2005 by J. Kean Johnston <jkj@sco.com>
- *
- * 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, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE 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.
- */
-
-/*
- * Based on xf86KbdMap.c, which is
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- */
-
-#include "X.h"
-#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-
-#include "sco_kbd.h"
-
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((priv->keymap.key[i].spcl << (n+1)) & 0x100) + priv->keymap.key[i].map[n]]
-
-/*
- * NOTE: Not all possible remappable symbols are remapped. There are two main
- * reasons:
- * a) The mapping between scancode and SYSV/386 - symboltable
- * is inconsistent between different versions and has some
- * BIG mistakes.
- * b) In X-Windows there is a difference between numpad-keys
- * and normal keys. SYSV/386 uses for both kinds of keys
- * the same symbol.
- *
- * Thus only the alpha keypad and the function keys are translated.
- * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
- */
-
-static unsigned char remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- };
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
- KeySym *k;
- int i;
- KeySym *pMap = map;
-
- for (i = 0; i < priv->keymap.n_keys && i < NUM_KEYCODES; i++) {
- if (remap[i]) {
- k = pMap + (remap[i] << 2);
-
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += GLYPHS_PER_KEY) {
-
- switch(*k) {
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
- }
- }
-
- pKeySyms->map = pMap;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
diff --git a/hw/xfree86/os-support/sco/sco_io.c b/hw/xfree86/os-support/sco/sco_io.c
deleted file mode 100644
index eafc14cfb..000000000
--- a/hw/xfree86/os-support/sco/sco_io.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
- *
- * 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, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE 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.
- */
-/* $XConsortium$ */
-
-/* Re-written May 2001 to represent the current state of reality */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include <sys/param.h>
-#include <sys/emap.h>
-#include <sys/nmap.h>
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- /*
- * sleep the first time through under SCO. There appears to be a
- * timing problem in the driver which causes the keyboard to be lost.
- * This usleep stops it from occurring. NOTE: this was in the old code.
- * I am not convinced it is true any longer, but it doesn't hurt to
- * leave this in here.
- */
- static int once = 1;
-
- if (once) {
- usleep(100);
- once = 0;
- }
-
- ioctl(xf86Info.consoleFd, KDSETLED, leds );
-}
-
-int
-xf86GetKbdLeds(void)
-{
- int leds;
-
- ioctl (xf86Info.consoleFd, KDGETLED, &leds);
- return leds;
-}
-
-/*
- * Much of the code in this function is duplicated from the Linux code
- * by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
- * Please see the file ../linux/lnx_io.c for full copyright information.
- *
- * NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A
- * and later have the required ioctl. 5.0.6A or higher is HIGHLY
- * recommended. The console driver is quite a different beast on that OS.
- */
-void
-xf86SetKbdRepeat(char rad)
-{
-#if defined(KBIO_SETRATE)
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (xf86Info.kbdRate >= 0)
- rate = xf86Info.kbdRate * 10;
- if (xf86Info.kbdDelay >= 0)
- delay = xf86Info.kbdDelay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (xf86Info.consoleFd, KBIO_SETRATE, value);
-#endif /* defined(KBIO_SETRATE) */
-}
-
-static Bool use_tcs = TRUE, use_kd = TRUE;
-static Bool no_nmap = TRUE, no_emap = TRUE;
-static int orig_getsc, orig_kbm;
-static struct termios orig_termios;
-static keymap_t keymap, noledmap;
-static uchar_t *sc_mapbuf;
-static uchar_t *sc_mapbuf2;
-
-void
-xf86KbdInit(void)
-{
- orig_getsc = 0;
- if (ioctl (xf86Info.consoleFd, TCGETSC, &orig_getsc) < 0)
- use_tcs = FALSE;
- if (ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm) < 0)
- use_kd = FALSE;
-
- if (!use_tcs && !use_kd)
- FatalError ("xf86KbdInit: Could not determine keyboard mode\n");
-
- /*
- * One day this should be fixed to translate normal ASCII characters
- * back into scancodes or into events that XFree86 wants, but not
- * now. For the time being, we only support scancode mode screens.
- */
- if (use_tcs && !(orig_getsc & KB_ISSCANCODE))
- FatalError ("xf86KbdInit: Keyboard can not send scancodes\n");
-
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the scancode API from messing with
- * the keyboard LED's. We restore the original map when we exit.
- */
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- }
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- } else {
- int i, j;
-
- for (i = 0; i < noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECIAL(noledmap, i, j) &&
- ((noledmap.key[i].map[j] == K_CLK) ||
- (noledmap.key[i].map[j] == K_NLK) ||
- (noledmap.key[i].map[j] == K_SLK))) {
- noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-
- if (ioctl (xf86Info.consoleFd, XCGETA, &orig_termios) < 0) {
- FatalError ("xf86KbdInit: Failed to get terminal modes (%s)\n",
- strerror(errno));
- }
-
- sc_mapbuf = xalloc (10*BSIZE);
- sc_mapbuf2 = xalloc(10*BSIZE);
-
- /* Get the emap */
- if (ioctl (xf86Info.consoleFd, LDGMAP, sc_mapbuf) < 0) {
- if (errno != ENAVAIL) {
- FatalError ("xf86KbdInit: Failed to retrieve e-map (%s)\n",
- strerror (errno));
- }
- no_emap = FALSE;
- }
-
- /* Get the nmap */
- if (ioctl (xf86Info.consoleFd, NMGMAP, sc_mapbuf2) < 0) {
- if (errno != ENAVAIL) {
- FatalError ("xf86KbdInit: Failed to retrieve n-map (%s)\n",
- strerror (errno));
- }
- no_nmap = FALSE;
- }
-}
-
-int
-xf86KbdOn(void)
-{
- struct termios newtio;
-
- ioctl (xf86Info.consoleFd, LDNMAP); /* Turn e-mapping off */
- ioctl (xf86Info.consoleFd, NMNMAP); /* Turn n-mapping off */
-
- newtio = orig_termios; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- cfsetispeed(&newtio, 9600);
- cfsetospeed(&newtio, 9600);
- ioctl(xf86Info.consoleFd, XCSETA, &newtio);
-
- /* Now tell the keyboard driver to send us raw scancodes */
- if (use_tcs) {
- int nm = orig_getsc;
- nm &= ~KB_XSCANCODE;
- ioctl (xf86Info.consoleFd, TCSETSC, &nm);
- }
-
- if (use_kd)
- ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
-
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
-
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff(void)
-{
- /* Revert back to original translate scancode mode */
- if (use_tcs)
- ioctl (xf86Info.consoleFd, TCSETSC, &orig_getsc);
- if (use_kd)
- ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
-
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
-
- if (no_emap)
- ioctl (xf86Info.consoleFd, LDSMAP, sc_mapbuf);
- if (no_nmap)
- ioctl (xf86Info.consoleFd, NMSMAP, sc_mapbuf2);
-
- ioctl(xf86Info.consoleFd, XCSETA, &orig_termios);
-
- return(xf86Info.consoleFd);
-}
diff --git a/hw/xfree86/os-support/sco/sco_kbd.c b/hw/xfree86/os-support/sco/sco_kbd.c
deleted file mode 100644
index 8b1d5b762..000000000
--- a/hw/xfree86/os-support/sco/sco_kbd.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* $XFree86$ */
-/*
- * Copyright 2005 by J. Kean Johnston <jkj@sco.com>
- *
- * 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, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE 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.
- */
-/* $XConsortium$ */
-
-/*
- * Based on sco_io.c which is
- * (C) Copyright 2003 J. Kean Johnston <jkj@sco.com>
- *
- * Based on lnx_kbd.c which is
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- *
- * Based on the code from lnx_io.c which is
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#include "X.h"
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "sco_kbd.h"
-
-#include <sys/param.h>
-#include <sys/emap.h>
-#include <sys/nmap.h>
-
-static KbdProtocolRec protocols[] = {
- { "standard", PROT_STD },
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(pInfo->fd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(pInfo->fd, KIOCSOUND, 0);
- }
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- int real_leds = 0;
- static int once = 1;
-
- /*
- * sleep the first time through under SCO. There appears to be a
- * timing problem in the driver which causes the keyboard to be lost.
- * This usleep stops it from occurring. NOTE: this was in the old code.
- * I am not convinced it is true any longer, but it doesn't hurt to
- * leave this in here.
- */
- if (once) {
- usleep(100);
- once = 0;
- }
-
-#ifdef LED_CAP
- if (leds & XLED1)
- real_leds |= LED_CAP;
- if (leds & XLED2)
- real_leds |= LED_NUM;
- if (leds & XLED3)
- real_leds |= LED_SCR;
-#ifdef LED_COMP
- if (leds & XLED4)
- real_leds |= LED_COMP;
-#else
- if (leds & XLED4)
- real_leds |= LED_SCR;
-#endif
-#endif
- ioctl(pInfo->fd, KDSETLED, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- int real_leds, leds = 0;
-
- ioctl(pInfo->fd, KDGETLED, &real_leds);
-
- if (real_leds & LED_CAP) leds |= XLED1;
- if (real_leds & LED_NUM) leds |= XLED2;
- if (real_leds & LED_SCR) leds |= XLED3;
-
- return(leds);
-}
-
-/*
- * NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A
- * and later have the required ioctl. 5.0.6A or higher is HIGHLY
- * recommended. The console driver is quite a different beast on that OS.
- */
-#undef rate
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
-#if defined(KBIO_SETRATE)
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (pKbd->rate >= 0)
- rate = pKbd->rate * 10;
- if (pKbd->delay >= 0)
- delay = pKbd->delay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (pInfo->fd, KBIO_SETRATE, value);
-#endif /* defined(KBIO_SETRATE) */
-}
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- priv->use_tcs = 1;
- priv->use_kd = 1;
- priv->no_nmap = 1;
- priv->no_emap = 1;
- priv->orig_getsc = 0;
-
- if (ioctl (pInfo->fd, TCGETSC, &priv->orig_getsc) < 0)
- priv->use_tcs = 0;
- if (ioctl (pInfo->fd, KDGKBMODE, &priv->orig_kbm) < 0)
- priv->use_kd = 0;
-
- if (!priv->use_tcs && !priv->use_kd) {
- xf86Msg (X_ERROR, "KbdInit: Could not determine keyboard mode\n");
- return !Success;
- }
-
- /*
- * One day this should be fixed to translate normal ASCII characters
- * back into scancodes or into events that XFree86 wants, but not
- * now. For the time being, we only support scancode mode screens.
- */
- if (priv->use_tcs && !(priv->orig_getsc & KB_ISSCANCODE)) {
- xf86Msg (X_ERROR, "KbdInit: Keyboard can not send scancodes\n");
- return !Success;
- }
-
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the scancode API from messing with
- * the keyboard LED's. We restore the original map when we exit.
- */
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->keymap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- }
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->noledmap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- } else {
- int i, j;
-
- for (i = 0; i < priv->noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECIAL(priv->noledmap, i, j) &&
- ((priv->noledmap.key[i].map[j] == K_CLK) ||
- (priv->noledmap.key[i].map[j] == K_NLK) ||
- (priv->noledmap.key[i].map[j] == K_SLK))) {
- priv->noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-
- if (ioctl (pInfo->fd, XCGETA, &priv->kbdtty) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get terminal modes (%s)\n",
- strerror(errno));
- return !Success;
- }
-
- priv->sc_mapbuf = xalloc (10*BSIZE);
- priv->sc_mapbuf2 = xalloc(10*BSIZE);
-
- /* Get the emap */
- if (ioctl (pInfo->fd, LDGMAP, priv->sc_mapbuf) < 0) {
- if (errno != ENAVAIL) {
- xf86Msg (X_ERROR, "KbdInit: Failed to retrieve e-map (%s)\n",
- strerror (errno));
- return !Success;
- }
- priv->no_emap = 0;
- }
-
- /* Get the nmap */
- if (ioctl (pInfo->fd, NMGMAP, priv->sc_mapbuf2) < 0) {
- if (errno != ENAVAIL) {
- xf86Msg (X_ERROR, "KbdInit: Failed to retrieve n-map (%s)\n",
- strerror (errno));
- return !Success;
- }
- priv->no_nmap = 0;
- }
- } /* End of if we are on a console */
-
- return Success;
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
- struct termios newtio;
-
- if (pKbd->isConsole) {
- ioctl (pInfo->fd, LDNMAP); /* Turn e-mapping off */
- ioctl (pInfo->fd, NMNMAP); /* Turn n-mapping off */
-
- newtio = priv->kbdtty; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- cfsetispeed(&newtio, 9600);
- cfsetospeed(&newtio, 9600);
- ioctl(pInfo->fd, XCSETA, &newtio);
-
- /* Now tell the keyboard driver to send us raw scancodes */
- if (priv->use_tcs) {
- int nm = priv->orig_getsc;
- nm &= ~KB_XSCANCODE;
- ioctl (pInfo->fd, TCSETSC, &nm);
- }
-
- if (priv->use_kd)
- ioctl (pInfo->fd, KDSKBMODE, K_RAW);
-
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->noledmap);
- }
-
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- /* Revert back to original translate scancode mode */
- if (priv->use_tcs)
- ioctl (pInfo->fd, TCSETSC, &priv->orig_getsc);
- if (priv->use_kd)
- ioctl (pInfo->fd, KDSKBMODE, priv->orig_kbm);
-
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->keymap);
-
- if (priv->no_emap)
- ioctl (pInfo->fd, LDSMAP, priv->sc_mapbuf);
- if (priv->no_nmap)
- ioctl (pInfo->fd, NMSMAP, priv->sc_mapbuf2);
-
- ioctl(pInfo->fd, XCSETA, &priv->kbdtty);
- }
-
- return Success;
-}
-
-static int
-GetSpecialKey(InputInfoPtr pInfo, int scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int specialkey = scanCode;
-
- if (pKbd->CustomKeycodes) {
- specialkey = pKbd->specialMap->map[scanCode];
- }
- return specialkey;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static Bool
-SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((!ModifierSet(ShiftMask)) && ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask)))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (down) {
- int sts = key - KEY_F1;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_ACTIVATE, sts);
- }
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- int sts = key - KEY_F11 + 10;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_ACTIVATE, sts);
- }
- return TRUE;
- }
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F11 + 10);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if (!(ModifierSet(ShiftMask) || ModifierSet(ControlMask))) {
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- }
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
- return FALSE;
-}
-
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
-
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++) {
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, rBuf[i] & 0x80 ? FALSE : TRUE);
- }
- }
-}
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
- pInfo->read_input = stdReadInput;
- break;
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
-
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- xfree(s);
- }
-
- if (pKbd->isConsole)
- pKbd->vtSwitchSupported = TRUE;
-
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
- pKbd->GetSpecialKey = GetSpecialKey;
- pKbd->OpenKeyboard = OpenKeyboard;
- pKbd->RemapScanCode = ATScancode;
- pKbd->vtSwitchSupported = FALSE;
-
- pKbd->private = xcalloc(sizeof(ScoKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/sco/sco_kbd.h b/hw/xfree86/os-support/sco/sco_kbd.h
deleted file mode 100644
index a79cd7bb9..000000000
--- a/hw/xfree86/os-support/sco/sco_kbd.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $XFree86$ */
-#ifndef SCO_KBD_HDR
-#define SCO_KBD_HDR
-
-typedef struct {
- int use_tcs;
- int use_kd;
- int no_nmap;
- int no_emap;
- int orig_getsc;
- int orig_kbm;
- struct termios kbdtty;
- keymap_t keymap, noledmap;
- uchar_t *sc_mapbuf;
- uchar_t *sc_mapbuf2;
-} ScoKbdPrivRec, *ScoKbdPrivPtr;
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-#endif /* SCO_KBD_HDR */
diff --git a/hw/xfree86/os-support/shared/at_scancode.c b/hw/xfree86/os-support/shared/at_scancode.c
deleted file mode 100644
index 10d3da2ba..000000000
--- a/hw/xfree86/os-support/shared/at_scancode.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-
-Bool
-ATScancode(InputInfoPtr pInfo, int *scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- switch (pKbd->scanPrefix) {
- case 0:
- switch (*scanCode) {
- case KEY_Prefix0:
- case KEY_Prefix1:
- pKbd->scanPrefix = *scanCode; /* special prefixes */
- return TRUE;
- }
- if (!xf86IsPc98()) {
- switch (*scanCode) {
- case 0x59: *scanCode = KEY_0x59; break;
- case 0x5a: *scanCode = KEY_0x5A; break;
- case 0x5b: *scanCode = KEY_0x5B; break;
- case 0x5c: *scanCode = KEY_KP_Equal; break; /* Keypad Equal */
- case 0x5d: *scanCode = KEY_0x5D; break;
- case 0x5e: *scanCode = KEY_0x5E; break;
- case 0x5f: *scanCode = KEY_0x5F; break;
- case 0x62: *scanCode = KEY_0x62; break;
- case 0x63: *scanCode = KEY_0x63; break;
- case 0x64: *scanCode = KEY_0x64; break;
- case 0x65: *scanCode = KEY_0x65; break;
- case 0x66: *scanCode = KEY_0x66; break;
- case 0x67: *scanCode = KEY_0x67; break;
- case 0x68: *scanCode = KEY_0x68; break;
- case 0x69: *scanCode = KEY_0x69; break;
- case 0x6a: *scanCode = KEY_0x6A; break;
- case 0x6b: *scanCode = KEY_0x6B; break;
- case 0x6c: *scanCode = KEY_0x6C; break;
- case 0x6d: *scanCode = KEY_0x6D; break;
- case 0x6e: *scanCode = KEY_0x6E; break;
- case 0x6f: *scanCode = KEY_0x6F; break;
- case 0x70: *scanCode = KEY_0x70; break;
- case 0x71: *scanCode = KEY_0x71; break;
- case 0x72: *scanCode = KEY_0x72; break;
- case 0x73: *scanCode = KEY_0x73; break;
- case 0x74: *scanCode = KEY_0x74; break;
- case 0x75: *scanCode = KEY_0x75; break;
- case 0x76: *scanCode = KEY_0x76; break;
- }
- }
- break;
- case KEY_Prefix0:
- pKbd->scanPrefix = 0;
- switch (*scanCode) {
- case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */
- case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */
- case 0x5b: *scanCode = KEY_LMeta; break;
- case 0x5c: *scanCode = KEY_RMeta; break;
- case 0x5d: *scanCode = KEY_Menu; break;
- case KEY_F3: *scanCode = KEY_F13; break;
- case KEY_F4: *scanCode = KEY_F14; break;
- case KEY_F5: *scanCode = KEY_F15; break;
- case KEY_F6: *scanCode = KEY_F16; break;
- case KEY_F7: *scanCode = KEY_F17; break;
- case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break;
- case 0x2A:
- case 0x36:
- return TRUE;
- default:
- xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
- *scanCode);
- *scanCode += 0x78;
- }
- break;
- case KEY_Prefix1:
- pKbd->scanPrefix = (*scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
- return TRUE;
- case KEY_LCtrl:
- pKbd->scanPrefix = 0;
- if (*scanCode != KEY_NumLock)
- return TRUE;
- *scanCode = KEY_Pause; /* pause */
- }
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/shared/kbd.c b/hw/xfree86/os-support/shared/kbd.c
deleted file mode 100644
index dd6d77d82..000000000
--- a/hw/xfree86/os-support/shared/kbd.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2001-2003 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86OSKbd.h"
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/shared/std_kbdEv.c b/hw/xfree86/os-support/shared/std_kbdEv.c
deleted file mode 100644
index f56a5fd05..000000000
--- a/hw/xfree86/os-support/shared/std_kbdEv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE 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.
- *
- */
-/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-void
-xf86KbdEvents()
-{
- unsigned char rBuf[64];
- int nBytes, i;
-
- if ((nBytes = read( xf86Info.consoleFd, (char *)rBuf, sizeof(rBuf)))
- > 0)
- {
- for (i = 0; i < nBytes; i++)
- xf86PostKbdEvent(rBuf[i]);
- }
-}
-
diff --git a/hw/xfree86/os-support/shared/sysv_kbd.c b/hw/xfree86/os-support/shared/sysv_kbd.c
deleted file mode 100644
index d7d75191e..000000000
--- a/hw/xfree86/os-support/shared/sysv_kbd.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@XFree86.org>
- *
- * 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, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE 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.
- *
- */
-/* $XConsortium: sysv_kbd.c /main/3 1996/02/21 17:53:59 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-int
-xf86GetKbdLeds()
-{
- int leds;
-
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- return(leds);
-}
-
-void
-xf86SetKbdRepeat(char rad)
-{
-#ifdef KDSETRAD
- ioctl(xf86Info.consoleFd, KDSETRAD, rad);
-#endif
-}
-
-static int kbdtrans;
-static struct termio kbdtty;
-static char *kbdemap = NULL;
-
-void
-xf86KbdInit()
-{
-#ifdef KDGKBMODE
- ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
-#endif
- ioctl (xf86Info.consoleFd, TCGETA, &kbdtty);
-#if defined(E_TABSZ)
- kbdemap = xalloc(E_TABSZ);
- if (ioctl(xf86Info.consoleFd, LDGMAP, kbdemap) < 0)
- {
- xfree(kbdemap);
- kbdemap = NULL;
- }
-#endif
-}
-
-int
-xf86KbdOn()
-{
- struct termio nTty;
-
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
- ioctl(xf86Info.consoleFd, LDNMAP, 0); /* disable mapping completely */
- nTty = kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8 | B9600;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- ioctl(xf86Info.consoleFd, TCSETA, &nTty);
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
- if (kbdemap)
- {
- ioctl(xf86Info.consoleFd, LDSMAP, kbdemap);
- }
- ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans);
- ioctl(xf86Info.consoleFd, TCSETA, &kbdtty);
- return(xf86Info.consoleFd);
-}
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am
index 6b29b3080..291c329ea 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -1,10 +1,6 @@
if SOLARIS_USL_CONSOLE
-IO_SRC = $(srcdir)/../sysv/sysv_io.c
-KBD_SRCS = $(srcdir)/../shared/sysv_kbd.c $(srcdir)/../shared/std_kbdEv.c
VTSW_SRC = $(srcdir)/../shared/VTsw_usl.c
else
-IO_SRC = sun_io.c sun_kbd.h
-KBD_SRCS = sun_kbd.c sun_kbdEv.c sun_kbd.h
VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
endif
@@ -22,8 +18,8 @@ solaris-$(SOLARIS_INOUT_ARCH).il: solaris-${SOLARIS_INOUT_ARCH}.S
$(CPP) -P -DINLINE_ASM solaris-${SOLARIS_INOUT_ARCH}.S > $@
noinst_LTLIBRARIES = libsolaris.la
-libsolaris_la_SOURCES = sun_bios.c sun_init.c $(IO_SRC) $(KBD_SRCS) \
- sun_mouse.c sun_vid.c $(AGP_SRC) \
+libsolaris_la_SOURCES = sun_bios.c sun_init.c \
+ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) \
$(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/kmod_noop.c $(srcdir)/../shared/pm_noop.c \
$(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
new file mode 100644
index 000000000..369103f7b
--- /dev/null
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -0,0 +1,184 @@
+/* Copyright 2004-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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/audio.h>
+#include <sys/uio.h>
+#include <limits.h>
+#include <math.h>
+#include <poll.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#define BELL_RATE 48000 /* Samples per second */
+#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
+#define BELL_MS (1000/BELL_HZ) /* MS */
+#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
+#define BELL_MIN 3 /* Min # of repeats */
+
+#define AUDIO_DEVICE "/dev/audio"
+
+_X_EXPORT int
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ static short samples[BELL_SAMPLES];
+ static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
+ static int lastFreq;
+ int cnt;
+ int i;
+ int written;
+ int repeats;
+ int freq;
+ audio_info_t audioInfo;
+ struct iovec iov[IOV_MAX];
+ int iovcnt;
+ double ampl, cyclen, phase;
+ int audioFD;
+
+ if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
+ return 0;
+ }
+
+ lastFreq = 0;
+ bzero(silence, sizeof(silence));
+
+ audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
+ if (audioFD == -1) {
+ xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ return -1;
+ }
+
+ freq = pitch;
+ freq = min(freq, (BELL_RATE / 2) - 1);
+ freq = max(freq, 2 * BELL_HZ);
+
+ /*
+ * Ensure full waves per buffer
+ */
+ freq -= freq % BELL_HZ;
+
+ if (freq != lastFreq) {
+ lastFreq = freq;
+ ampl = 16384.0;
+
+ cyclen = (double) freq / (double) BELL_RATE;
+ phase = 0.0;
+
+ for (i = 0; i < BELL_SAMPLES; i++) {
+ samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
+ phase += cyclen;
+ if (phase >= 1.0)
+ phase -= 1.0;
+ }
+ }
+
+ repeats = (duration + (BELL_MS / 2)) / BELL_MS;
+ repeats = max(repeats, BELL_MIN);
+
+ loudness = max(0, loudness);
+ loudness = min(loudness, 100);
+
+#ifdef DEBUG
+ ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
+ freq, loudness, duration, repeats);
+#endif
+
+ AUDIO_INITINFO(&audioInfo);
+ audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
+ audioInfo.play.sample_rate = BELL_RATE;
+ audioInfo.play.channels = 2;
+ audioInfo.play.precision = 16;
+ audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
+
+ if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
+ xf86Msg(X_ERROR,
+ "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return -1;
+ }
+
+ iovcnt = 0;
+
+ for (cnt = 0; cnt <= repeats; cnt++) {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
+ if (cnt == repeats) {
+ /* Insert a bit of silence so that multiple beeps are distinct and
+ * not compressed into a single tone.
+ */
+ iov[iovcnt].iov_base = (char *) silence;
+ iov[iovcnt++].iov_len = sizeof(silence);
+ }
+ if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
+ written = writev(audioFD, iov, iovcnt);
+
+ if ((written < ((int)(sizeof(samples) * iovcnt)))) {
+ /* audio buffer was full! */
+
+ int naptime;
+
+ if (written == -1) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_ERROR,
+ "Bell: writev failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return -1;
+ }
+ i = iovcnt;
+ } else {
+ i = ((sizeof(samples) * iovcnt) - written)
+ / sizeof(samples);
+ }
+ cnt -= i;
+
+ /* sleep a little to allow audio buffer to drain */
+ naptime = BELL_MS * i;
+ poll(NULL, 0, naptime);
+
+ i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
+ iovcnt = 0;
+ if ((written != -1) && (i > 0)) {
+ iov[iovcnt].iov_base = ((char *) samples) + i;
+ iov[iovcnt++].iov_len = sizeof(samples) - i;
+ }
+ } else {
+ iovcnt = 0;
+ }
+ }
+ }
+
+ close(audioFD);
+ return 0;
+}
diff --git a/hw/xfree86/os-support/solaris/sun_io.c b/hw/xfree86/os-support/solaris/sun_io.c
deleted file mode 100644
index 3d8292e72..000000000
--- a/hw/xfree86/os-support/solaris/sun_io.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $XdotOrg: $ */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE 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.
- *
- */
-/* 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.
- */
-
-/* Solaris support routines for builtin "keyboard" driver */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "sun_kbd.h"
-
-static sunKbdPrivRec sunKeyboardPriv;
-
-_X_HIDDEN void
-xf86KbdInit(void)
-{
- const char *kbdName = "keyboard";
- pointer *kbdOptions = NULL;
- IDevPtr pDev;
-
- /* There should be a better way to find the keyboard device name, but
- this seems to work for now. */
- for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
- if (!xf86NameCmp(pDev->driver, "keyboard")) {
- kbdName = pDev->identifier;
- kbdOptions = pDev->commonOptions;
- break;
- }
- }
-
- if (xf86Info.kbdFd < 0) {
- xf86Info.kbdFd = sunKbdOpen(kbdName, kbdOptions);
- if (xf86Info.kbdFd < 0) {
- FatalError("Unable to open keyboard: /dev/kbd\n");
- }
- }
-
- memset(&sunKeyboardPriv, 0, sizeof(sunKbdPrivRec));
- if (sunKbdInit(&sunKeyboardPriv, xf86Info.kbdFd,
- kbdName, kbdOptions) != Success) {
- FatalError("Unable to initialize keyboard driver\n");
- }
-}
-
-_X_HIDDEN int
-xf86KbdOn(void)
-{
- if (sunKbdOn(&sunKeyboardPriv) != Success) {
- FatalError("Enabling keyboard");
- }
-
- return xf86Info.kbdFd;
-}
-
-_X_HIDDEN int
-xf86KbdOff(void)
-{
- if (sunKbdOff(&sunKeyboardPriv) != Success) {
- FatalError("Disabling keyboard");
- }
-
- return xf86Info.kbdFd;
-}
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- sunKbdSoundBell(&sunKeyboardPriv, loudness, pitch, duration);
-}
-
-_X_HIDDEN void
-xf86SetKbdLeds(int leds)
-{
- sunKbdSetLeds(&sunKeyboardPriv, leds);
-}
-
-_X_HIDDEN int
-xf86GetKbdLeds(void)
-{
- return sunKbdGetLeds(&sunKeyboardPriv);
-}
-
-_X_HIDDEN void
-xf86SetKbdRepeat(char rad)
-{
- sunKbdSetRepeat(&sunKeyboardPriv, rad);
-}
-
-/*
- * Lets try reading more than one keyboard event at a time in the hopes that
- * this will be slightly more efficient. Or we could just try the MicroSoft
- * method, and forget about efficiency. :-)
- */
-_X_HIDDEN void
-xf86KbdEvents(void)
-{
- Firm_event event[64];
- int nBytes, i;
-
- /* I certainly hope its not possible to read partial events */
-
- if ((nBytes = read(xf86Info.kbdFd, (char *)event, sizeof(event))) > 0)
- {
- for (i = 0; i < (nBytes / sizeof(Firm_event)); i++)
- sunPostKbdEvent(sunKeyboardPriv.ktype, &event[i]);
- }
-}
diff --git a/hw/xfree86/os-support/solaris/sun_kbd.c b/hw/xfree86/os-support/solaris/sun_kbd.c
deleted file mode 100644
index 2cb1d13a8..000000000
--- a/hw/xfree86/os-support/solaris/sun_kbd.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@XFree86.org>
- * Copyright 1999 by David Holland <davidh@iquest.net)
- *
- * 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, and
- * that the names of Thomas Roell, David Dawes, and David Holland not be used
- * in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. Thomas Roell, David Dawes, and
- * David Holland make no representations about the suitability of this software
- * for any purpose. It is provided "as is" without express or implied
- * warranty.
- *
- * THOMAS ROELL, DAVID DAWES, AND DAVID HOLLAND DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL THOMAS ROELL, DAVID DAWES, OR DAVID HOLLAND
- * BE LIABLE 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.
- */
-/* Copyright 2004-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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSKbd.h"
-#include "sun_kbd.h"
-
-/* Define to provide support for using /dev/audio to ring the bell instead of
- the keyboard beeper */
-#define AUDIO_BELL
-
-#ifdef AUDIO_BELL
-#include <sys/audio.h>
-#include <sys/uio.h>
-#include <limits.h>
-#include <math.h>
-#include <poll.h>
-#endif
-
-/***************************************************************************
- * Common implementation of routines shared by "keyboard" driver in sun_io.c
- * and "kbd" driver (later on in this file)
- */
-
-#include <sys/stropts.h>
-#include <sys/vuid_event.h>
-#include <sys/kbd.h>
-
-_X_HIDDEN int
-sunKbdOpen(const char *devName, pointer options)
-{
- int kbdFD;
- const char *kbdPath = NULL;
- const char *defaultKbd = "/dev/kbd";
-
- if (options != NULL) {
- kbdPath = xf86SetStrOption(options, "Device", NULL);
- }
- if (kbdPath == NULL) {
- kbdPath = defaultKbd;
- }
-
- kbdFD = open(kbdPath, O_RDONLY | O_NONBLOCK);
-
- if (kbdFD == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", devName, kbdPath);
- } else {
- xf86MsgVerb(X_INFO, 3, "%s: Opened device \"%s\"\n", devName, kbdPath);
- }
-
- if ((kbdPath != NULL) && (kbdPath != defaultKbd)) {
- xfree(kbdPath);
- }
- return kbdFD;
-}
-
-
-/*
- * Save initial keyboard state. This is called at the start of each server
- * generation.
- */
-
-_X_HIDDEN int
-sunKbdInit(sunKbdPrivPtr priv, int kbdFD, const char *devName, pointer options)
-{
- int ktype, klayout, i;
- const char *ktype_name;
-
- priv->kbdFD = kbdFD;
- priv->devName = devName;
- priv->otranslation = -1;
- priv->odirect = -1;
-
- if (options != NULL) {
- priv->strmod = xf86SetStrOption(options, "StreamsModule", NULL);
- priv->audioDevName = xf86SetStrOption(options, "BellDevice", NULL);
-
- if (priv->audioDevName && (priv->audioDevName[0] == '\0')) {
- xfree(priv->audioDevName);
- priv->audioDevName = NULL;
- }
- } else {
- priv->strmod = NULL;
- priv->audioDevName = NULL;
- }
-
- if (priv->strmod) {
- SYSCALL(i = ioctl(priv->kbdFD, I_PUSH, priv->strmod));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: cannot push module '%s' onto keyboard device: %s\n",
- priv->devName, priv->strmod, strerror(errno));
- }
- }
-
- SYSCALL(i = ioctl(kbdFD, KIOCTYPE, &ktype));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Unable to determine keyboard type: %s\n",
- devName, strerror(errno));
- return BadImplementation;
- }
-
- SYSCALL(i = ioctl(kbdFD, KIOCLAYOUT, &klayout));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Unable to determine keyboard layout: %s\n",
- devName, strerror(errno));
- return BadImplementation;
- }
-
- switch (ktype) {
- case KB_SUN3:
- ktype_name = "Sun Type 3"; break;
- case KB_SUN4:
- ktype_name = "Sun Type 4/5/6"; break;
- case KB_USB:
- ktype_name = "USB"; break;
- case KB_PC:
- ktype_name = "PC"; break;
- default:
- ktype_name = "Unknown"; break;
- }
-
- xf86Msg(X_PROBED, "%s: Keyboard type: %s (%d)\n",
- devName, ktype_name, ktype);
- xf86Msg(X_PROBED, "%s: Keyboard layout: %d\n", devName, klayout);
-
- priv->ktype = ktype;
- priv->keyMap = sunGetKbdMapping(ktype);
- priv->audioState = AB_INITIALIZING;
- priv->oleds = sunKbdGetLeds(priv);
-
- return Success;
-}
-
-_X_HIDDEN int
-sunKbdOn(sunKbdPrivPtr priv)
-{
- int ktrans, kdirect, i;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCGDIRECT, &kdirect));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to determine keyboard direct setting: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- priv->odirect = kdirect;
- kdirect = 1;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCSDIRECT, &kdirect));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed turning keyboard direct mode on: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- /* Setup translation */
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCGTRANS, &ktrans));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to determine keyboard translation mode: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- priv->otranslation = ktrans;
- ktrans = TR_UNTRANS_EVENT;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCTRANS, &ktrans));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed setting keyboard translation mode: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- return Success;
-}
-
-_X_HIDDEN int
-sunKbdOff(sunKbdPrivPtr priv)
-{
- int i;
-
- /* restore original state */
-
- sunKbdSetLeds(priv, priv->oleds);
-
- if (priv->otranslation != -1) {
- SYSCALL(i = ioctl(priv->kbdFD, KIOCTRANS, &priv->otranslation));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to restore keyboard translation mode: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
- priv->otranslation = -1;
- }
-
- if (priv->odirect != -1) {
- SYSCALL(i = ioctl(priv->kbdFD, KIOCSDIRECT, &priv->odirect));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to restore keyboard direct setting: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
- priv->odirect = -1;
- }
-
- if (priv->strmod) {
- SYSCALL(i = ioctl(priv->kbdFD, I_POP, priv->strmod));
- if (i < 0) {
- xf86Msg(X_WARNING,
- "%s: cannot pop module '%s' off keyboard device: %s\n",
- priv->devName, priv->strmod, strerror(errno));
- }
- }
-
- return Success;
-}
-
-#ifdef AUDIO_BELL
-
-/* Helper function to ring bell via audio device instead of keyboard beeper */
-
-#define BELL_RATE 48000 /* Samples per second */
-#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
-#define BELL_MS (1000/BELL_HZ) /* MS */
-#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
-#define BELL_MIN 3 /* Min # of repeats */
-
-static int
-sunKbdAudioBell(sunKbdPrivPtr priv, int loudness, int pitch, int duration)
-{
- static short samples[BELL_SAMPLES];
- static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
- static int lastFreq;
- int cnt;
- int i;
- int written;
- int repeats;
- int freq;
- audio_info_t audioInfo;
- struct iovec iov[IOV_MAX];
- int iovcnt;
- double ampl, cyclen, phase;
- int audioFD;
-
- if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
- return 0;
- }
-
- if ((priv == NULL) || (priv->audioDevName == NULL)) {
- return -1;
- }
-
- if (priv->audioState == AB_INITIALIZING) {
- priv->audioState = AB_NORMAL;
- lastFreq = 0;
- bzero(silence, sizeof(silence));
- }
-
- audioFD = open(priv->audioDevName, O_WRONLY | O_NONBLOCK);
- if (audioFD == -1) {
- xf86Msg(X_ERROR, "%s: cannot open audio device \"%s\": %s\n",
- priv->devName, priv->audioDevName, strerror(errno));
- return -1;
- }
-
- freq = pitch;
- freq = min(freq, (BELL_RATE / 2) - 1);
- freq = max(freq, 2 * BELL_HZ);
-
- /*
- * Ensure full waves per buffer
- */
- freq -= freq % BELL_HZ;
-
- if (freq != lastFreq) {
- lastFreq = freq;
- ampl = 16384.0;
-
- cyclen = (double) freq / (double) BELL_RATE;
- phase = 0.0;
-
- for (i = 0; i < BELL_SAMPLES; i++) {
- samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
- phase += cyclen;
- if (phase >= 1.0)
- phase -= 1.0;
- }
- }
-
- repeats = (duration + (BELL_MS / 2)) / BELL_MS;
- repeats = max(repeats, BELL_MIN);
-
- loudness = max(0, loudness);
- loudness = min(loudness, 100);
-
-#ifdef DEBUG
- ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
- freq, loudness, duration, repeats);
-#endif
-
- AUDIO_INITINFO(&audioInfo);
- audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
- audioInfo.play.sample_rate = BELL_RATE;
- audioInfo.play.channels = 2;
- audioInfo.play.precision = 16;
- audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
-
- if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
- xf86Msg(X_ERROR,
- "%s: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
- priv->devName, priv->audioDevName, strerror(errno));
- close(audioFD);
- return -1;
- }
-
- iovcnt = 0;
-
- for (cnt = 0; cnt <= repeats; cnt++) {
- iov[iovcnt].iov_base = (char *) samples;
- iov[iovcnt++].iov_len = sizeof(samples);
- if (cnt == repeats) {
- /* Insert a bit of silence so that multiple beeps are distinct and
- * not compressed into a single tone.
- */
- iov[iovcnt].iov_base = (char *) silence;
- iov[iovcnt++].iov_len = sizeof(silence);
- }
- if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
- written = writev(audioFD, iov, iovcnt);
-
- if ((written < ((int)(sizeof(samples) * iovcnt)))) {
- /* audio buffer was full! */
-
- int naptime;
-
- if (written == -1) {
- if (errno != EAGAIN) {
- xf86Msg(X_ERROR,
- "%s: writev failed on audio device \"%s\": %s\n",
- priv->devName, priv->audioDevName,
- strerror(errno));
- close(audioFD);
- return -1;
- }
- i = iovcnt;
- } else {
- i = ((sizeof(samples) * iovcnt) - written)
- / sizeof(samples);
- }
- cnt -= i;
-
- /* sleep a little to allow audio buffer to drain */
- naptime = BELL_MS * i;
- poll(NULL, 0, naptime);
-
- i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
- iovcnt = 0;
- if ((written != -1) && (i > 0)) {
- iov[iovcnt].iov_base = ((char *) samples) + i;
- iov[iovcnt++].iov_len = sizeof(samples) - i;
- }
- } else {
- iovcnt = 0;
- }
- }
- }
-
- close(audioFD);
- return 0;
-}
-
-#endif /* AUDIO_BELL */
-
-_X_HIDDEN void
-sunKbdSoundBell(sunKbdPrivPtr priv, int loudness, int pitch, int duration)
-{
- int kbdCmd, i;
-
- if (loudness && pitch)
- {
-#ifdef AUDIO_BELL
- if (priv->audioDevName != NULL) {
- if (sunKbdAudioBell(priv, loudness, pitch, duration) == 0) {
- return;
- }
- }
-#endif
-
- kbdCmd = KBD_CMD_BELL;
-
- SYSCALL(i = ioctl (priv->kbdFD, KIOCCMD, &kbdCmd));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to activate bell: %s\n",
- priv->devName, strerror(errno));
- }
-
- usleep(duration * loudness * 20);
-
- kbdCmd = KBD_CMD_NOBELL;
- SYSCALL(i = ioctl (priv->kbdFD, KIOCCMD, &kbdCmd));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to deactivate bell: %s\n",
- priv->devName, strerror(errno));
- }
- }
-}
-
-_X_HIDDEN void
-sunKbdSetLeds(sunKbdPrivPtr priv, int leds)
-{
- int i;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCSLED, &leds));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to set keyboard LED's: %s\n",
- priv->devName, strerror(errno));
- }
-}
-
-_X_HIDDEN int
-sunKbdGetLeds(sunKbdPrivPtr priv)
-{
- int i, leds = 0;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCGLED, &leds));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to get keyboard LED's: %s\n",
- priv->devName, strerror(errno));
- }
- return leds;
-}
-
-/* ARGSUSED0 */
-_X_HIDDEN void
-sunKbdSetRepeat(sunKbdPrivPtr priv, char rad)
-{
- /* Nothing to do */
-}
-
-/***************************************************************************
- * Routines called from "kbd" driver via proc vectors filled in by
- * xf86OSKbdPreInit().
- */
-
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- return sunKbdInit(priv, pInfo->fd, pInfo->name, pInfo->options);
-}
-
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- return sunKbdOn(priv);
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- return sunKbdOff(priv);
-}
-
-
-static void
-SoundKbdBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- sunKbdSoundBell(priv, loudness, pitch, duration);
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- int real_leds = sunKbdGetLeds(priv);
-
- real_leds &= ~(LED_CAPS_LOCK | LED_NUM_LOCK | LED_SCROLL_LOCK | LED_COMPOSE);
-
- if (leds & XLED1) real_leds |= LED_CAPS_LOCK;
- if (leds & XLED2) real_leds |= LED_NUM_LOCK;
- if (leds & XLED3) real_leds |= LED_SCROLL_LOCK;
- if (leds & XLED4) real_leds |= LED_COMPOSE;
-
- sunKbdSetLeds(priv, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- int leds = 0;
- int real_leds = sunKbdGetLeds(priv);
-
- if (real_leds & LED_CAPS_LOCK) leds |= XLED1;
- if (real_leds & LED_NUM_LOCK) leds |= XLED2;
- if (real_leds & LED_SCROLL_LOCK) leds |= XLED3;
- if (real_leds & LED_COMPOSE) leds |= XLED4;
-
- return leds;
-}
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- sunKbdSetRepeat(priv, rad);
-}
-
-static void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- /* Should probably do something better here */
- xf86KbdGetMapping(pKeySyms, pModMap);
-}
-
-static void
-ReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- Firm_event event[64];
- int nBytes, i;
-
- /* I certainly hope its not possible to read partial events */
-
- if ((nBytes = read(pInfo->fd, (char *)event, sizeof(event))) > 0)
- {
- for (i = 0; i < (nBytes / sizeof(Firm_event)); i++) {
- pKbd->PostEvent(pInfo, priv->keyMap[event[i].id],
- event[i].value == VKEY_DOWN ? TRUE : FALSE);
- }
- }
-}
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- pInfo->fd = sunKbdOpen(pInfo->name, pInfo->options);
-
- if (pInfo->fd >= 0) {
- pInfo->read_input = ReadInput;
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundKbdBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
-
- pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = NULL;
- pKbd->SpecialKey = NULL;
-
- pKbd->OpenKeyboard = OpenKeyboard;
-
- pKbd->vtSwitchSupported = FALSE;
- pKbd->CustomKeycodes = FALSE;
-
- pKbd->private = xcalloc(sizeof(sunKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- } else {
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- priv->otranslation = -1;
- priv->odirect = -1;
- }
-
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/solaris/sun_kbd.h b/hw/xfree86/os-support/solaris/sun_kbd.h
deleted file mode 100644
index ed2824b1f..000000000
--- a/hw/xfree86/os-support/solaris/sun_kbd.h
+++ /dev/null
@@ -1,72 +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.
- */
-
-#ifndef _XORG_SUN_KBD_H_
-#define _XORG_SUN_KBD_H_
-
-/*
- * Keyboard common implementation routines shared by "keyboard" driver
- * in sun_io.c and "kbd" driver in sun_kbd.c
- */
-
-typedef struct {
- int kbdFD;
- const char * devName;
- int ktype; /* Keyboard type from KIOCTYPE */
- Bool kbdActive; /* Have we set kbd modes for X? */
- int otranslation; /* Original translation mode */
- int odirect; /* Original "direct" mode setting */
- unsigned char oleds; /* Original LED state */
- const char * strmod; /* Streams module pushed on kbd device */
- const char * audioDevName; /* Audio device path to use for bell
- or NULL to use keyboard beeper */
- enum {AB_INITIALIZING, AB_NORMAL} audioState;
- const unsigned char *keyMap;
-} sunKbdPrivRec, *sunKbdPrivPtr;
-
-/* sun_kbd.c */
-extern int sunKbdOpen (const char *devName, pointer options);
-extern int sunKbdInit (sunKbdPrivPtr priv, int kbdFD,
- const char *devName, pointer options);
-extern int sunKbdOn (sunKbdPrivPtr priv);
-extern int sunKbdOff (sunKbdPrivPtr priv);
-
-extern void sunKbdSoundBell (sunKbdPrivPtr priv,
- int loudness, int pitch, int duration);
-
-extern void sunKbdSetLeds (sunKbdPrivPtr priv, int leds);
-extern int sunKbdGetLeds (sunKbdPrivPtr priv);
-extern void sunKbdSetRepeat (sunKbdPrivPtr priv, char rad);
-
-/* sun_kbdEv.c */
-#include <sys/vuid_event.h>
-extern void sunPostKbdEvent (int ktype, Firm_event *event);
-
-extern const unsigned char *sunGetKbdMapping(int ktype);
-
-#endif
diff --git a/hw/xfree86/os-support/solaris/sun_kbdEv.c b/hw/xfree86/os-support/solaris/sun_kbdEv.c
deleted file mode 100644
index df8b6fac5..000000000
--- a/hw/xfree86/os-support/solaris/sun_kbdEv.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and
- * that the names of Thomas Roell and David Dawes not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Thomas Roell and David Dawes make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
- * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE 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.
- */
-
-/* [JCH-96/01/21] Extended std reverse map to four buttons. */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "sun_kbd.h"
-
-#ifdef XINPUT
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "xf86Xinput.h"
-#else
-#include "inputstr.h"
-#endif
-
-#include <sys/kbd.h>
-#include "atKeynames.h"
-
-#ifdef XKB
-extern Bool noXkbExtension;
-#endif
-
-#define XE_POINTER 1
-#define XE_KEYBOARD 2
-
-#ifdef XINPUT
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- xf86eqEnqueue((ev))
-#else
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- mieqEnqueue((ev))
-#endif
-
-static void startautorepeat(long keycode);
-static CARD32 processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg);
-
-static OsTimerPtr sunTimer = NULL;
-
-/* Map the Solaris keycodes to the "XFree86" keycodes. */
-/*
- * This doesn't seem right. It probably needs to be dependent on a keyboard
- * type.
- */
-
-/* Additional Sun Japanese Keyboard Keys not defined in common/atKeynames.h */
-#define KEY_Kanji 0x82
-#define KEY_Execute 0x83
-
-static unsigned char map[256] = {
-#if defined(i386) || defined(__i386) || defined(__i386__) || defined(__x86)
- KEY_NOTUSED, /* 0 */
- KEY_Tilde, /* 1 */
- KEY_1, /* 2 */
- KEY_2, /* 3 */
- KEY_3, /* 4 */
- KEY_4, /* 5 */
- KEY_5, /* 6 */
- KEY_6, /* 7 */
- KEY_7, /* 8 */
- KEY_8, /* 9 */
- KEY_9, /* 10 */
- KEY_0, /* 11 */
- KEY_Minus, /* 12 */
- KEY_Equal, /* 13 */
- 0x7D, /*KEY_P_YEN*/ /* 14 */
- KEY_BackSpace, /* 15 */
- KEY_Tab, /* 16 */
- KEY_Q, /* 17 */
- KEY_W, /* 18 */
- KEY_E, /* 19 */
- KEY_R, /* 20 */
- KEY_T, /* 21 */
- KEY_Y, /* 22 */
- KEY_U, /* 23 */
- KEY_I, /* 24 */
- KEY_O, /* 25 */
- KEY_P, /* 26 */
- KEY_LBrace, /* 27 */
- KEY_RBrace, /* 28 */
- KEY_BSlash, /* 29 */
- KEY_CapsLock, /* 30 */
- KEY_A, /* 31 */
- KEY_S, /* 32 */
- KEY_D, /* 33 */
- KEY_F, /* 34 */
- KEY_G, /* 35 */
- KEY_H, /* 36 */
- KEY_J, /* 37 */
- KEY_K, /* 38 */
- KEY_L, /* 39 */
- KEY_SemiColon, /* 40 */
- KEY_Quote, /* 41 */
- KEY_UNKNOWN, /* 42 */
- KEY_Enter, /* 43 */
- KEY_ShiftL, /* 44 */
- KEY_Less, /* 45 */
- KEY_Z, /* 46 */
- KEY_X, /* 47 */
- KEY_C, /* 48 */
- KEY_V, /* 49 */
- KEY_B, /* 50 */
- KEY_N, /* 51 */
- KEY_M, /* 52 */
- KEY_Comma, /* 53 */
- KEY_Period, /* 54 */
- KEY_Slash, /* 55 */
- KEY_BSlash2, /* 56 */
- KEY_ShiftR, /* 57 */
- KEY_LCtrl, /* 58 */
- KEY_LMeta, /* 59 */
- KEY_Alt, /* 60 */
- KEY_Space, /* 61 */
- KEY_AltLang, /* 62 */
- KEY_RMeta, /* 63 */
- KEY_RCtrl, /* 64 */
- KEY_Menu, /* 65 */
- KEY_UNKNOWN, /* 66 */
- KEY_UNKNOWN, /* 67 */
- KEY_UNKNOWN, /* 68 */
- KEY_UNKNOWN, /* 69 */
- KEY_UNKNOWN, /* 70 */
- KEY_UNKNOWN, /* 71 */
- KEY_UNKNOWN, /* 72 */
- KEY_UNKNOWN, /* 73 */
- KEY_UNKNOWN, /* 74 */
- KEY_Insert, /* 75 */
- KEY_Delete, /* 76 */
- KEY_UNKNOWN, /* 77 */
- KEY_UNKNOWN, /* 78 */
- KEY_Left, /* 79 */
- KEY_Home, /* 80 */
- KEY_End, /* 81 */
- KEY_UNKNOWN, /* 82 */
- KEY_Up, /* 83 */
- KEY_Down, /* 84 */
- KEY_PgUp, /* 85 */
- KEY_PgDown, /* 86 */
- KEY_UNKNOWN, /* 87 */
- KEY_UNKNOWN, /* 88 */
- KEY_Right, /* 89 */
- KEY_NumLock, /* 90 */
- KEY_KP_7, /* 91 */
- KEY_KP_4, /* 92 */
- KEY_KP_1, /* 93 */
- KEY_UNKNOWN, /* 94 */
- KEY_KP_Divide, /* 95 */
- KEY_KP_8, /* 96 */
- KEY_KP_5, /* 97 */
- KEY_KP_2, /* 98 */
- KEY_KP_0, /* 99 */
- KEY_KP_Multiply, /* 100 */
- KEY_KP_9, /* 101 */
- KEY_KP_6, /* 102 */
- KEY_KP_3, /* 103 */
- KEY_KP_Decimal, /* 104 */
- KEY_KP_Minus, /* 105 */
- KEY_KP_Plus, /* 106 */
- KEY_UNKNOWN, /* 107 */
- KEY_KP_Enter, /* 108 */
- KEY_UNKNOWN, /* 109 */
- KEY_Escape, /* 110 */
- KEY_UNKNOWN, /* 111 */
- KEY_F1, /* 112 */
- KEY_F2, /* 113 */
- KEY_F3, /* 114 */
- KEY_F4, /* 115 */
- KEY_F5, /* 116 */
- KEY_F6, /* 117 */
- KEY_F7, /* 118 */
- KEY_F8, /* 119 */
- KEY_F9, /* 120 */
- KEY_F10, /* 121 */
- KEY_F11, /* 122 */
- KEY_F12, /* 123 */
- KEY_Print, /* 124 */
- KEY_ScrollLock, /* 125 */
- KEY_Pause, /* 126 */
- KEY_UNKNOWN, /* 127 */
- KEY_UNKNOWN, /* 128 */
- KEY_UNKNOWN, /* 129 */
- KEY_UNKNOWN, /* 130 */
- KEY_NFER, /* 131 */
- KEY_XFER, /* 132 */
- KEY_HKTG, /* 133 */
- KEY_UNKNOWN, /* 134 */
-#elif defined(sparc) || defined(__sparc__)
- KEY_UNKNOWN, /* 0x00 */
- KEY_UNKNOWN, /* 0x01 */
- KEY_UNKNOWN, /* 0x02 */
- KEY_UNKNOWN, /* 0x03 */
- KEY_UNKNOWN, /* 0x04 */
- KEY_F1, /* 0x05 */
- KEY_F2, /* 0x06 */
- KEY_F10, /* 0x07 */
- KEY_F3, /* 0x08 */
- KEY_F11, /* 0x09 */
- KEY_F4, /* 0x0A */
- KEY_F12, /* 0x0B */
- KEY_F5, /* 0x0C */
- KEY_UNKNOWN, /* 0x0D */
- KEY_F6, /* 0x0E */
- KEY_UNKNOWN, /* 0x0F */
- KEY_F7, /* 0x10 */
- KEY_F8, /* 0x11 */
- KEY_F9, /* 0x12 */
- KEY_Alt, /* 0x13 */
- KEY_Up, /* 0x14 */
- KEY_Pause, /* 0x15 */
- KEY_SysReqest, /* 0x16 */
- KEY_ScrollLock, /* 0x17 */
- KEY_Left, /* 0x18 */
- KEY_UNKNOWN, /* 0x19 */
- KEY_UNKNOWN, /* 0x1A */
- KEY_Down, /* 0x1B */
- KEY_Right, /* 0x1C */
- KEY_Escape, /* 0x1D */
- KEY_1, /* 0x1E */
- KEY_2, /* 0x1F */
- KEY_3, /* 0x20 */
- KEY_4, /* 0x21 */
- KEY_5, /* 0x22 */
- KEY_6, /* 0x23 */
- KEY_7, /* 0x24 */
- KEY_8, /* 0x25 */
- KEY_9, /* 0x26 */
- KEY_0, /* 0x27 */
- KEY_Minus, /* 0x28 */
- KEY_Equal, /* 0x29 */
- KEY_Tilde, /* 0x2A */
- KEY_BackSpace, /* 0x2B */
- KEY_Insert, /* 0x2C */
- KEY_UNKNOWN, /* 0x2D */
- KEY_KP_Divide, /* 0x2E */
- KEY_KP_Multiply, /* 0x2F */
- KEY_UNKNOWN, /* 0x30 */
- KEY_UNKNOWN, /* 0x31 */
- KEY_KP_Decimal, /* 0x32 */
- KEY_UNKNOWN, /* 0x33 */
- KEY_Home, /* 0x34 */
- KEY_Tab, /* 0x35 */
- KEY_Q, /* 0x36 */
- KEY_W, /* 0x37 */
- KEY_E, /* 0x38 */
- KEY_R, /* 0x39 */
- KEY_T, /* 0x3A */
- KEY_Y, /* 0x3B */
- KEY_U, /* 0x3C */
- KEY_I, /* 0x3D */
- KEY_O, /* 0x3E */
- KEY_P, /* 0x3F */
- KEY_LBrace, /* 0x40 */
- KEY_RBrace, /* 0x41 */
- KEY_Delete, /* 0x42 */
- KEY_UNKNOWN, /* 0x43 */
- KEY_KP_7, /* 0x44 */
- KEY_KP_8, /* 0x45 */
- KEY_KP_9, /* 0x46 */
- KEY_KP_Minus, /* 0x47 */
- KEY_UNKNOWN, /* 0x48 */
- KEY_UNKNOWN, /* 0x49 */
- KEY_End, /* 0x4A */
- KEY_UNKNOWN, /* 0x4B */
- KEY_LCtrl, /* 0x4C */
- KEY_A, /* 0x4D */
- KEY_S, /* 0x4E */
- KEY_D, /* 0x4F */
- KEY_F, /* 0x50 */
- KEY_G, /* 0x51 */
- KEY_H, /* 0x52 */
- KEY_J, /* 0x53 */
- KEY_K, /* 0x54 */
- KEY_L, /* 0x55 */
- KEY_SemiColon, /* 0x56 */
- KEY_Quote, /* 0x57 */
- KEY_BSlash, /* 0x58 */
- KEY_Enter, /* 0x59 */
- KEY_KP_Enter, /* 0x5A */
- KEY_KP_4, /* 0x5B */
- KEY_KP_5, /* 0x5C */
- KEY_KP_6, /* 0x5D */
- KEY_KP_0, /* 0x5E */
- KEY_UNKNOWN, /* 0x5F */
- KEY_PgUp, /* 0x60 */
- KEY_UNKNOWN, /* 0x61 */
- KEY_NumLock, /* 0x62 */
- KEY_ShiftL, /* 0x63 */
- KEY_Z, /* 0x64 */
- KEY_X, /* 0x65 */
- KEY_C, /* 0x66 */
- KEY_V, /* 0x67 */
- KEY_B, /* 0x68 */
- KEY_N, /* 0x69 */
- KEY_M, /* 0x6A */
- KEY_Comma, /* 0x6B */
- KEY_Period, /* 0x6C */
- KEY_Slash, /* 0x6D */
- KEY_ShiftR, /* 0x6E */
- KEY_UNKNOWN, /* 0x6F */
- KEY_KP_1, /* 0x70 */
- KEY_KP_2, /* 0x71 */
- KEY_KP_3, /* 0x72 */
- KEY_UNKNOWN, /* 0x73 */
- KEY_UNKNOWN, /* 0x74 */
- KEY_UNKNOWN, /* 0x75 */
- KEY_UNKNOWN, /* 0x76 */
- KEY_CapsLock, /* 0x77 */
- KEY_LMeta, /* 0x78 */
- KEY_Space, /* 0x79 */
- KEY_RMeta, /* 0x7A */
- KEY_PgDown, /* 0x7B */
- KEY_UNKNOWN, /* 0x7C */
- KEY_KP_Plus, /* 0x7D */
- KEY_UNKNOWN, /* 0x7E */
- KEY_UNKNOWN, /* 0x7F */
-#endif
- /* The rest default to KEY_UNKNOWN */
-};
-
-#if defined(KB_USB)
-static unsigned char usbmap[256] = {
-/*
- * partially taken from ../bsd/bsd_KbdMap.c
- *
- * added keycodes for Sun special keys (left function keys, audio control)
- */
- /* 0 */ KEY_NOTUSED,
- /* 1 */ KEY_NOTUSED,
- /* 2 */ KEY_NOTUSED,
- /* 3 */ KEY_NOTUSED,
- /* 4 */ KEY_A,
- /* 5 */ KEY_B,
- /* 6 */ KEY_C,
- /* 7 */ KEY_D,
- /* 8 */ KEY_E,
- /* 9 */ KEY_F,
- /* 10 */ KEY_G,
- /* 11 */ KEY_H,
- /* 12 */ KEY_I,
- /* 13 */ KEY_J,
- /* 14 */ KEY_K,
- /* 15 */ KEY_L,
- /* 16 */ KEY_M,
- /* 17 */ KEY_N,
- /* 18 */ KEY_O,
- /* 19 */ KEY_P,
- /* 20 */ KEY_Q,
- /* 21 */ KEY_R,
- /* 22 */ KEY_S,
- /* 23 */ KEY_T,
- /* 24 */ KEY_U,
- /* 25 */ KEY_V,
- /* 26 */ KEY_W,
- /* 27 */ KEY_X,
- /* 28 */ KEY_Y,
- /* 29 */ KEY_Z,
- /* 30 */ KEY_1, /* 1 !*/
- /* 31 */ KEY_2, /* 2 @ */
- /* 32 */ KEY_3, /* 3 # */
- /* 33 */ KEY_4, /* 4 $ */
- /* 34 */ KEY_5, /* 5 % */
- /* 35 */ KEY_6, /* 6 ^ */
- /* 36 */ KEY_7, /* 7 & */
- /* 37 */ KEY_8, /* 8 * */
- /* 38 */ KEY_9, /* 9 ( */
- /* 39 */ KEY_0, /* 0 ) */
- /* 40 */ KEY_Enter, /* Return */
- /* 41 */ KEY_Escape, /* Escape */
- /* 42 */ KEY_BackSpace, /* Backspace Delete */
- /* 43 */ KEY_Tab, /* Tab */
- /* 44 */ KEY_Space, /* Space */
- /* 45 */ KEY_Minus, /* - _ */
- /* 46 */ KEY_Equal, /* = + */
- /* 47 */ KEY_LBrace, /* [ { */
- /* 48 */ KEY_RBrace, /* ] } */
- /* 49 */ KEY_BSlash, /* \ | */
- /* 50 */ KEY_BSlash, /* \ _ # ~ on some keyboards */
- /* 51 */ KEY_SemiColon, /* ; : */
- /* 52 */ KEY_Quote, /* ' " */
- /* 53 */ KEY_Tilde, /* ` ~ */
- /* 54 */ KEY_Comma, /* , < */
- /* 55 */ KEY_Period, /* . > */
- /* 56 */ KEY_Slash, /* / ? */
- /* 57 */ KEY_CapsLock, /* Caps Lock */
- /* 58 */ KEY_F1, /* F1 */
- /* 59 */ KEY_F2, /* F2 */
- /* 60 */ KEY_F3, /* F3 */
- /* 61 */ KEY_F4, /* F4 */
- /* 62 */ KEY_F5, /* F5 */
- /* 63 */ KEY_F6, /* F6 */
- /* 64 */ KEY_F7, /* F7 */
- /* 65 */ KEY_F8, /* F8 */
- /* 66 */ KEY_F9, /* F9 */
- /* 67 */ KEY_F10, /* F10 */
- /* 68 */ KEY_F11, /* F11 */
- /* 69 */ KEY_F12, /* F12 */
- /* 70 */ KEY_Print, /* PrintScrn SysReq */
- /* 71 */ KEY_ScrollLock, /* Scroll Lock */
- /* 72 */ KEY_Pause, /* Pause Break */
- /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
- /* 74 */ KEY_Home, /* Home */
- /* 75 */ KEY_PgUp, /* Page Up */
- /* 76 */ KEY_Delete, /* Delete */
- /* 77 */ KEY_End, /* End */
- /* 78 */ KEY_PgDown, /* Page Down */
- /* 79 */ KEY_Right, /* Right Arrow */
- /* 80 */ KEY_Left, /* Left Arrow */
- /* 81 */ KEY_Down, /* Down Arrow */
- /* 82 */ KEY_Up, /* Up Arrow */
- /* 83 */ KEY_NumLock, /* Num Lock */
- /* 84 */ KEY_KP_Divide, /* Keypad / */
- /* 85 */ KEY_KP_Multiply, /* Keypad * */
- /* 86 */ KEY_KP_Minus, /* Keypad - */
- /* 87 */ KEY_KP_Plus, /* Keypad + */
- /* 88 */ KEY_KP_Enter, /* Keypad Enter */
- /* 89 */ KEY_KP_1, /* Keypad 1 End */
- /* 90 */ KEY_KP_2, /* Keypad 2 Down */
- /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
- /* 92 */ KEY_KP_4, /* Keypad 4 Left */
- /* 93 */ KEY_KP_5, /* Keypad 5 */
- /* 94 */ KEY_KP_6, /* Keypad 6 */
- /* 95 */ KEY_KP_7, /* Keypad 7 Home */
- /* 96 */ KEY_KP_8, /* Keypad 8 Up */
- /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
- /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
- /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
- /* 100 */ KEY_Less, /* < > on some keyboards */
- /* 101 */ KEY_Menu, /* Menu */
- /* 102 */ KEY_Power, /* Sun: Power */
- /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_NOTUSED,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_NOTUSED,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_NOTUSED,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_NOTUSED,
- /* 116 */ KEY_L7, /* Sun: Open */
- /* 117 */ KEY_Help, /* Sun: Help */
- /* 118 */ KEY_L3, /* Sun: Props */
- /* 119 */ KEY_L5, /* Sun: Front */
- /* 120 */ KEY_L1, /* Sun: Stop */
- /* 121 */ KEY_L2, /* Sun: Again */
- /* 122 */ KEY_L4, /* Sun: Undo */
- /* 123 */ KEY_L10, /* Sun: Cut */
- /* 124 */ KEY_L6, /* Sun: Copy */
- /* 125 */ KEY_L8, /* Sun: Paste */
- /* 126 */ KEY_L9, /* Sun: Find */
- /* 127 */ KEY_Mute, /* Sun: AudioMute */
- /* 128 */ KEY_AudioRaise, /* Sun: AudioRaise */
- /* 129 */ KEY_AudioLower, /* Sun: AudioLower */
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_BSlash2, /* Sun Japanese Kbd: Backslash / Underscore */
- /* 136 */ KEY_XFER, /* Sun Japanese Kbd: Henkan Mode */
- /* 137 */ KEY_Yen, /* Sun Japanese Kbd: Yen / Brokenbar */
- /* 138 */ KEY_Kanji, /* Sun Japanese Kbd: Kanji */
- /* 139 */ KEY_Execute, /* Sun Japanese Kbd: Execute */
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
- /* 224 */ KEY_LCtrl, /* Left Control */
- /* 225 */ KEY_ShiftL, /* Left Shift */
- /* 226 */ KEY_Alt, /* Left Alt */
- /* 227 */ KEY_LMeta, /* Left Meta */
- /* 228 */ KEY_RCtrl, /* Right Control */
- /* 229 */ KEY_ShiftR, /* Right Shift */
- /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
- /* 231 */ KEY_RMeta, /* Right Meta */
-};
-
-#endif /* KB_USB */
-
-_X_HIDDEN const unsigned char *
-sunGetKbdMapping(int ktype) {
-#if defined(KB_USB)
- if (ktype == KB_USB)
- return usbmap;
- else
-#endif
- return map;
-}
-
-
-/*
- * sunPostKbdEvent --
- * Translate the raw hardware Firm_event into an XEvent, and tell DIX
- * about it. KeyCode preprocessing and so on is done ...
- *
- * Most of the Solaris stuff has whacked Panix/PC98 support in the
- * interests of simplicity - DWH 8/30/99
- */
-
-_X_HIDDEN void
-sunPostKbdEvent(int sun_ktype, Firm_event *event)
-{
- Bool down;
- KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
- Bool updateLeds = FALSE;
- xEvent kevent;
- KeySym *keysym;
- int keycode;
- static int lockkeys = 0;
-
- /* Give down a value */
- if (event->value == VKEY_DOWN)
- down = TRUE;
- else
- down = FALSE;
-
-
-#if defined(KB_USB)
- if(sun_ktype == KB_USB)
- keycode = usbmap[event->id];
- else
-#endif
- keycode = map[event->id];
-
- /*
- * and now get some special keysequences
- */
-
-#ifdef XKB
- if (((xf86Info.ddxSpecialKeys == SKWhenNeeded) &&
- (!xf86Info.ActionKeyBindingsSet)) ||
- noXkbExtension || (xf86Info.ddxSpecialKeys == SKAlways))
-#endif
- {
- if (!(ModifierDown(ShiftMask)) &&
- ((ModifierDown(ControlMask | AltMask)) ||
- (ModifierDown(ControlMask | AltLangMask))))
- {
- switch (keycode) {
- /*
- * The idea here is to pass the scancode down to a list of
- * registered routines. There should be some standard conventions
- * for processing certain keys.
- */
- case KEY_BackSpace:
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
- break;
-
- /*
- * Check grabs
- */
- case KEY_KP_Divide:
- xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
- break;
- case KEY_KP_Multiply:
- xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
- break;
-
- /*
- * Video mode switches
- */
- case KEY_KP_Minus: /* Keypad - */
- if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- case KEY_KP_Plus: /* Keypad + */
- if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
- }
- }
- }
-
- /*
- * Now map the scancodes to real X-keycodes ...
- */
- if (keycode == KEY_NOTUSED) {
- xf86MsgVerb(X_INFO, 0,
- "raw code %d mapped to KEY_NOTUSED -- please report\n", event->id);
- return;
- }
- if (keycode == KEY_UNKNOWN) {
- xf86MsgVerb(X_INFO, 0,
- "raw code %d mapped to KEY_UNKNOWN -- please report\n", event->id);
- return;
- }
- keycode += MIN_KEYCODE;
- keysym = keyc->curKeySyms.map +
- (keyc->curKeySyms.mapWidth *
- (keycode - keyc->curKeySyms.minKeyCode));
-
-#ifdef XKB
- if (noXkbExtension)
-#endif
- {
- /*
- * Toggle lock keys.
- */
-#define CAPSFLAG 0x01
-#define NUMFLAG 0x02
-#define SCROLLFLAG 0x04
-#define MODEFLAG 0x08
-
- if (down) {
- /*
- * Handle the KeyPresses of the lock keys.
- */
-
- switch (keysym[0]) {
-
- case XK_Caps_Lock:
- if (lockkeys & CAPSFLAG) {
- lockkeys &= ~CAPSFLAG;
- return;
- }
- lockkeys |= CAPSFLAG;
- updateLeds = TRUE;
- xf86Info.capsLock = down;
- break;
-
- case XK_Num_Lock:
- if (lockkeys & NUMFLAG) {
- lockkeys &= ~NUMFLAG;
- return;
- }
- lockkeys |= NUMFLAG;
- updateLeds = TRUE;
- xf86Info.numLock = down;
- break;
-
- case XK_Scroll_Lock:
- if (lockkeys & SCROLLFLAG) {
- lockkeys &= ~SCROLLFLAG;
- return;
- }
- lockkeys |= SCROLLFLAG;
- updateLeds = TRUE;
- xf86Info.scrollLock = down;
- break;
- }
- } else {
- /*
- * Handle the releases of the lock keys.
- */
-
- switch (keysym[0]) {
-
- case XK_Caps_Lock:
- if (lockkeys & CAPSFLAG)
- return;
- updateLeds = TRUE;
- xf86Info.capsLock = down;
- break;
-
- case XK_Num_Lock:
- if (lockkeys & NUMFLAG)
- return;
- updateLeds = TRUE;
- xf86Info.numLock = down;
- break;
-
- case XK_Scroll_Lock:
- if (lockkeys & SCROLLFLAG)
- return;
- updateLeds = TRUE;
- xf86Info.scrollLock = down;
- break;
- }
- }
-
- if (updateLeds)
- xf86KbdLeds();
-
- /*
- * If this keycode is not a modifier key, and its down initiate the
- * autorepeate sequence. (Only necessary if not using XKB).
- *
- * If its not down, then reset the timer.
- */
- if (!keyc->modifierMap[keycode]) {
- if (down) {
- startautorepeat(keycode);
- } else {
- TimerFree(sunTimer);
- sunTimer = NULL;
- }
- }
- }
-
- xf86Info.lastEventTime =
- kevent.u.keyButtonPointer.time =
- GetTimeInMillis();
-
- /*
- * And now send these prefixes ...
- * NOTE: There cannot be multiple Mode_Switch keys !!!!
- */
-
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
-}
-
-
-
-/*
- * Autorepeat stuff
- */
-
-void
-startautorepeat(long keycode)
-{
- sunTimer = TimerSet(sunTimer, /* Timer */
- 0, /* Flags */
- xf86Info.kbdDelay, /* millis */
- processautorepeat, /* callback */
- (pointer) keycode); /* arg for timer */
-}
-
-CARD32
-processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg)
-{
- xEvent kevent;
- int keycode;
-
- keycode = (long)arg;
-
- xf86Info.lastEventTime =
- kevent.u.keyButtonPointer.time =
- GetTimeInMillis();
-
- /*
- * Repeat a key by faking a KeyRelease, and a KeyPress event in rapid
- * succession
- */
-
- ENQUEUE(&kevent, keycode, KeyRelease, XE_KEYBOARD);
- ENQUEUE(&kevent, keycode, KeyPress, XE_KEYBOARD);
-
- /* And return the appropriate value so we get rescheduled */
- return xf86Info.kbdRate;
-}
diff --git a/hw/xfree86/os-support/sysv/Makefile.am b/hw/xfree86/os-support/sysv/Makefile.am
index b67cf99d9..85aa76470 100644
--- a/hw/xfree86/os-support/sysv/Makefile.am
+++ b/hw/xfree86/os-support/sysv/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST = sysv_init.c sysv_io.c sysv_mouse.c sysv_video.c xqueue.c xqueue.h
+EXTRA_DIST = sysv_init.c sysv_io.c sysv_mouse.c sysv_video.c
diff --git a/hw/xfree86/os-support/sysv/sysv_io.c b/hw/xfree86/os-support/sysv/sysv_io.c
deleted file mode 100644
index d6c8ca037..000000000
--- a/hw/xfree86/os-support/sysv/sysv_io.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE 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.
- *
- */
-/* $XConsortium: sysv_io.c /main/8 1996/10/19 18:08:06 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
-#ifdef KDMKTONE
- /*
- * If we have KDMKTONE use it to avoid putting the server
- * to sleep
- */
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
-#else
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(xf86Info.bell_duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
-#endif
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
-#ifdef KBIO_SETMODE
- ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_AT);
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
- ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_XT);
-#endif
-}
-
-#include "xf86OSKbd.h"
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/sysv/sysv_mouse.c b/hw/xfree86/os-support/sysv/sysv_mouse.c
index 581ed58e8..e62010515 100644
--- a/hw/xfree86/os-support/sysv/sysv_mouse.c
+++ b/hw/xfree86/os-support/sysv/sysv_mouse.c
@@ -11,7 +11,6 @@
#include "xf86.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
-#include "xqueue.h"
static int
SupportedInterfaces(void)
@@ -22,7 +21,6 @@ SupportedInterfaces(void)
#ifndef ISC
static const char *internalNames[] = {
- "Xqueue",
NULL
};
@@ -56,7 +54,6 @@ xf86OSMouseInit(int flags)
#ifndef ISC
p->BuiltinNames = BuiltinNames;
p->CheckProtocol = CheckProtocol;
- p->PreInit = XqueueMousePreInit;
#endif
return p;
}
diff --git a/hw/xfree86/os-support/sysv/xqueue.c b/hw/xfree86/os-support/sysv/xqueue.c
deleted file mode 100644
index f0032111f..000000000
--- a/hw/xfree86/os-support/sysv/xqueue.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993-1999 by The XFree86 Project, Inc.
- *
- * 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, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holders make no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE 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.
- *
- */
-/* $XConsortium: xqueue.c /main/8 1996/10/19 18:08:11 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSmouse.h"
-#include "xqueue.h"
-
-#ifdef XQUEUE
-
-static xqEventQueue *XqueQaddr;
-static int xqueFd = -1;
-#ifndef XQUEUE_ASYNC
-static int xquePipe[2];
-#endif
-
-#ifdef XKB
-#include "inputstr.h"
-#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBsrv.h>
-extern Bool noXkbExtension;
-#endif
-
-#include "xf86Xinput.h"
-#include "mipointer.h"
-
-typedef struct {
- int xquePending;
- int xqueSema;
-} XqInfoRec, *XqInfoPtr;
-
-InputInfoPtr XqMouse = NULL;
-InputInfoPtr XqKeyboard = NULL;
-
-#ifndef XQUEUE_ASYNC
-/*
- * xf86XqueSignal --
- * Trap the signal from xqueue and let it be known that events are
- * ready for collection
- */
-
-static void
-xf86XqueSignal(int signum)
-{
- ((XqInfoPtr)(((MouseDevPtr)(XqMouse->private))->mousePriv))->xquePending = 1;
- /*
- * This is a hack, but it is the only reliable way I can find of letting
- * the main select() loop know that there is more input waiting. Receiving
- * a signal will interrupt select(), but there is no way I can find of
- * dealing with events that come in between the end of processing the
- * last set and when select() gets called.
- *
- * Suggestions for better ways of dealing with this without going back to
- * asynchronous event processing are welcome.
- */
-#ifdef DEBUG
- ErrorF("xf86XqueSignal\n");
-#endif
- write(xquePipe[1], "X", 1);
- signal(SIGUSR2, xf86XqueSignal);
-}
-#endif
-
-
-/*
- * xf86XqueKbdProc --
- * Handle the initialization, etc. of a keyboard.
- */
-
-int
-xf86XqueKbdProc(DeviceIntPtr pKeyboard, int what)
-{
- KeySymsRec keySyms;
- CARD8 modMap[MAP_LENGTH];
-
- switch (what) {
-
- case DEVICE_INIT:
-
- xf86KbdGetMapping(&keySyms, modMap);
-
- /*
- * Get also the initial led settings
- */
- ioctl(xf86Info.consoleFd, KDGETLED, &xf86Info.leds);
-
- /*
- * Perform final initialization of the system private keyboard
- * structure and fill in various slots in the device record
- * itself which couldn't be filled in before.
- */
- pKeyboard->public.on = FALSE;
-
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-#ifdef XKB
- } else {
- XkbComponentNamesRec names;
- if (xf86Info.xkbkeymap) {
- names.keymap = xf86Info.xkbkeymap;
- names.keycodes = NULL;
- names.types = NULL;
- names.compat = NULL;
- names.symbols = NULL;
- names.geometry = NULL;
- } else {
- names.keymap = NULL;
- names.keycodes = xf86Info.xkbkeycodes;
- names.types = xf86Info.xkbtypes;
- names.compat = xf86Info.xkbcompat;
- names.symbols = xf86Info.xkbsymbols;
- names.geometry = xf86Info.xkbgeometry;
- }
- if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
- && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
- xf86Info.xkbrules = NULL;
- }
- XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
- xf86Info.xkblayout, xf86Info.xkbvariant,
- xf86Info.xkboptions);
- XkbInitKeyboardDeviceStruct(pKeyboard,
- &names,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
- }
-#endif
-
- xf86InitKBD(TRUE);
- break;
-
- case DEVICE_ON:
- pKeyboard->public.on = TRUE;
- xf86InitKBD(FALSE);
- break;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pKeyboard->public.on = FALSE;
- break;
- }
-
- return (Success);
-}
-
-
-/*
- * xf86XqueEvents --
- * Get some events from our queue. Nothing to do here ...
- */
-
-void
-xf86XqueEvents()
-{
-}
-
-
-#ifdef XQUEUE_ASYNC
-static void XqDoInput(int signum);
-#endif
-
-void
-XqReadInput(InputInfoPtr pInfo)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
- xqEvent *XqueEvents;
- int XqueHead;
- char buf[100];
- signed char dx, dy;
-
- if (xqueFd < 0)
- return;
-
- pMse = pInfo->private;
- pXq = pMse->mousePriv;
-
- XqueEvents = XqueQaddr->xq_events;
- XqueHead = XqueQaddr->xq_head;
-
- while (XqueHead != XqueQaddr->xq_tail) {
- switch (XqueEvents[XqueHead].xq_type) {
- case XQ_BUTTON:
- pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
- 0, 0, 0, 0);
-#ifdef DEBUG
- ErrorF("xqueue: buttons: %d\n", ~(XqueEvents[XqueHead].xq_code) & 0x07);
-#endif
- break;
-
- case XQ_MOTION:
- dx = (signed char)XqueEvents[XqueHead].xq_x;
- dy = (signed char)XqueEvents[XqueHead].xq_y;
- pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
- (int)dx, (int)dy, 0, 0);
-#ifdef DEBUG
- ErrorF("xqueue: Motion: (%d, %d) (buttons: %d)\n", dx, dy, ~(XqueEvents[XqueHead].xq_code) & 0x07);
-#endif
- break;
-
- case XQ_KEY:
- /* XXX Need to deal with the keyboard part nicely. */
-#ifdef DEBUG
- ErrorF("xqueue: key: %d\n", XqueEvents[XqueHead].xq_code);
-#endif
- xf86PostKbdEvent(XqueEvents[XqueHead].xq_code);
- break;
- default:
- xf86Msg(X_WARNING, "Unknown Xque Event: 0x%02x\n",
- XqueEvents[XqueHead].xq_type);
- }
-
- if ((++XqueHead) == XqueQaddr->xq_size) XqueHead = 0;
- xf86Info.inputPending = TRUE;
- }
-
- /* reenable the signal-processing */
-#ifdef XQUEUE_ASYNC
- signal(SIGUSR2, XqDoInput);
-#endif
-
-#ifndef XQUEUE_ASYNC
- {
- int rval;
-
- while ((rval = read(xquePipe[0], buf, sizeof(buf))) > 0)
-#ifdef DEBUG
- ErrorF("Read %d bytes from xquePipe[0]\n", rval);
-#else
- ;
-#endif
- }
-#endif
-
-#ifdef DEBUG
- ErrorF("Leaving XqReadInput()\n");
-#endif
- pXq->xquePending = 0;
- XqueQaddr->xq_head = XqueQaddr->xq_tail;
- XqueQaddr->xq_sigenable = 1; /* UNLOCK */
-}
-
-#ifdef XQUEUE_ASYNC
-static void
-XqDoInput(int signum)
-{
- if (XqMouse)
- XqReadInput(XqMouse);
-}
-#endif
-
-static void
-XqBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- XqInfoPtr pXq;
- /*
- * On MP SVR4 boxes, a race condition exists because the XQUEUE does
- * not have anyway to lock it for exclusive access. This results in one
- * processor putting something on the queue at the same time the other
- * processor is taking it something off. The count of items in the queue
- * can get off by 1. This just goes and checks to see if an extra event
- * was put in the queue a during this period. The signal for this event
- * was ignored while processing the previous event.
- */
-
- pInfo = blockData;
- pMse = pInfo->private;
- pXq = pMse-> mousePriv;
- if (!pXq->xquePending) {
-#ifdef DEBUG
- ErrorF("XqBlock: calling XqReadInput()\n");
-#endif
- XqReadInput((InputInfoPtr)blockData);
- } else {
-#ifdef DEBUG
- ErrorF("XqBlock: not calling XqReadInput()\n");
-#endif
- ;
- }
- /*
- * Make sure that any events that come in here are passed on without.
- * waiting for the next wakeup.
- */
- if (xf86Info.inputPending) {
-#ifdef DEBUG
- ErrorF("XqBlock: calling ProcessInputEvents()\n");
-#endif
- ProcessInputEvents();
- } else {
-#ifdef DEBUG
- ErrorF("XqBlock: not calling ProcessInputEvents()\n");
-#endif
- ;
- }
-}
-
-/*
- * XqEnable --
- * Enable the handling of the Xque
- */
-
-static int
-XqEnable(InputInfoPtr pInfo)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
- static struct kd_quemode xqueMode;
- static Bool was_here = FALSE;
-
- pMse = pInfo->private;
- pXq = pMse->mousePriv;
-
- if (xqueFd < 0) {
- if ((xqueFd = open("/dev/mouse", O_RDONLY | O_NDELAY)) < 0) {
- if (xf86GetAllowMouseOpenFail()) {
- xf86Msg(X_WARNING,
- "%s: Cannot open /dev/mouse (%s) - Continuing...\n",
- pInfo->name, strerror(errno));
- return Success;
- } else {
- xf86Msg(X_ERROR, "%s: Cannot open /dev/mouse (%s)\n",
- pInfo->name, strerror(errno));
- return !Success;
- }
- }
- }
-#ifndef XQUEUE_ASYNC
- if (!was_here) {
- pipe(xquePipe);
- fcntl(xquePipe[0], F_SETFL, fcntl(xquePipe[0], F_GETFL, 0) | O_NDELAY);
- fcntl(xquePipe[1], F_SETFL, fcntl(xquePipe[1], F_GETFL, 0) | O_NDELAY);
- was_here = TRUE;
- }
-#endif
-
- if (pXq->xqueSema++ == 0) {
-#ifdef XQUEUE_ASYNC
- (void) signal(SIGUSR2, XqDoInput);
-#else
- (void) signal(SIGUSR2, xf86XqueSignal);
-#endif
- xqueMode.qsize = 64; /* max events */
- xqueMode.signo = SIGUSR2;
- ioctl(xf86Info.consoleFd, KDQUEMODE, NULL);
-
- if (ioctl(xf86Info.consoleFd, KDQUEMODE, &xqueMode) < 0) {
- xf86Msg(X_ERROR, "%s: Cannot set KDQUEMODE", pInfo->name);
- return !Success;
- }
- XqueQaddr = (xqEventQueue *)xqueMode.qaddr;
- XqueQaddr->xq_sigenable = 1; /* UNLOCK */
- }
-
- return Success;
-}
-
-
-
-/*
- * xf86XqueDisable --
- * disable the handling of the Xque
- */
-
-static int
-XqDisable(InputInfoPtr pInfo)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
-
- pMse = pInfo->private;
- pXq = pMse->mousePriv;
-
- if (pXq->xqueSema-- == 1)
- {
- XqueQaddr->xq_sigenable = 0; /* LOCK */
-
- if (ioctl(xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
- xf86Msg(X_ERROR, "%s: Cannot unset KDQUEMODE", pInfo->name);
- return !Success;
- }
- }
-
- if (xqueFd >= 0) {
- close(xqueFd);
- xqueFd = -1;
- }
-
- return Success;
-}
-
-/*
- * XqMouseProc --
- * Handle the initialization, etc. of a mouse
- */
-
-static int
-XqMouseProc(DeviceIntPtr pPointer, int what)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- unchar map[4];
- int ret;
-
- pInfo = pPointer->public.devicePrivate;
- pMse = pInfo->private;
- pMse->device = pPointer;
-
- switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
-
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- 3,
- miPointerGetMotionEvents,
- pMse->Ctrl,
- miPointerGetMotionBufferSize());
- /* X valuator */
- xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 0);
- /* Y valuator */
- xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 1);
- xf86MotionHistoryAllocate(pInfo);
- RegisterBlockAndWakeupHandlers(XqBlock, (WakeupHandlerProcPtr)NoopDDA,
- pInfo);
- break;
-
- case DEVICE_ON:
- pMse->lastButtons = 0;
- pMse->lastMappedButtons = 0;
- pMse->emulateState = 0;
- pPointer->public.on = TRUE;
- ret = XqEnable(pInfo);
-#ifndef XQUEUE_ASYNC
- if (xquePipe[0] != -1) {
- pInfo->fd = xquePipe[0];
- AddEnabledDevice(xquePipe[0]);
- }
-#endif
- return ret;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- ret = XqDisable(pInfo);
-#ifndef XQUEUE_ASYNC
- if (xquePipe[0] != -1) {
- RemoveEnabledDevice(xquePipe[0]);
- pInfo->fd = -1;
- }
-#endif
- return ret;
- }
- return Success;
-}
-
-Bool
-XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
-
- pMse = pInfo->private;
- pMse->protocol = protocol;
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
- pXq = pMse->mousePriv = xnfcalloc(sizeof(XqInfoRec), 1);
-
- /* Collect the options, and process the common options. */
- xf86CollectInputOptions(pInfo, NULL, NULL);
- xf86ProcessCommonOptions(pInfo, pInfo->options);
-
- /* Process common mouse options (like Emulate3Buttons, etc). */
- pMse->CommonOptions(pInfo);
-
- /* Setup the local procs. */
- pInfo->device_control = XqMouseProc;
-#ifdef XQUEUE_ASYNC
- pInfo->read_input = NULL;
-#else
- pInfo->read_input = XqReadInput;
-#endif
- pInfo->fd = -1;
-
- XqMouse = pInfo;
-
- pInfo->flags |= XI86_CONFIGURED;
- return TRUE;
-}
-
-#endif /* XQUEUE */
diff --git a/hw/xfree86/os-support/sysv/xqueue.h b/hw/xfree86/os-support/sysv/xqueue.h
deleted file mode 100644
index d693d2b36..000000000
--- a/hw/xfree86/os-support/sysv/xqueue.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $XFree86$ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _XF86_XQUEUE_H_
-#define _XF86_XQUEUE_H_
-
-Bool XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags);
-
-#endif
diff --git a/hw/xfree86/os-support/usl/Makefile.am b/hw/xfree86/os-support/usl/Makefile.am
index 5143b243c..db08f5d85 100644
--- a/hw/xfree86/os-support/usl/Makefile.am
+++ b/hw/xfree86/os-support/usl/Makefile.am
@@ -1,12 +1,6 @@
EXTRA_DIST = \
usl_init.c \
- usl_io.c \
usl_iop.c \
- usl_kbd.c \
- usl_kbd.h \
- usl_KbdMap.c \
usl_mouse.c \
usl_video.c \
- usl_vtsw.c \
- usl_xqueue.c \
- usl_xqueue.h
+ usl_vtsw.c
diff --git a/hw/xfree86/os-support/usl/usl_KbdMap.c b/hw/xfree86/os-support/usl/usl_KbdMap.c
deleted file mode 100644
index 76032e61a..000000000
--- a/hw/xfree86/os-support/usl/usl_KbdMap.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $XdotOrg$ */
-/*
- * Copyright 2005 by J. Kean Johnston <jkj@sco.com>
- *
- * 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, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE 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.
- */
-
-/*
- * Based on xf86KbdMap.c, which is
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- */
-
-#include "X.h"
-#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-
-#include "usl_kbd.h"
-
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((priv->keymap.key[i].spcl << (n+1)) & 0x100) + priv->keymap.key[i].map[n]]
-
-/*
- * NOTE: Not all possible remappable symbols are remapped. There are two main
- * reasons:
- * a) The mapping between scancode and SYSV/386 - symboltable
- * is inconsistent between different versions and has some
- * BIG mistakes.
- * b) In X-Windows there is a difference between numpad-keys
- * and normal keys. SYSV/386 uses for both kinds of keys
- * the same symbol.
- *
- * Thus only the alpha keypad and the function keys are translated.
- * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
- */
-
-static unsigned char remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- };
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
- KeySym *k;
- int i;
- KeySym *pMap = map;
-
- for (i = 0; i < priv->keymap.n_keys && i < NUM_KEYCODES; i++) {
- if (remap[i]) {
- k = pMap + (remap[i] << 2);
-
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
-
- switch(*k) {
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
- }
- }
-
- pKeySyms->map = pMap;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
diff --git a/hw/xfree86/os-support/usl/usl_io.c b/hw/xfree86/os-support/usl/usl_io.c
deleted file mode 100644
index 4cb23d40e..000000000
--- a/hw/xfree86/os-support/usl/usl_io.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2001-2005 by Kean Johnston <jkj@sco.com>
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * 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, and that the names of Thomas Roell, David Dawes
- * and Kean Johnston not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Thomas Roell, David Dawes and Kean Johnston make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL, DAVID DAWES AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
- * OR KEAN JOHNSTON BE LIABLE 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.
- *
- */
-/* $XConsortium$ */
-
-#include "X.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(xf86Info.bell_duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
-}
-
-int
-xf86GetKbdLeds(void)
-{
- int leds;
-
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- return(leds);
-}
-
-/*
- * Much of the code in this function is duplicated from the Linux code
- * by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
- * Please see the file ../linux/lnx_io.c for full copyright information.
- */
-void
-xf86SetKbdRepeat(char rad)
-{
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (xf86Info.kbdRate >= 0)
- rate = xf86Info.kbdRate * 10;
- if (xf86Info.kbdDelay >= 0)
- delay = xf86Info.kbdDelay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (xf86Info.consoleFd, KDSETTYPEMATICS, value);
-}
-
-static int orig_kbm;
-static struct termio orig_termio;
-static keymap_t keymap, noledmap;
-
-void
-xf86KbdInit(void)
-{
- ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm);
- ioctl (xf86Info.consoleFd, TCGETA, &orig_termio);
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the scancode API from messing with
- * the keyboard LED's. We restore the original map when we exit.
- */
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- }
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- } else {
- int i, j;
-
- for (i = 0; i < noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECKEY(&noledmap, i, j) &&
- ((noledmap.key[i].map[j] == K_CLK) ||
- (noledmap.key[i].map[j] == K_NLK) ||
- (noledmap.key[i].map[j] == K_SLK))) {
- noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-}
-
-int
-xf86KbdOn(void)
-{
- struct termio newtio;
-
- newtio = orig_termio; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- ioctl(xf86Info.consoleFd, TCSETA, &newtio);
-
- ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
-
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff(void)
-{
- ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
- ioctl(xf86Info.consoleFd, TCSETA, &orig_termio);
-
- return(xf86Info.consoleFd);
-}
diff --git a/hw/xfree86/os-support/usl/usl_kbd.c b/hw/xfree86/os-support/usl/usl_kbd.c
deleted file mode 100644
index d6e6af212..000000000
--- a/hw/xfree86/os-support/usl/usl_kbd.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Copyright 2005 by Kean Johnston <jkj@sco.com>
- *
- * 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, and that the name Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEAN JOHNSTON BE LIABLE 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.
- */
-/* $XConsortium$ */
-
-/*
- * Based on sco_io.c which is
- * (C) Copyright 2003 Kean Johnston <jkj@sco.com>
- *
- * Based on lnx_kbd.c which is
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- *
- * Based on the code from lnx_io.c which is
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#include "X.h"
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "usl_kbd.h"
-#include "usl_xqueue.h"
-
-#include <sys/param.h>
-
-static KbdProtocolRec protocols[] = {
- { "standard", PROT_STD },
- { "Xqueue", PROT_XQUEUE },
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(pInfo->fd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(pInfo->fd, KIOCSOUND, 0);
- }
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- int real_leds = 0;
-
- if (leds & XLED1)
- real_leds |= LED_CAP;
- if (leds & XLED2)
- real_leds |= LED_NUM;
- if (leds & XLED3)
- real_leds |= LED_SCR;
- ioctl(pInfo->fd, KDSETLED, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- int real_leds, leds = 0;
-
- ioctl(pInfo->fd, KDGETLED, &real_leds);
-
- if (real_leds & LED_CAP) leds |= XLED1;
- if (real_leds & LED_NUM) leds |= XLED2;
- if (real_leds & LED_SCR) leds |= XLED3;
-
- return(leds);
-}
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (pKbd->rate >= 0)
- rate = pKbd->rate * 10;
- if (pKbd->delay >= 0)
- delay = pKbd->delay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (pInfo->fd, KDSETTYPEMATICS, value);
-}
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- if (ioctl (pInfo->fd, KDGKBMODE, &priv->orig_kbm) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Could not determine keyboard mode\n");
- return !Success;
- }
-
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the kernel from messing with
- * the keyboard LED's. We restore the original map when we exit.
- * Note that we also have to eliminate screen switch sequences
- * else the VT manager will switch for us, which we don't want.
- * For example, lets say you had changed the VT manager to switch
- * on Alt-Fx instead of Ctrl-Alt-Fx. This means that while inside
- * X, you cant use, for example, Alt-F4, which is a pain in the
- * fundamental when you're using CDE-like thingies.
- */
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->keymap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- }
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->noledmap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- } else {
- int i, j;
-
- for (i = 0; i < priv->noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECKEY(&priv->noledmap, i, j) &&
- ((priv->noledmap.key[i].map[j] == K_CLK) ||
- (priv->noledmap.key[i].map[j] == K_NLK) ||
- (priv->noledmap.key[i].map[j] == K_SLK) ||
- (priv->noledmap.key[i].map[j] == K_FRCNEXT) ||
- (priv->noledmap.key[i].map[j] == K_FRCPREV) ||
- ((priv->noledmap.key[i].map[j] >= K_VTF) &&
- (priv->noledmap.key[i].map[j] <= K_VTL)) )) {
- priv->noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-
- if (ioctl (pInfo->fd, TCGETA, &priv->kbdtty) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get terminal modes (%s)\n",
- strerror(errno));
- return !Success;
- }
- } /* End of if we are on a console */
-
- return Success;
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
- struct termio newtio;
-
- if (pKbd->isConsole) {
- /*
- * Use the calculated keyboard map that does not have active
- * LED lock handling (we track LEDs ourselves).
- */
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->noledmap);
-
-#ifdef NOTYET
- newtio = priv->kbdtty; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- ioctl(pInfo->fd, TCSETA, &newtio);
-
- if (priv->xq == 0)
- ioctl (pInfo->fd, KDSKBMODE, K_RAW);
- else
-#endif
- XqKbdOnOff (pInfo, 1);
- }
-
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- /* Revert back to original translate scancode mode */
-#ifdef NOTYET
- if (priv->xq == 0)
- ioctl (pInfo->fd, KDSKBMODE, priv->orig_kbm);
- else
-#endif
- XqKbdOnOff (pInfo, 0);
-
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->keymap);
- ioctl(pInfo->fd, TCSETA, &priv->kbdtty);
- }
-
- return Success;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static Bool
-SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((!ModifierSet(ShiftMask)) && ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask)))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (down) {
- int sts = key - KEY_F1;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_SWITCH, sts);
- }
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- int sts = key - KEY_F11 + 10;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_SWITCH, sts);
- }
- return TRUE;
- }
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F11 + 10);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if (!(ModifierSet(ShiftMask) || ModifierSet(ControlMask))) {
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- }
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
- return FALSE;
-}
-
-#ifdef NOTYET
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
-
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++) {
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, rBuf[i] & 0x80 ? FALSE : TRUE);
- }
- }
-}
-#endif
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
-#ifdef NOTYET
- pInfo->read_input = stdReadInput;
- priv->xq = 0;
- break;
-#endif
- case PROT_XQUEUE:
- pInfo->read_input = NULL; /* Handled by the XQUEUE signal handler */
- priv->xq = 1;
- break;
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
-
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- xfree(s);
- }
-
- if (pKbd->isConsole)
- pKbd->vtSwitchSupported = TRUE;
-
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
- pKbd->OpenKeyboard = OpenKeyboard;
-
- pKbd->GetSpecialKey = NULL;
- pKbd->RemapScanCode = ATScancode;
- pKbd->vtSwitchSupported = FALSE;
-
- pKbd->private = xcalloc(sizeof(USLKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/usl/usl_kbd.h b/hw/xfree86/os-support/usl/usl_kbd.h
deleted file mode 100644
index 990c13cc7..000000000
--- a/hw/xfree86/os-support/usl/usl_kbd.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $XdotOrg$ */
-#ifndef SCO_KBD_HDR
-#define SCO_KBD_HDR
-
-typedef struct {
- int orig_kbm;
- struct termio kbdtty;
- keymap_t keymap, noledmap;
- int xq;
-} USLKbdPrivRec, *USLKbdPrivPtr;
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-#endif /* SCO_KBD_HDR */
diff --git a/hw/xfree86/os-support/usl/usl_mouse.c b/hw/xfree86/os-support/usl/usl_mouse.c
index 15a0ac5ac..aa4600f79 100644
--- a/hw/xfree86/os-support/usl/usl_mouse.c
+++ b/hw/xfree86/os-support/usl/usl_mouse.c
@@ -33,7 +33,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "mipointer.h"
-#include "usl_xqueue.h"
static int
SupportedInterfaces(void)
@@ -42,7 +41,6 @@ SupportedInterfaces(void)
}
static const char *internalNames[] = {
- "Xqueue",
NULL
};
@@ -55,7 +53,7 @@ BuiltinNames(void)
static const char *
DefaultProtocol (void)
{
- return "Xqueue";
+ return "OSMouse";
}
static Bool
@@ -121,7 +119,6 @@ OsMouseProc(DeviceIntPtr pPointer, int what)
static Bool
OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
{
- /* This is called when the protocol is "Xqueue" */
MouseDevPtr pMse;
pMse = pInfo->private;
@@ -155,7 +152,7 @@ OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
/* Setup the local procs. */
pInfo->device_control = OsMouseProc;
- pInfo->read_input = NULL; /* Handled by the XQUEUE signal handler */
+ pInfo->read_input = NULL;
pInfo->flags |= XI86_CONFIGURED;
return TRUE;
diff --git a/hw/xfree86/os-support/usl/usl_xqueue.c b/hw/xfree86/os-support/usl/usl_xqueue.c
deleted file mode 100644
index c00d37489..000000000
--- a/hw/xfree86/os-support/usl/usl_xqueue.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* $XdotOrg$ */
-/*
- * Copyright 2005 by Kean Johnston <jkj@sco.com>
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993-1999 by The XFree86 Project, Inc.
- *
- * 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, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holders make no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE 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.
- *
- */
-/* $XConsortium$ */
-
-#include "X.h"
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSmouse.h"
-#include "xf86OSKbd.h"
-#include "usl_xqueue.h"
-
-#ifdef XKB
-#include "inputstr.h"
-#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBsrv.h>
-extern Bool noXkbExtension;
-#endif
-
-#include "xf86Xinput.h"
-#include "mipointer.h"
-
-#if !defined(XQ_WHEEL)
-# define XQ_WHEEL 4
-#endif
-
-/*
- * Implementation notes
- *
- * This code is based on a mixture of the original XFree86 sysv/xqueue.c
- * and information gathered from the SCO X server code (no actual code
- * was used, just the principles).
- *
- * The XFree86 XQUEUE code went to some considerable lengths to implement
- * what it calls "asynchronous XQUEUE". This involved creating a pipe,
- * and writing to that pipe each time an XQUEUE signal is received. The
- * one end of that pipe was then added to the list of selectable file
- * descriptors with AddEnabledDevice(). I completely fail to see the need
- * for this, and this code does not implement that mechanism. The server
- * will be interrupted anyway by the XQUEUE driver, so whether we pull the
- * events off the queue at the time we receive the signal or whether we
- * write to a pipe and then have the main select() loop stop and call us,
- * it makes no difference I can fathom.
- *
- * The code also differs from the original XFree86 code in that it maintains
- * local variables for the number of devices initialized. The original code
- * stored that information in the private data pointer of the mouse structure,
- * but this same code is used for both the keyboard and the mouse, so that
- * was changed.
- *
- * Part of the difficulty in dealing with XQUEUE is that it is a single
- * interface to two devices. The recent changes in XFree86/Xorg try to
- * treat the mouse and keyboard as discrete devices, and the code is
- * structured in such a way that they should be able to be independently
- * opened and closed. But we can't do that with XQUEUE, so we have to
- * centralize XQUEUE access here in this module.
- */
-
-static xqEventQueue *xqQaddr = NULL;
-static int xqSigEnable = 1;
-static int xqEnableCount = 0;
-static struct kd_quemode xqMode;
-
-/*
- * These two pointers are set when the keyboard/mouse handler procs
- * are called to turn them on or off. This is so that we can call the
- * correct PostEvent for the device.
- */
-static InputInfoPtr xqMouse = NULL;
-static InputInfoPtr xqKeyboard = NULL;
-
-static void XqSignalHandler (int signo);
-
-/*
- * Private functions
- */
-static void
-XqReset (void)
-{
- if (xqEnableCount > 0) {
- xqQaddr->xq_head = xqQaddr->xq_tail;
- xqQaddr->xq_sigenable = xqSigEnable;
- }
-}
-
-#ifdef NOTNEEDED
-static void
-XqLock (void)
-{
- xqSigEnable = 0;
- if (xqEnableCount > 0) {
- xqQaddr->xq_sigenable = xqSigEnable;
- }
-}
-
-static void
-XqUnlock (void)
-{
- xqSigEnable = 1;
- if (xqEnableCount > 0) {
- xqQaddr->xq_sigenable = xqSigEnable;
- }
-}
-#endif /* NOTNEEDED */
-
-/*
- * Since this code is shared between two devices, we need to keep track
- * of how many times we've been enabled or disabled. For example, if the
- * keyboard has been turned off, but the mouse hasn't, then we do not
- * want the whole queue off. Only when both devices are turned off do we
- * actually disable Xqueue mode. When either device is turned on, we
- * enable it.
- */
-static int
-XqEnable (InputInfoPtr pInfo)
-{
- struct sigaction xqsig;
- static int msefd = -1;
-
- if (msefd == -1) {
- msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK);
-#if 0
- msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK | O_NOCTTY);
- if (msefd < 0) {
- /*
- * Try giving it a controlling tty
- */
- msefd = open (ttyname(xf86Info.consoleFd), O_RDWR | O_NONBLOCK);
- if (msefd >= 0)
- close (msefd);
- msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK | O_NOCTTY);
- if (msefd < 0)
- sleep(2);
- }
-#endif
- }
-
- if (msefd < 0) {
- if (xf86GetAllowMouseOpenFail()) {
- ErrorF("%s: cannot open /dev/mouse (%s)\n",
- ttyname(xf86Info.consoleFd), strerror(errno));
- } else {
- sleep(5);
- FatalError ("%s: cannot open /dev/mouse (%s)\n",
- ttyname(xf86Info.consoleFd), strerror(errno));
- }
- }
-
- if (xqEnableCount++ == 0) {
- xqMode.qaddr = 0;
- ioctl (xf86Info.consoleFd, KDQUEMODE, NULL);
-
- /*
- * Note: We need to make sure the signal is armed before we enable
- * XQUEUE mode, so that if we get events immediately after the ioctl
- * we dont have an unhandled signal coming to the Xserver.
- * Also note that we use sigaction, so that we do not have to re-arm
- * the signal every time it is delivered, which just slows things
- * down (setting a signal is a fairly expensive operation).
- */
-
- xqsig.sa_handler = XqSignalHandler;
- sigfillset (&xqsig.sa_mask);
- xqsig.sa_flags = 0;
- sigaction (SIGUSR2, &xqsig, NULL);
-
- /*
- * This is a fairly large queue size. Since we are reacting to events
- * asynchronously, its best for performance if we deal with as many
- * events as possible, and high resolution mice generate a lot of
- * events.
- */
- xqMode.qsize = 64;
- xqMode.signo = SIGUSR2;
- xqMode.qaddr = 0;
- if (ioctl (xf86Info.consoleFd, KDQUEMODE, &xqMode) < 0) {
- xf86Msg (X_ERROR, "%s: could not set XQUEUE mode (%s)", pInfo->name,
- strerror(errno));
- xqEnableCount--;
-
- xqsig.sa_handler = SIG_DFL;
- sigfillset (&xqsig.sa_mask);
- xqsig.sa_flags = 0;
- sigaction (SIGUSR2, &xqsig, NULL);
-
- return !Success;
- }
-
- /*
- * We're in business. The workstation is now in XQUEUE mode.
- */
- xqQaddr = (xqEventQueue *)xqMode.qaddr;
- xqQaddr->xq_sigenable = 0; /* LOCK */
- nap(500);
- XqReset();
- }
- return Success;
-}
-
-static int
-XqDisable (InputInfoPtr pInfo)
-{
- struct sigaction xqsig;
-
- if (xqEnableCount-- == 1) {
- xqQaddr->xq_sigenable = 0; /* LOCK */
-
- if (ioctl (xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
- xf86Msg (X_ERROR, "%s: could not unset XQUEUE mode (%s)", pInfo->name,
- strerror(errno));
- xqEnableCount++;
- return !Success;
- }
-
- xqsig.sa_handler = SIG_DFL;
- sigfillset (&xqsig.sa_mask);
- xqsig.sa_flags = 0;
- sigaction (SIGUSR2, &xqsig, NULL);
- }
-
- return Success;
-}
-
-/*
- * XQUEUE signal handler. This is what goes through the list of events
- * we've already received and dispatches them to either the keyboard or
- * mouse event poster.
- */
-static void
-XqSignalHandler (int signo)
-{
- xqEvent *xqEvents = xqQaddr->xq_events;
- int xqHead = xqQaddr->xq_head;
- xEvent xE;
- MouseDevPtr pMse = NULL;
- KbdDevPtr pKbd = NULL;
- signed char dx, dy;
-
- if (xqMouse)
- pMse = (MouseDevPtr)xqMouse->private;
- if (xqKeyboard)
- pKbd = (KbdDevPtr)xqKeyboard->private;
-
- while (xqHead != xqQaddr->xq_tail) {
-
- switch (xqEvents[xqHead].xq_type) {
- case XQ_MOTION:
- dx = (signed char)xqEvents[xqHead].xq_x;
- dy = (signed char)xqEvents[xqHead].xq_y;
- if (pMse)
- pMse->PostEvent(xqMouse, ~(xqEvents[xqHead].xq_code) & 0x07,
- (int)dx, (int)dy, 0, 0);
- break;
-
- case XQ_BUTTON:
- if (pMse)
- pMse->PostEvent(xqMouse, ~(xqEvents[xqHead].xq_code) & 0x07,
- 0, 0, 0, 0);
- break;
-
- case XQ_WHEEL:
- if (pMse) {
- int wbut = pMse->lastButtons, dz;
- if (xqEvents[xqHead].xq_code == 1)
- dz = 1;
- else
- dz = -1;
- pMse->PostEvent(xqMouse, wbut, 0, 0, dz, 0);
- }
- break;
-
- case XQ_KEY:
- if (pKbd)
- pKbd->PostEvent(xqKeyboard, xqEvents[xqHead].xq_code & 0x7f,
- xqEvents[xqHead].xq_code & 0x80 ? FALSE : TRUE);
- break;
-
- default:
- xf86Msg(X_WARNING, "XQUEUE: unknown event type %d\n",
- xqEvents[xqHead].xq_type);
- break;
- }
-
- xqHead++;
- if (xqHead == xqQaddr->xq_size)
- xqHead = 0;
- xf86Info.inputPending = TRUE;
- }
-
- XqReset();
-}
-
-/*
- * Public functions
- */
-int
-XqMseOnOff (InputInfoPtr pInfo, int on)
-{
- if (on) {
- if (xqMouse) {
- if (xqMouse != pInfo)
- xf86Msg(X_WARNING, "XqMseOnOff: mouse pointer structure changed!\n");
- xqMouse = pInfo;
- } else {
- xqMouse = pInfo;
- return XqEnable(pInfo);
- }
- } else {
- xqMouse = NULL;
- return XqDisable(pInfo);
- }
- return Success;
-}
-
-int
-XqKbdOnOff (InputInfoPtr pInfo, int on)
-{
- if (on) {
- if (xqKeyboard) {
- if (xqKeyboard != pInfo)
- xf86Msg(X_WARNING, "XqKbdOnOff: keyboard pointer structure changed!\n");
- xqKeyboard = pInfo;
- } else {
- xqKeyboard = pInfo;
- return XqEnable(pInfo);
- }
- } else {
- xqKeyboard = NULL;
- return XqDisable(pInfo);
- }
- return Success;
-}
-
diff --git a/hw/xfree86/os-support/usl/usl_xqueue.h b/hw/xfree86/os-support/usl/usl_xqueue.h
deleted file mode 100644
index bad86a907..000000000
--- a/hw/xfree86/os-support/usl/usl_xqueue.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $XdotOrg$ */
-
-#ifndef _XF86_USL_XQUEUE_H_
-#define _XF86_USL_XQUEUE_H_
-
-extern int XqMseOnOff (InputInfoPtr pInfo, int on);
-extern int XqKbdOnOff (InputInfoPtr pInfo, int on);
-
-#endif
diff --git a/hw/xfree86/os-support/xf86OSKbd.h b/hw/xfree86/os-support/xf86OSKbd.h
deleted file mode 100644
index 4ab722ca3..000000000
--- a/hw/xfree86/os-support/xf86OSKbd.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- *
- * Author: Ivan Pascal.
- */
-
-#include "xf86Xinput.h"
-
-Bool ATScancode(InputInfoPtr pInfo, int *scanCode);
-
-/* Public interface to OS-specific keyboard support. */
-
-typedef int (*KbdInitProc)(InputInfoPtr pInfo, int what);
-typedef int (*KbdOnProc)(InputInfoPtr pInfo, int what);
-typedef int (*KbdOffProc)(InputInfoPtr pInfo, int what);
-typedef void (*BellProc)(InputInfoPtr pInfo,
- int loudness, int pitch, int duration);
-typedef void (*SetLedsProc)(InputInfoPtr pInfo, int leds);
-typedef int (*GetLedsProc)(InputInfoPtr pInfo);
-typedef void (*SetKbdRepeatProc)(InputInfoPtr pInfo, char rad);
-typedef void (*KbdGetMappingProc)(InputInfoPtr pInfo,
- KeySymsPtr pKeySyms, CARD8* pModMap);
-typedef int (*GetSpecialKeyProc)(InputInfoPtr pInfo, int scanCode);
-typedef Bool (*SpecialKeyProc)(InputInfoPtr pInfo,
- int key, Bool down, int modifiers);
-typedef int (*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode);
-typedef Bool (*OpenKeyboardProc)(InputInfoPtr pInfo);
-typedef void (*PostEventProc)(InputInfoPtr pInfo,
- unsigned int key, Bool down);
-typedef struct {
- int begin;
- int end;
- unsigned char *map;
-} TransMapRec, *TransMapPtr;
-
-typedef struct {
- KbdInitProc KbdInit;
- KbdOnProc KbdOn;
- KbdOffProc KbdOff;
- BellProc Bell;
- SetLedsProc SetLeds;
- GetLedsProc GetLeds;
- SetKbdRepeatProc SetKbdRepeat;
- KbdGetMappingProc KbdGetMapping;
- RemapScanCodeProc RemapScanCode;
- GetSpecialKeyProc GetSpecialKey;
- SpecialKeyProc SpecialKey;
-
- OpenKeyboardProc OpenKeyboard;
- PostEventProc PostEvent;
-
- int rate;
- int delay;
- int bell_pitch;
- int bell_duration;
- Bool autoRepeat;
- unsigned long leds;
- unsigned long xledsMask;
- unsigned long keyLeds;
- int scanPrefix;
- Bool vtSwitchSupported;
- Bool CustomKeycodes;
- Bool noXkb;
- Bool isConsole;
- TransMapPtr scancodeMap;
- TransMapPtr specialMap;
-
- /* os specific */
- pointer private;
- int kbdType;
- int consType;
- int wsKbdType;
- Bool sunKbd;
- Bool Panix106;
-
-} KbdDevRec, *KbdDevPtr;
-
-typedef enum {
- PROT_STD,
- PROT_XQUEUE,
- PROT_WSCONS,
- PROT_USB,
- PROT_UNKNOWN_KBD
-} KbdProtocolId;
-
-typedef struct {
- const char *name;
- KbdProtocolId id;
-} KbdProtocolRec;
-
-Bool xf86OSKbdPreInit(InputInfoPtr pInfo);
-
-/* Adjust this when the kbd interface changes. */
-
-/*
- * History:
- *
- * 1.0.0 - Initial version.
- */
-
-#define OS_KBD_VERSION_MAJOR 1
-#define OS_KBD_VERSION_MINOR 0
-#define OS_KBD_VERSION_PATCH 0
-
-#define OS_KBD_VERSION_CURRENT \
- BUILTIN_INTERFACE_VERSION_NUMERIC(OS_KBD_VERSION_MAJOR, \
- OS_KBD_VERSION_MINOR, \
- OS_KBD_VERSION_PATCH)
-
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index e04854729..97f872301 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -235,15 +235,6 @@ typedef signed long xf86ssize_t;
# define i386 /* not defined in ANSI C mode */
# endif /* ATT && !i386 */
-# if (defined(ATT) || defined(SVR4)) && !defined(sun)
-# ifndef __UNIXWARE__
-# ifndef XQUEUE
-# define XQUEUE
-# endif
-# endif
-# include <sys/xque.h>
-# endif /* ATT || SVR4 */
-
# ifdef SYSV
# if !defined(ISC) || defined(ISC202) || defined(ISC22)
# define NEED_STRERROR
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index 89a33013f..0311b8193 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -135,10 +135,6 @@ extern void xf86WrapperInit(void);
#include <X11/Xfuncproto.h>
#include "opaque.h"
-#if defined(XQUEUE)
-#include "input.h" /* for DeviceIntPtr */
-#endif
-
_XFUNCPROTOBEGIN
/* public functions */
@@ -178,6 +174,7 @@ extern int xf86GetSerialModemState(int fd);
extern int xf86SerialModemSetBits(int fd, int bits);
extern int xf86SerialModemClearBits(int fd, int bits);
extern int xf86LoadKernelModule(const char *pathname);
+extern void xf86RingBell(int volume, int pitch, int duration);
/* AGP GART interface */
@@ -224,21 +221,7 @@ extern Bool xf86VTSwitchTo(void);
extern void xf86VTRequest(int sig);
extern int xf86ProcessArgument(int, char **, int);
extern void xf86UseMsg(void);
-extern void xf86SetKbdLeds(int);
-extern int xf86GetKbdLeds(void);
-extern void xf86SetKbdRepeat(char);
-extern void xf86KbdInit(void);
-extern int xf86KbdOn(void);
-extern int xf86KbdOff(void);
-extern void xf86KbdEvents(void);
-#ifdef XQUEUE
-extern int xf86XqueKbdProc(DeviceIntPtr, int);
-extern void xf86XqueEvents(void);
-#endif
extern void xf86ReloadInputDevs(int sig);
-#ifdef WSCONS_SUPPORT
-extern void xf86WSKbdEvents(void);
-#endif
extern PMClose xf86OSPMOpen(void);
#ifdef NEED_OS_RAC_PROTOS
diff --git a/hw/xfree86/os-support/xf86drm.h b/hw/xfree86/os-support/xf86drm.h
index 107670672..18e4564d1 100644
--- a/hw/xfree86/os-support/xf86drm.h
+++ b/hw/xfree86/os-support/xf86drm.h
@@ -36,6 +36,7 @@
#define _XF86DRM_H_
#include <drm.h>
+#include <xf86mm.h>
/* Defaults, if nothing set in xf86config */
#define DRM_DEV_UID 0
diff --git a/hw/xfree86/os-support/xf86mm.h b/hw/xfree86/os-support/xf86mm.h
new file mode 100644
index 000000000..e1a4e3ed9
--- /dev/null
+++ b/hw/xfree86/os-support/xf86mm.h
@@ -0,0 +1,210 @@
+/**************************************************************************
+ *
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA.
+ * 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, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+
+#ifndef _XF86MM_H_
+#define _XF86MM_H_
+#include <stddef.h>
+#include "drm.h"
+
+/*
+ * Note on multithreaded applications using this interface.
+ * Libdrm is not threadsafe, so common buffer, TTM, and fence objects need to
+ * be protected using an external mutex.
+ *
+ * Note: Don't protect the following functions, as it may lead to deadlocks:
+ * drmBOUnmap(), drmFenceBuffers().
+ * The kernel is synchronizing and refcounting buffer maps.
+ * User space only needs to refcount object usage within the same application.
+ */
+
+
+/*
+ * List macros heavily inspired by the Linux kernel
+ * list handling. No list looping yet.
+ */
+
+typedef struct _drmMMListHead
+{
+ struct _drmMMListHead *prev;
+ struct _drmMMListHead *next;
+} drmMMListHead;
+
+#define DRMINITLISTHEAD(__item) \
+ do{ \
+ (__item)->prev = (__item); \
+ (__item)->next = (__item); \
+ } while (0)
+
+#define DRMLISTADD(__item, __list) \
+ do { \
+ (__item)->prev = (__list); \
+ (__item)->next = (__list)->next; \
+ (__list)->next->prev = (__item); \
+ (__list)->next = (__item); \
+ } while (0)
+
+#define DRMLISTADDTAIL(__item, __list) \
+ do { \
+ (__item)->next = (__list); \
+ (__item)->prev = (__list)->prev; \
+ (__list)->prev->next = (__item); \
+ (__list)->prev = (__item); \
+ } while(0)
+
+#define DRMLISTDEL(__item) \
+ do { \
+ (__item)->prev->next = (__item)->next; \
+ (__item)->next->prev = (__item)->prev; \
+ } while(0)
+
+#define DRMLISTDELINIT(__item) \
+ do { \
+ (__item)->prev->next = (__item)->next; \
+ (__item)->next->prev = (__item)->prev; \
+ (__item)->next = (__item); \
+ (__item)->prev = (__item); \
+ } while(0)
+
+#define DRMLISTENTRY(__type, __item, __field) \
+ ((__type *)(((char *) (__item)) - offsetof(__type, __field)))
+
+typedef struct _drmFence{
+ unsigned handle;
+ int class;
+ unsigned type;
+ unsigned flags;
+ unsigned signaled;
+ unsigned pad[4]; /* for future expansion */
+} drmFence;
+
+typedef struct _drmBO{
+ drm_bo_type_t type;
+ unsigned handle;
+ drm_u64_t mapHandle;
+ unsigned flags;
+ unsigned mask;
+ unsigned mapFlags;
+ unsigned long size;
+ unsigned long offset;
+ unsigned long start;
+ unsigned replyFlags;
+ unsigned fenceFlags;
+ unsigned pageAlignment;
+ void *virtual;
+ void *mapVirtual;
+ int mapCount;
+ unsigned pad[8]; /* for future expansion */
+} drmBO;
+
+
+typedef struct _drmBONode {
+ drmMMListHead head;
+ drmBO *buf;
+ drm_bo_arg_t bo_arg;
+ unsigned long arg0;
+ unsigned long arg1;
+} drmBONode;
+
+typedef struct _drmBOList {
+ unsigned numTarget;
+ unsigned numCurrent;
+ unsigned numOnList;
+ drmMMListHead list;
+ drmMMListHead free;
+} drmBOList;
+
+/* Fencing */
+
+extern int drmFenceCreate(int fd, unsigned flags, int class,
+ unsigned type,
+ drmFence *fence);
+extern int drmFenceDestroy(int fd, const drmFence *fence);
+extern int drmFenceReference(int fd, unsigned handle, drmFence *fence);
+extern int drmFenceUnreference(int fd, const drmFence *fence);
+extern int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type);
+extern int drmFenceSignaled(int fd, drmFence *fence,
+ unsigned fenceType, int *signaled);
+extern int drmFenceWait(int fd, unsigned flags, drmFence *fence,
+ unsigned flush_type);
+extern int drmFenceEmit(int fd, unsigned flags, drmFence *fence,
+ unsigned emit_type);
+extern int drmFenceBuffers(int fd, unsigned flags, drmFence *fence);
+extern int drmFenceUpdate(int fd, drmFence *fence);
+
+
+/*
+ * Buffer object list functions.
+ */
+
+extern void drmBOFreeList(drmBOList *list);
+extern int drmBOResetList(drmBOList *list);
+extern void *drmBOListIterator(drmBOList *list);
+extern void *drmBOListNext(drmBOList *list, void *iterator);
+extern drmBO *drmBOListBuf(void *iterator);
+extern int drmBOCreateList(int numTarget, drmBOList *list);
+
+/*
+ * Buffer object functions.
+ */
+
+extern int drmBOCreate(int fd, unsigned long start, unsigned long size,
+ unsigned pageAlignment,void *user_buffer,
+ drm_bo_type_t type, unsigned mask,
+ unsigned hint, drmBO *buf);
+extern int drmBODestroy(int fd, drmBO *buf);
+extern int drmBOReference(int fd, unsigned handle, drmBO *buf);
+extern int drmBOUnReference(int fd, drmBO *buf);
+extern int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
+ void **address);
+extern int drmBOUnmap(int fd, drmBO *buf);
+extern int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask,
+ unsigned hint);
+extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle);
+extern int drmBOInfo(int fd, drmBO *buf);
+extern int drmBOBusy(int fd, drmBO *buf, int *busy);
+
+
+extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags,
+ unsigned mask,
+ int *newItem);
+extern int drmBOValidateList(int fd, drmBOList *list);
+extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle);
+extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint);
+
+/*
+ * Initialization functions.
+ */
+
+extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize,
+ unsigned memType);
+extern int drmMMTakedown(int fd, unsigned memType);
+extern int drmMMLock(int fd, unsigned memType);
+extern int drmMMUnlock(int fd, unsigned memType);
+
+
+#endif
diff --git a/hw/xfree86/parser/Input.c b/hw/xfree86/parser/Input.c
index 3e2186a9d..3d9801968 100644
--- a/hw/xfree86/parser/Input.c
+++ b/hw/xfree86/parser/Input.c
@@ -102,7 +102,10 @@ xf86parseInputSection (void)
case DRIVER:
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
Error (QUOTE_MSG, "Driver");
- ptr->inp_driver = val.str;
+ if (strcmp(val.str, "keyboard") == 0)
+ ptr->inp_driver = "kbd";
+ else
+ ptr->inp_driver = val.str;
break;
case OPTION:
ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
diff --git a/hw/xfree86/parser/Keyboard.c b/hw/xfree86/parser/Keyboard.c
deleted file mode 100644
index 9749a1a21..000000000
--- a/hw/xfree86/parser/Keyboard.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 X CONSORTIUM 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 Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * 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, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
- * and author(s) 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 copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-#include "ctype.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec KeyboardTab[] =
-{
- {ENDSECTION, "endsection"},
- {KPROTOCOL, "protocol"},
- {AUTOREPEAT, "autorepeat"},
- {XLEDS, "xleds"},
- {PANIX106, "panix106"},
- {XKBKEYMAP, "xkbkeymap"},
- {XKBCOMPAT, "xkbcompat"},
- {XKBTYPES, "xkbtypes"},
- {XKBKEYCODES, "xkbkeycodes"},
- {XKBGEOMETRY, "xkbgeometry"},
- {XKBSYMBOLS, "xkbsymbols"},
- {XKBDISABLE, "xkbdisable"},
- {XKBRULES, "xkbrules"},
- {XKBMODEL, "xkbmodel"},
- {XKBLAYOUT, "xkblayout"},
- {XKBVARIANT, "xkbvariant"},
- {XKBOPTIONS, "xkboptions"},
- /* The next two have become ServerFlags options */
- {VTINIT, "vtinit"},
- {VTSYSREQ, "vtsysreq"},
- /* Obsolete keywords */
- {SERVERNUM, "servernumlock"},
- {LEFTALT, "leftalt"},
- {RIGHTALT, "rightalt"},
- {RIGHTALT, "altgr"},
- {SCROLLLOCK_TOK, "scrolllock"},
- {RIGHTCTL, "rightctl"},
- {-1, ""},
-};
-
-/* Obsolete */
-static xf86ConfigSymTabRec KeyMapTab[] =
-{
- {CONF_KM_META, "meta"},
- {CONF_KM_COMPOSE, "compose"},
- {CONF_KM_MODESHIFT, "modeshift"},
- {CONF_KM_MODELOCK, "modelock"},
- {CONF_KM_SCROLLLOCK, "scrolllock"},
- {CONF_KM_CONTROL, "control"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputList
-
-XF86ConfInputPtr
-xf86parseKeyboardSection (void)
-{
- char *s, *s1, *s2;
- int l;
- int token, ntoken;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- while ((token = xf86getToken (KeyboardTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case KPROTOCOL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Protocol");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("Protocol"),
- val.str);
- break;
- case AUTOREPEAT:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
- Error (AUTOREPEAT_MSG, NULL);
- s1 = xf86uLongToString(val.num);
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) {
- xf86conffree(s1);
- Error (AUTOREPEAT_MSG, NULL);
- }
- s2 = xf86uLongToString(val.num);
- l = strlen(s1) + 1 + strlen(s2) + 1;
- s = xf86confmalloc(l);
- sprintf(s, "%s %s", s1, s2);
- xf86conffree(s1);
- xf86conffree(s2);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("AutoRepeat"), s);
- break;
- case XLEDS:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
- Error (XLEDS_MSG, NULL);
- s = xf86uLongToString(val.num);
- l = strlen(s) + 1;
- while ((token = xf86getSubToken (&(ptr->inp_comment))) == NUMBER)
- {
- s1 = xf86uLongToString(val.num);
- l += (1 + strlen(s1));
- s = xf86confrealloc(s, l);
- strcat(s, " ");
- strcat(s, s1);
- xf86conffree(s1);
- }
- xf86unGetToken (token);
- xf86conffree(s);
- break;
- case SERVERNUM:
- xf86parseWarning(OBSOLETE_MSG, xf86tokenString());
- break;
- case LEFTALT:
- case RIGHTALT:
- case SCROLLLOCK_TOK:
- case RIGHTCTL:
- xf86parseWarning(OBSOLETE_MSG, xf86tokenString());
- break;
- ntoken = xf86getToken (KeyMapTab);
- switch (ntoken)
- {
- case EOF_TOKEN:
- xf86parseError (UNEXPECTED_EOF_MSG);
- CLEANUP (ptr);
- return (NULL);
- break;
-
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- break;
- case VTINIT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "VTInit");
- xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTInit");
- break;
- case VTSYSREQ:
- xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTSysReq");
- break;
- case XKBDISABLE:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbDisable"),
- NULL);
- break;
- case XKBKEYMAP:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBKeymap");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbKeymap"),
- val.str);
- break;
- case XKBCOMPAT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBCompat");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbCompat"),
- val.str);
- break;
- case XKBTYPES:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBTypes");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbTypes"),
- val.str);
- break;
- case XKBKEYCODES:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBKeycodes");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbKeycodes"),
- val.str);
- break;
- case XKBGEOMETRY:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBGeometry");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbGeometry"),
- val.str);
- break;
- case XKBSYMBOLS:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBSymbols");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbSymbols"),
- val.str);
- break;
- case XKBRULES:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBRules");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbRules"),
- val.str);
- break;
- case XKBMODEL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBModel");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbModel"),
- val.str);
- break;
- case XKBLAYOUT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBLayout");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbLayout"),
- val.str);
- break;
- case XKBVARIANT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBVariant");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbVariant"),
- val.str);
- break;
- case XKBOPTIONS:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBOptions");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbOptions"),
- val.str);
- break;
- case PANIX106:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("Panix106"), NULL);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_KEYBOARD);
- ptr->inp_driver = xf86configStrdup("keyboard");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("CoreKeyboard"), NULL);
-
-#ifdef DEBUG
- printf ("Keyboard section parsed\n");
-#endif
-
- return ptr;
-}
-
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 46ef79060..abe9a5a4a 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -12,7 +12,6 @@ libxf86config_a_SOURCES = \
Files.c \
Flags.c \
Input.c \
- Keyboard.c \
Layout.c \
Module.c \
Video.c \
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 832437cd2..0b989054b 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -45,8 +45,6 @@ XF86ConfInputPtr xf86parseInputSection(void);
void xf86printInputSection(FILE *f, XF86ConfInputPtr ptr);
void xf86freeInputList(XF86ConfInputPtr ptr);
int xf86validateInput (XF86ConfigPtr p);
-/* Keyboard.c */
-XF86ConfInputPtr xf86parseKeyboardSection(void);
/* Layout.c */
XF86ConfLayoutPtr xf86parseLayoutSection(void);
void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr);
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
index 598a12666..b6b3bc377 100644
--- a/hw/xfree86/parser/read.c
+++ b/hw/xfree86/parser/read.c
@@ -112,13 +112,6 @@ xf86readConfigFile (void)
val.str = NULL;
HANDLE_RETURN (conf_flags, xf86parseFlagsSection ());
}
- else if (xf86nameCompare (val.str, "keyboard") == 0)
- {
- xf86conffree(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_input_lst, xf86parseKeyboardSection,
- XF86ConfInputPtr);
- }
else if (xf86nameCompare (val.str, "pointer") == 0)
{
xf86conffree(val.str);
diff --git a/hw/xfree86/utils/xorgcfg/interface.c b/hw/xfree86/utils/xorgcfg/interface.c
index b98d6ce73..9b22dc7cb 100644
--- a/hw/xfree86/utils/xorgcfg/interface.c
+++ b/hw/xfree86/utils/xorgcfg/interface.c
@@ -66,8 +66,7 @@
#define DefaultXFree86Dir "/usr"
#endif
-#define IS_KBDDRIV(S) ((strcasecmp((S),"kbd") == 0) || \
- (strcasecmp((S), "keyboard") == 0))
+#define IS_KBDDRIV(S) ((strcasecmp((S),"kbd") == 0))
/*
* Prototypes
diff --git a/hw/xfree86/utils/xorgcfg/keyboard-cfg.c b/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
index 4856c5247..545a67067 100644
--- a/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
+++ b/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
@@ -37,8 +37,7 @@
#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/SmeBSB.h>
-#define IS_KBDDRIV(X) ((strcasecmp((X),"kbd") == 0) || \
- (strcasecmp((X), "keyboard") == 0))
+#define IS_KBDDRIV(X) ((strcasecmp((X),"kbd") == 0))
/*
* Types
@@ -254,11 +253,7 @@ KeyboardConfig(XtPointer config)
keyboard = XtNew(XF86ConfInputRec);
keyboard->list.next = NULL;
keyboard->inp_identifier = XtNewString(ident_string);
-#if defined(USE_DEPRECATED_KEYBOARD_DRIVER)
- keyboard->inp_driver = XtNewString("keyboard");
-#else
keyboard->inp_driver = XtNewString("kbd");
-#endif
keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules),
XtNewString(rules));
xf86addNewOption(keyboard->inp_option_lst,
diff --git a/hw/xfree86/utils/xorgcfg/mouse-cfg.c b/hw/xfree86/utils/xorgcfg/mouse-cfg.c
index 6c29c1f07..5bae6d326 100644
--- a/hw/xfree86/utils/xorgcfg/mouse-cfg.c
+++ b/hw/xfree86/utils/xorgcfg/mouse-cfg.c
@@ -60,9 +60,6 @@ static struct MouseProtocol {
#ifdef __SCO__
{"OsMouse", MTYPE_AUTOMOUSE},
#endif
-#if defined(__UNIXWARE__)
- {"Xqueue", MTYPE_XQUEUE},
-#endif
#ifdef WSCONS_SUPPORT
{"wsmouse", MTYPE_AUTOMOUSE},
#endif
diff --git a/hw/xfree86/utils/xorgcfg/text-mode.c b/hw/xfree86/utils/xorgcfg/text-mode.c
index 0fc5770ca..04b0ce6cb 100644
--- a/hw/xfree86/utils/xorgcfg/text-mode.c
+++ b/hw/xfree86/utils/xorgcfg/text-mode.c
@@ -46,8 +46,7 @@
#include "xf86config.h"
#include "loader.h"
-#define IS_KBDDRIV(X) ((strcmp((X),"kbd") == 0) || \
- (strcmp((X), "keyboard") == 0))
+#define IS_KBDDRIV(X) ((strcmp((X),"kbd") == 0))
#ifndef PROJECT_ROOT
#define PROJECT_ROOT "/usr"
@@ -362,9 +361,6 @@ static char *protocols[] = {
#ifdef __SCO__
"OsMouse",
#endif
-#ifdef __UNIXWARE__
- "Xqueue",
-#endif
#ifdef WSCONS_SUPPORT
"wsmouse",
#endif
@@ -744,11 +740,7 @@ KeyboardConfig(void)
input->inp_option_lst =
xf86addNewOption(input->inp_option_lst,
XtNewString("XkbLayout"), XtNewString("us"));
-#if defined(USE_DEPRECATED_KEYBOARD_DRIVER)
- input->inp_driver = XtNewString("keyboard");
-#else
input->inp_driver = XtNewString("kbd");
-#endif
XF86Config->conf_input_lst =
xf86addInput(XF86Config, input);
}
@@ -824,11 +816,7 @@ KeyboardConfig(void)
XtNewString("XkbLayout"), XtNewString(layout));
if (input->inp_driver == NULL) {
-#if defined(USE_DEPRECATED_KEYBOARD_DRIVER)
- input->inp_driver = XtNewString("keyboard");
-#else
input->inp_driver = XtNewString("kbd");
-#endif
XF86Config->conf_input_lst =
xf86addInput(XF86Config->conf_input_lst, input);
}
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c
index f00eea038..f7174832e 100644
--- a/hw/xfree86/utils/xorgconfig/xorgconfig.c
+++ b/hw/xfree86/utils/xorgconfig/xorgconfig.c
@@ -2066,17 +2066,7 @@ static char *XF86Config_fontpathchunk_text =
"Section \"InputDevice\"\n"
"\n"
" Identifier \"Keyboard1\"\n"
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
-" Driver \"Keyboard\"\n"
-#else
" Driver \"kbd\"\n"
-#endif
-"\n"
-"# For most OSs the protocol can be omitted (it defaults to \"Standard\").\n"
-"# When using XQUEUE (only for SVR3 and SVR4, but not Solaris),\n"
-"# uncomment the following line.\n"
-"\n"
-"# Option \"Protocol\" \"Xqueue\"\n"
"\n"
" Option \"AutoRepeat\" \"500 30\"\n"
"\n"
@@ -2129,7 +2119,7 @@ static char *pointersection_text1 =
"\n"
"# Identifier and driver\n"
"\n"
-#if defined(__UNIXWARE__) || defined(XQUEUE)
+#if defined(__UNIXWARE__)
"# Identifier \"Mouse1\"\n"
"# Driver \"mouse\"\n"
#else
@@ -2140,15 +2130,6 @@ static char *pointersection_text1 =
static char *pointersection_text2 =
"\n"
-"# When using XQUEUE, comment out the above two lines, and uncomment\n"
-"# the following line.\n"
-"\n"
-#if defined(__UNIXWARE__) || defined(XQUEUE)
-" Option \"Protocol\" \"Xqueue\"\n"
-#else
-"# Option \"Protocol\" \"Xqueue\"\n"
-#endif
-"\n"
"# Mouse-speed setting for PS/2 mouse.\n"
"\n"
"# Option \"Resolution\" \"256\"\n"
diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp
index 6c522134e..71abe130d 100644
--- a/hw/xfree86/xorgconf.cpp
+++ b/hw/xfree86/xorgconf.cpp
@@ -176,13 +176,7 @@ XCOMM **********************************************************************
Section "InputDevice"
Identifier "Keyboard1"
- Driver "keyboard"
-
-XCOMM For most OSs the protocol can be omitted (it defaults to "Standard").
-XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), comment
-XCOMM out the above line, and uncomment the following line.
-
-XCOMM Option "Protocol" "Xqueue"
+ Driver "kbd"
XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
XCOMM this.
@@ -267,12 +261,6 @@ XCOMM be available.
XCOMM Option "Protocol" "PS/2"
-XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), use
-XCOMM the following instead of any of the lines above. The Device line
-XCOMM is not required in this case.
-
-XCOMM Option "Protocol" "Xqueue"
-
XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
XCOMM almost every case these lines should be omitted.