|
Lines 67-91
Link Here
|
| 67 |
return(leds); |
67 |
return(leds); |
| 68 |
} |
68 |
} |
| 69 |
|
69 |
|
| 70 |
/* kbd rate stuff based on kbdrate.c from Rik Faith <faith@cs.unc.edu> et.al. |
|
|
| 71 |
* from util-linux-2.9t package */ |
| 72 |
|
| 73 |
#include <linux/kd.h> |
| 74 |
#include <linux/version.h> |
| 75 |
#ifdef __sparc__ |
| 76 |
#include <asm/param.h> |
| 77 |
#include <asm/kbio.h> |
| 78 |
#endif |
| 79 |
|
| 80 |
/* Deal with spurious kernel header change in struct kbd_repeat. |
| 81 |
We undo this define after the routine using that struct is over, |
| 82 |
so as not to interfere with other 'rate' elements. */ |
| 83 |
#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) |
| 84 |
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) |
| 85 |
# define rate period |
| 86 |
# endif |
| 87 |
#endif |
| 88 |
|
| 89 |
static int |
70 |
static int |
| 90 |
KDKBDREP_ioctl_ok(int rate, int delay) { |
71 |
KDKBDREP_ioctl_ok(int rate, int delay) { |
| 91 |
#if defined(KDKBDREP) && !defined(__sparc__) |
72 |
#if defined(KDKBDREP) && !defined(__sparc__) |
|
Lines 94-111
Link Here
|
| 94 |
struct kbd_repeat kbdrep_s; |
75 |
struct kbd_repeat kbdrep_s; |
| 95 |
|
76 |
|
| 96 |
/* don't change, just test */ |
77 |
/* don't change, just test */ |
| 97 |
kbdrep_s.rate = -1; |
78 |
kbdrep_s.LNX_KBD_PERIOD_NAME = -1; |
| 98 |
kbdrep_s.delay = -1; |
79 |
kbdrep_s.delay = -1; |
| 99 |
if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { |
80 |
if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { |
| 100 |
return 0; |
81 |
return 0; |
| 101 |
} |
82 |
} |
| 102 |
/* do the change */ |
83 |
/* do the change */ |
| 103 |
if (rate == 0) /* switch repeat off */ |
84 |
if (rate == 0) /* switch repeat off */ |
| 104 |
kbdrep_s.rate = 0; |
85 |
kbdrep_s.LNX_KBD_PERIOD_NAME = 0; |
| 105 |
else |
86 |
else |
| 106 |
kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ |
87 |
kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */ |
| 107 |
if (kbdrep_s.rate < 1) |
88 |
if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1) |
| 108 |
kbdrep_s.rate = 1; |
89 |
kbdrep_s.LNX_KBD_PERIOD_NAME = 1; |
| 109 |
kbdrep_s.delay = delay; |
90 |
kbdrep_s.delay = delay; |
| 110 |
if (kbdrep_s.delay < 1) |
91 |
if (kbdrep_s.delay < 1) |
| 111 |
kbdrep_s.delay = 1; |
92 |
kbdrep_s.delay = 1; |
|
Lines 120-134
Link Here
|
| 120 |
#endif /* KDKBDREP */ |
101 |
#endif /* KDKBDREP */ |
| 121 |
} |
102 |
} |
| 122 |
|
103 |
|
| 123 |
#undef rate |
|
|
| 124 |
|
| 125 |
/* Undo the earlier define for the struct kbd_repeat problem. */ |
| 126 |
#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) |
| 127 |
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) |
| 128 |
# undef rate |
| 129 |
# endif |
| 130 |
#endif |
| 131 |
|
| 132 |
static int |
104 |
static int |
| 133 |
KIOCSRATE_ioctl_ok(int rate, int delay) { |
105 |
KIOCSRATE_ioctl_ok(int rate, int delay) { |
| 134 |
#ifdef KIOCSRATE |
106 |
#ifdef KIOCSRATE |