diff options
Diffstat (limited to 'hw/xfree86/os-support/sco')
-rw-r--r-- | hw/xfree86/os-support/sco/Makefile.am | 4 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/VTsw_sco.c | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_KbdMap.c | 304 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_init.c | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_io.c | 269 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_kbd.c | 530 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_kbd.h | 20 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_mouse.c | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/sco/sco_video.c | 1 |
9 files changed, 0 insertions, 1131 deletions
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/VTsw_sco.c b/hw/xfree86/os-support/sco/VTsw_sco.c index beb86ccad..ba2f7adee 100644 --- a/hw/xfree86/os-support/sco/VTsw_sco.c +++ b/hw/xfree86/os-support/sco/VTsw_sco.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c,v 1.2 1998/07/25 16:56:57 dawes Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * Copyright 1993 by David McCullough <davidm@stallion.oz.au> 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_init.c b/hw/xfree86/os-support/sco/sco_init.c index bc1f3b56d..07f30f019 100644 --- a/hw/xfree86/os-support/sco/sco_init.c +++ b/hw/xfree86/os-support/sco/sco_init.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c,v 3.13 2002/06/03 21:22:10 dawes Exp $ */ /* * Copyright 2001-2005 by J. Kean Johnston <jkj@sco.com> * 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 6067d51a5..000000000 --- a/hw/xfree86/os-support/sco/sco_io.c +++ /dev/null @@ -1,269 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c,v 3.9 2002/10/11 01:40:36 dawes Exp $ */ -/* - * 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/sco/sco_mouse.c b/hw/xfree86/os-support/sco/sco_mouse.c index f9d068c24..29e1f6f3c 100644 --- a/hw/xfree86/os-support/sco/sco_mouse.c +++ b/hw/xfree86/os-support/sco/sco_mouse.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c,v 3.12 2001/06/30 22:41:49 tsi Exp $ */ /* * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * diff --git a/hw/xfree86/os-support/sco/sco_video.c b/hw/xfree86/os-support/sco/sco_video.c index dd81786bb..807028f6a 100644 --- a/hw/xfree86/os-support/sco/sco_video.c +++ b/hw/xfree86/os-support/sco/sco_video.c @@ -1,4 +1,3 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c,v 3.8tsi Exp $ */ /* * Copyright 2001 by J. Kean Johnston <jkj@sco.com> * |