diff options
-rw-r--r-- | driver/xf86-input-keyboard/COPYING | 234 | ||||
-rw-r--r-- | driver/xf86-input-keyboard/configure.ac | 77 | ||||
-rw-r--r-- | driver/xf86-input-keyboard/man/Makefile.am | 4 | ||||
-rw-r--r-- | driver/xf86-input-keyboard/man/kbd.man | 50 | ||||
-rw-r--r-- | driver/xf86-input-keyboard/src/kbd.c | 24 | ||||
-rw-r--r-- | driver/xf86-input-keyboard/src/sun_kbd.c | 67 |
6 files changed, 372 insertions, 84 deletions
diff --git a/driver/xf86-input-keyboard/COPYING b/driver/xf86-input-keyboard/COPYING index 7f33cbfd2..1e67ee740 100644 --- a/driver/xf86-input-keyboard/COPYING +++ b/driver/xf86-input-keyboard/COPYING @@ -1,12 +1,230 @@ -This is a stub file. This package has not yet had its complete licensing -information compiled. Please see the individual source files for details on -your rights to use and modify this software. +Code common to all operating systems is covered by these notices: -Please submit updated COPYING files to the Xorg bugzilla: +Copyright (c) 1992-2003 by The XFree86 Project, Inc. +Copyright 1997 by Metro Link, Inc. -https://bugs.freedesktop.org/enter_bug.cgi?product=xorg +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: -All licensing questions regarding this software should be directed at the -Xorg mailing list: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. -http://lists.freedesktop.org/mailman/listinfo/xorg +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). + + +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. + + +Code for BSD operating systems is additionally covered by this notice: + +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. + + + +Code for the GNU Hurd operating system is additionally covered by this notice: + +Copyright 1997,1998 by UCHIYAMA Yasushi + +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 UCHIYAMA Yasushi not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. UCHIYAMA Yasushi makes no representations +about the suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL UCHIYAMA YASUSHI 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. + + + +Code for Linux operating systems is additionally covered by these notices: + +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> + +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. + +Portions based on kbdrate.c from util-linux 2.9t, which is +Copyright 1992 Rickard E. Faith. Distributed under the GPL. +This program comes with ABSOLUTELY NO WARRANTY. + + + +Code for SCO operating systems is additionally covered by these notices: + +Copyright 2003, 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 lnx_kbd.c which is +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. + + + +Code for Solaris operating systems is additionally covered by these notices: + +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-2007 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. diff --git a/driver/xf86-input-keyboard/configure.ac b/driver/xf86-input-keyboard/configure.ac index 7f0f3c2f5..c5ca5ac4e 100644 --- a/driver/xf86-input-keyboard/configure.ac +++ b/driver/xf86-input-keyboard/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-input-keyboard], - 1.1.1, + 1.3.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-input-keyboard) @@ -35,9 +35,6 @@ AM_MAINTAINER_MODE DRIVER_NAME=kbd AC_SUBST([DRIVER_NAME]) -COMPAT_DRIVER_NAME=keyboard -AC_SUBST([COMPAT_DRIVER_NAME]) - AM_CONFIG_HEADER([config.h]) # Checks for programs. @@ -49,30 +46,52 @@ AH_TOP([#include "xorg-server.h"]) m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))]) -#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers]) -# -#AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput], -# [Build XInput support (default: yes)]), -# [XINPUT=$enableval],[XINPUT=yes]) -#AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes") -#if test "x$XINPUT" = "xyes" ; then -# AC_DEFINE(XINPUT,1,[Enable XInput support]) -#fi -# -#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb], -# [Build XKB support (default: yes)]), -# [XKB=$enableval],[XKB=yes]) -#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes") -#if test "x$XKB" = "xyes" ; then -# AC_DEFINE(XKB,1,[Enable XKB support]) -#fi - -AC_ARG_ENABLE(depkbd, AS_HELP_STRING([--enable-depkbd], - [Use deprecated keyboard driver [[default=no]]]), - [DEPKBD=$enableval],[DEPKBD=no]) -if test "x$DEPKBD" = "xyes" ; then - AC_DEFINE(USE_DEPRECATED_KEYBOARD_DRIVER,1,[Use deprecated keyboard driver]) -fi +case $host_os in + linux*) + IS_LINUX="yes" + # check whether struct kbd_repeat has the 'period' field. + # on kernels < 2.5.42 it's called 'rate' instead. + AC_TRY_COMPILE([ +#include <linux/kd.h> +#ifdef __sparc__ +#include <asm/param.h> +#include <asm/kbio.h> +#endif +],[ +int main () { + struct kbd_repeat k; + k.period = 0; + return 0; +}], + [period_field="period"], + [period_field="rate"]) + AC_DEFINE_UNQUOTED(LNX_KBD_PERIOD_NAME, [$period_field], + [Name of the period field in struct kbd_repeat]) + ;; + + freebsd* | kfreebsd-gnu* | netbsd* | openbsd*) + IS_BSD="yes" + ;; + + solaris*) + IS_SOLARIS="yes" + ;; + + gnu*) + IS_HURD="yes" + ;; + + *) + AC_MSG_ERROR([Your operating system is not supported by the kbd driver. + Contact xorg@lists.freedesktop.org if you are interested in + porting it.]) + ;; +esac +AM_CONDITIONAL(LINUX, [test "x$IS_LINUX" = xyes]) +AM_CONDITIONAL(BSD, [test "x$IS_BSD" = xyes]) +AM_CONDITIONAL(SOLARIS, [test "x$IS_SOLARIS" = xyes]) +AM_CONDITIONAL(HURD, [test "x$IS_HURD" = xyes]) +AM_CONDITIONAL(SCO, [test "x$IS_SCO" = xyes]) AC_ARG_WITH(xorg-module-dir, AC_HELP_STRING([--with-xorg-module-dir=DIR], @@ -88,7 +107,7 @@ XORG_DRIVER_CHECK_EXT(XINPUT, inputproto) XORG_DRIVER_CHECK_EXT(XKB, kbproto) # Checks for pkg-config packages -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto $REQUIRED_MODULES) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2.99.0] xproto $REQUIRED_MODULES) sdkdir=$(pkg-config --variable=sdkdir xorg-server) CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src' diff --git a/driver/xf86-input-keyboard/man/Makefile.am b/driver/xf86-input-keyboard/man/Makefile.am index f0eb29b85..e17a9545e 100644 --- a/driver/xf86-input-keyboard/man/Makefile.am +++ b/driver/xf86-input-keyboard/man/Makefile.am @@ -40,12 +40,16 @@ SED = sed XORGRELSTRING = @PACKAGE_STRING@ XORGMANNAME = X Version 11 +# should allow configure override like xserver's configure.ac does +XKBPATH=${datadir}/X11/xkb + MAN_SUBSTS = \ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ -e 's|__xservername__|Xorg|g' \ -e 's|__xconfigfile__|xorg.conf|g' \ -e 's|__projectroot__|$(prefix)|g' \ + -e 's|__xkb_path__|$(XKBPATH)|g' \ -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \ -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \ -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \ diff --git a/driver/xf86-input-keyboard/man/kbd.man b/driver/xf86-input-keyboard/man/kbd.man index dad80eb15..9971b91c7 100644 --- a/driver/xf86-input-keyboard/man/kbd.man +++ b/driver/xf86-input-keyboard/man/kbd.man @@ -17,10 +17,10 @@ kbd \- Keyboard input driver .B kbd is an __xservername__ input driver for keyboards. The driver supports the standard OS-provided keyboard interface, but these are currently only available to -this driver module for Linux, BSD, and Solaris. This driver is planned to -replace the built-in +this driver module for Linux, BSD, and Solaris. This driver is the +replacement for the built-in .B keyboard -driver in a future release of __xservername__. +driver formerly included in __xservername__. .PP The .B kbd @@ -73,7 +73,11 @@ specifies which XKB rules file to use for interpreting the and .B XkbOptions settings. Default: "xorg" for most platforms, but "xfree98" for the -Japanese PC-98 platforms. +Japanese PC-98 platforms. If you use the "xorg" value then you can +find listing of all valid values for these four options in the +.I +__xkb_path__/rules/xorg.lst +file. .TP 7 .BI "Option \*qXkbModel\*q \*q" modelname \*q specifies the XKB keyboard model name. Default: "pc105" for most platforms, @@ -95,5 +99,41 @@ enhance the keyboard behaviour. Default: not set. Some other XKB-related options are available, but they are incompatible with the ones listed above and are not recommended, so they are not documented here. +.SH EXAMPLE +The following xorg.conf fragment ensures that user will be able to switch between +.I us +and +.I sk +layouts by pressing the "menu" key. +.PP +The +.B XkbVariant +option defines which variants of the two layouts should be used. In case of the +.I us +layout +its default variant is used. In case of the +.I sk +layout +its +.I qwerty +variant is used. +.PP +.nf +.RS 4 +Section \*qInputDevice\*q +.RS 4 +Identifier "Generic Keyboard" +Driver "kbd" +Option "CoreKeyboard" +Option "XkbRules" "xorg" +Option "XkbModel" "pc105" +Option "XkbLayout" "us,sk" +Option "XkbVariant" ",qwerty" +Option "XkbOptions" "grp:menu_toggle,grp_led:scroll" +.RE +EndSection +.RE +.fi .SH "SEE ALSO" -keyboard(__drivermansuffix__), __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__). +__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), +xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__). diff --git a/driver/xf86-input-keyboard/src/kbd.c b/driver/xf86-input-keyboard/src/kbd.c index 85d8b494f..094628ece 100644 --- a/driver/xf86-input-keyboard/src/kbd.c +++ b/driver/xf86-input-keyboard/src/kbd.c @@ -59,6 +59,8 @@ extern int XkbDfltRepeatInterval; #define SCROLLFLAG 4 #define MODEFLAG 8 #define COMPOSEFLAG 16 +/* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */ +#define INITFLAG (1 << 31) static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); static int KbdProc(DeviceIntPtr device, int what); @@ -477,10 +479,9 @@ InitKBD(InputInfoPtr pInfo, Bool init) pKbd->scanPrefix = 0; if (init) { - pKbd->keyLeds = 0; - + pKbd->keyLeds = pKbd->GetLeds(pInfo); UpdateLeds(pInfo); - + pKbd->keyLeds |= INITFLAG; if( pKbd->delay <= 375) rad = 0x00; else if (pKbd->delay <= 625) rad = 0x20; else if (pKbd->delay <= 875) rad = 0x40; @@ -489,8 +490,22 @@ InitKBD(InputInfoPtr pInfo, Bool init) else if (pKbd->rate >= 30) rad |= 0x00; else rad |= ((58 / pKbd->rate) - 2); pKbd->SetKbdRepeat(pInfo, rad); - } else + } else { + int leds = pKbd->keyLeds; + + pKbd->keyLeds = pKbd->GetLeds(pInfo); UpdateLeds(pInfo); + if ((pKbd->keyLeds & CAPSFLAG) != + ((leds & INITFLAG) ? 0 : (leds & CAPSFLAG))) { + pKbd->PostEvent(pInfo, KEY_CapsLock, TRUE); + pKbd->PostEvent(pInfo, KEY_CapsLock, FALSE); + } + if ((pKbd->keyLeds & NUMFLAG) != + (leds & INITFLAG ? 0 : leds & NUMFLAG)) { + pKbd->PostEvent(pInfo, KEY_NumLock, TRUE); + pKbd->PostEvent(pInfo, KEY_NumLock, FALSE); + } + } } static int @@ -550,7 +565,6 @@ KbdProc(DeviceIntPtr device, int what) * passing on parts of the VT switch sequence. */ if (pInfo->fd >= 0) { - sleep(1); xf86FlushInput(pInfo->fd); AddEnabledDevice(pInfo->fd); } diff --git a/driver/xf86-input-keyboard/src/sun_kbd.c b/driver/xf86-input-keyboard/src/sun_kbd.c index c9dc2746c..f8eedfedc 100644 --- a/driver/xf86-input-keyboard/src/sun_kbd.c +++ b/driver/xf86-input-keyboard/src/sun_kbd.c @@ -59,7 +59,6 @@ #include "xf86_OSlib.h" #include "xf86OSKbd.h" #include "sun_kbd.h" -#include "atKeynames.h" #include <sys/stropts.h> #include <sys/vuid_event.h> @@ -208,42 +207,6 @@ KbdOn(InputInfoPtr pInfo, int what) return BadImplementation; } - /* If Caps Lock or Num Lock LEDs are on when server starts, - * send a fake key down on those keys to set the server state - * to match the LED's. - */ - if ( priv->oleds & (LED_CAPS_LOCK | LED_NUM_LOCK) ) { - int capslock = -1; - int numlock = -1; - int j; - TransMapPtr kmap = pKbd->scancodeMap; - - for (j = kmap->begin; j < kmap->end ; j++) { - switch (kmap->map[j]) { - case KEY_CapsLock: - capslock = j; - break; - case KEY_NumLock: - numlock = j; - break; - default: - /* nothing to do */ - break; - } - if ((capslock >= 0) && (numlock >= 0)) { - break; - } - } - if ((priv->oleds & LED_CAPS_LOCK) && (capslock > 0)) { - pKbd->PostEvent(pInfo, capslock, TRUE); /* Press */ - pKbd->PostEvent(pInfo, capslock, FALSE); /* Release */ - } - if ((priv->oleds & LED_NUM_LOCK) && (numlock > 0)) { - pKbd->PostEvent(pInfo, numlock, TRUE); /* Press */ - pKbd->PostEvent(pInfo, numlock, FALSE); /* Release */ - } - } - return Success; } @@ -301,9 +264,39 @@ SoundKbdBell(InputInfoPtr pInfo, int loudness, int pitch, int duration) sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private; int kbdCmd, i; +#ifdef KIOCMKTONE + int cycles; + int mktonevalue; +#endif if (loudness && pitch) { +#ifdef KIOCMKTONE + if (pitch == 0) + cycles = UINT16_MAX; + else if (pitch >= UINT16_MAX) + cycles = 0; + else { + cycles = (PIT_HZ + pitch / 2) / pitch; + if (cycles > UINT16_MAX) + cycles = UINT16_MAX; + } + + mktonevalue = cycles | (((duration * loudness * 20) / 1000) << 16); + + errno = 0; + SYSCALL(i = ioctl (pInfo->fd, KIOCMKTONE, mktonevalue)); + if (i == 0) + return; + + if (errno != EINVAL) { + if (errno != EAGAIN) + xf86Msg(X_ERROR, "%s: Failed to activate bell: %s\n", + pInfo->name, strerror(errno)); + return; + } +#endif + kbdCmd = KBD_CMD_BELL; SYSCALL(i = ioctl (pInfo->fd, KIOCCMD, &kbdCmd)); |