On Thu, Mar 21, 2013 at 06:05:11AM +0000, Miod Vallat wrote:
> > Excellent. Try setting the default, though:
> >
> > # wsconsctl keyboard.repeat.deln.default=350
> > keyboard.repeat.deln.default -> 200
> >
> > In fact, if you check, whenever a user changes the normal value, the
> > default value changes too. So a normal, non-root user can change the
> > values for all of the VCs. Great.
>
> No, that was a bug in wsconsctl where it would report the current repeat
> rate as the default. Thanks for noticing it!
ARGH! I was looking for ages in the kernel source for a bug that didn't
exist :-)
Anyway, here are two more patches I've come up with. One is a simple
typo in a comment, the other is an updated repeat-key patch, which has
the following great features:
1. It actually works, and restores the user's custom settings, as you
pointed out that my original one didn't.
2. If you press command + repeat, it resets the rates to the defaults,
so if you accidently hose the console with wsconsctl keyboard.repeat.del1=1
it can be recovered easily.
--- wskbd.c.orig Tue Nov 15 04:15:52 2011
+++ wskbd.c.fixtypo Thu Mar 21 17:21:55 2013
@@ -269,7 +269,7 @@
#define WSKBD_DEFAULT_KEYREPEAT_DEL1 400 /* 400ms to start
repeating */
#endif
#ifndef WSKBD_DEFAULT_KEYREPEAT_DELN
-#define WSKBD_DEFAULT_KEYREPEAT_DELN 100 /* 100ms to between
repeats */
+#define WSKBD_DEFAULT_KEYREPEAT_DELN 100 /* 100ms between
repeats */
#endif
struct wskbd_keyrepeat_data wskbd_default_keyrepeat_data = {
--- wskbd.c.orig Tue Nov 15 04:15:52 2011
+++ wskbd.c Thu Mar 21 17:20:42 2013
@@ -272,12 +274,29 @@
#define WSKBD_DEFAULT_KEYREPEAT_DELN 100 /* 100ms to between
repeats */
#endif
+#ifndef WSKBD_KEY_KEYREPEAT_DEL1
+#define WSKBD_KEY_KEYREPEAT_DEL1 25 /* 25ms to start
repeating */
+#endif
+#ifndef WSKBD_KEY_KEYREPEAT_DELN
+#define WSKBD_KEY_KEYREPEAT_DELN 25 /* 25ms between repeats
*/
+#endif
+
struct wskbd_keyrepeat_data wskbd_default_keyrepeat_data = {
WSKBD_KEYREPEAT_DOALL,
WSKBD_DEFAULT_KEYREPEAT_DEL1,
WSKBD_DEFAULT_KEYREPEAT_DELN,
};
+struct wskbd_keyrepeat_data wskbd_key_keyrepeat_data = {
+ WSKBD_KEYREPEAT_DOALL,
+ WSKBD_KEY_KEYREPEAT_DEL1,
+ WSKBD_KEY_KEYREPEAT_DELN,
+};
+
+struct wskbd_keyrepeat_data wskbd_store_keyrepeat_data = {
+ WSKBD_KEYREPEAT_DOALL, 0, 0,
+};
+
#if NWSMUX > 0 || NWSDISPLAY > 0
struct wssrcops wskbd_srcops = {
WSMUX_KBD,
@@ -1538,6 +1561,19 @@
if (sc != NULL && kp->command != KS_voidSymbol)
iscommand = internal_command(sc, &type, kp->command,
kp->group1[0]);
+
+ /* Check for repeat key */
+ if (kp->group1[0] == KS_Repeat && type==WSCONS_EVENT_KEY_DOWN)
+ {
+ wskbd_store_keyrepeat_data = sc->sc_keyrepeat_data;
+ sc->sc_keyrepeat_data=wskbd_key_keyrepeat_data;
+ if (MOD_ONESET(sc->id, MOD_COMMAND) || MOD_ALLSET(sc->id, MOD_COMMAND1
| MOD_COMMAND2)) wskbd_store_keyrepeat_data = wskbd_default_keyrepeat_data;
+ }
+
+ if (kp->group1[0] == KS_Repeat && type==WSCONS_EVENT_KEY_UP)
+ {
+ sc->sc_keyrepeat_data = wskbd_store_keyrepeat_data;
+ }
/* Now update modifiers */
switch (kp->group1[0]) {
--
Creamy