diff --git a/configure.ac b/configure.ac index f4503e7..fd9acb7 100644 --- a/configure.ac +++ b/configure.ac @@ -1058,6 +1058,25 @@ if test "x$XORG" = xyes -o "x$XGL" = xye *) ;; esac + + # check whether struct kbd_repeat has the 'period' field. + # on kernels < 2.5.42 it's called 'rate' instead. + AC_TRY_COMPILE([ +#include +#ifdef __sparc__ +#include +#include +#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) XORG_OS="freebsd" diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c index 32f6601..eb8cd53 100644 --- a/hw/xfree86/os-support/linux/lnx_io.c +++ b/hw/xfree86/os-support/linux/lnx_io.c @@ -67,25 +67,6 @@ xf86GetKbdLeds() return(leds); } -/* kbd rate stuff based on kbdrate.c from Rik Faith et.al. - * from util-linux-2.9t package */ - -#include -#include -#ifdef __sparc__ -#include -#include -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - static int KDKBDREP_ioctl_ok(int rate, int delay) { #if defined(KDKBDREP) && !defined(__sparc__) @@ -94,18 +75,18 @@ #if defined(KDKBDREP) && !defined(__spar struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.rate = -1; + 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.rate = 0; + kbdrep_s.LNX_KBD_PERIOD_NAME = 0; else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; + 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; @@ -120,15 +101,6 @@ #else /* no KDKBDREP */ #endif /* KDKBDREP */ } -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index a5074f6..e43d1d1 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -106,4 +106,7 @@ #undef HAS_APERTURE_DRV /* Has backtrace support */ #undef HAVE_BACKTRACE +/* Name of the period field in struct kbd_repeat */ +#undef LNX_KBD_PERIOD_NAME + #endif /* _XORG_CONFIG_H_ */