From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re (hello?): [PATCH] Let keyboard notifiers modify key codes
Date: Fri, 9 Jan 2009 22:23:58 +0100 [thread overview]
Message-ID: <20090109212358.GG5073@const.famille.thibault.fr> (raw)
In-Reply-To: <20090107005813.GA4987@const.famille.thibault.fr>
Hello,
Came somebody have a look at this? The need is real, the only question
that comes to my mind is whether notifiers are allowed to modify the
param they are given. Since they are not marked const, I'd guess it'd
be ok?
Samuel
Samuel Thibault, le Wed 07 Jan 2009 01:58:13 +0100, a écrit :
Make kbd_keycode() read param.value after calling the keyboard notification
chain, to let the callee change the translation on the fly. This for instance
permits to remap the physical positions of the keys independently of the
configured keymap, for e.g. single-handed people.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
--- linux/drivers/char/keyboard.c.orig 2009-01-07 00:48:46.000000000 +0100
+++ linux/drivers/char/keyboard.c 2009-01-07 01:02:05.000000000 +0100
@@ -1248,6 +1248,7 @@ kbd_keycode
kbd->slockstate = 0;
return;
}
+ keycode = param.value;
if (keycode >= NR_KEYS)
if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8)
@@ -1263,6 +1264,7 @@ kbd_keycode
param.value = keysym;
if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNICODE, ¶m) == NOTIFY_STOP)
return;
+ keysym = param.value;
if (down && !raw_mode)
to_utf8(vc, keysym);
return;
@@ -1282,6 +1284,7 @@ kbd_keycode
if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYSYM, ¶m) == NOTIFY_STOP)
return;
+ keysym = param.value;
if (raw_mode && type != KT_SPEC && type != KT_SHIFT)
return;
--- linux/Documentation/input/notifier.txt.orig 2008-04-17 12:14:30.000000000 +0200
+++ linux/Documentation/input/notifier.txt 2009-01-07 01:04:16.000000000 +0100
@@ -21,7 +21,8 @@
For each kind of event but the last, the callback may return NOTIFY_STOP in
order to "eat" the event: the notify loop is stopped and the keyboard event is
-dropped.
+dropped. The callee can also modify param.value so as to change the key
+translation.
In a rough C snippet, we have:
@@ -33,18 +34,26 @@
notifier_call_chain(KBD_UNBOUND_KEYCODE,¶ms);
return;
}
+ keycode = param.value;
+
+ ...
if (unicode) {
param.value = unicode;
if (notifier_call_chain(KBD_UNICODE,¶ms) == NOTIFY_STOP)
return;
+ keysym = param.value;
emit unicode;
return;
}
+ ...
+
params.value = keysym;
if (notifier_call_chain(KBD_KEYSYM,¶ms) == NOTIFY_STOP)
return;
+ keysym = params.value;
+
apply keysym;
notifier_call_chain(KBD_POST_KEYSYM,¶ms);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-01-09 21:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 0:58 [PATCH] Let keyboard notifiers modify key codes Samuel Thibault
2009-01-09 21:23 ` Samuel Thibault [this message]
2009-01-09 21:35 ` Re (hello?): " Alan Cox
2009-01-09 21:43 ` Samuel Thibault
2009-01-09 22:01 ` Alan Cox
2009-01-09 22:23 ` Samuel Thibault
2009-01-12 22:36 ` Derek Fawcus
2009-01-12 22:51 ` Samuel Thibault
2009-01-13 1:06 ` Derek Fawcus
2009-01-13 1:45 ` Samuel Thibault
2009-01-15 7:40 ` Pavel Machek
2009-01-16 19:36 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090109212358.GG5073@const.famille.thibault.fr \
--to=samuel.thibault@ens-lyon.org \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox