From: "Éric Piel" <Eric.Piel@tremplin-utc.net>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>,
mitr@volny.cz, otauber@web.de, linux-kernel@vger.kernel.org,
linux-input <linux-input@atrey.karlin.mff.cuni.cz>
Subject: [PATCH 2/3] wistron_btns: Generic keymap
Date: Sun, 18 Mar 2007 22:10:38 +0100 [thread overview]
Message-ID: <45FDAACE.9060303@tremplin-utc.net> (raw)
In-Reply-To: <45F91F73.8040200@tremplin-utc.net>
[-- Attachment #1: Type: text/plain, Size: 385 bytes --]
This patch adds a generic map. That is, a keymap that should output the
correct keycodes for most laptops. This is simply based on the
observation of all those keymaps already gathered, as most of the
wistron codes are always mapped to the same keycode.
Hopefully, this way users which have a non-supported laptop will have a
quick and dirty way to use the multimedia keys.
Eric
[-- Attachment #2: wistron_btns-generic-map-2.6.21-b.patch --]
[-- Type: text/x-patch, Size: 3098 bytes --]
From: Eric Piel <eric.piel@tremplin-utc.net>
wistron_btns: Generic keymap
It turns out that the mapping of the wistron code is always the same, the
main difference being some keys which may not exist and leds which might not be
present. Therefore it's possible to write a generic keymap which would allow
the use of an unknown keyboard with little drawbacks. The user can select it
specifying the parameter "keymap=generic".
Signed-off-by: Eric Piel <eric.piel@tremplin-utc.net>
--- linux-2.6.21/drivers/input/misc/wistron_btns.c 2007-03-17 10:09:11.000000000 +0100
+++ linux-2.6.21/drivers/input/misc/wistron_btns.c~full 2007-03-17 10:09:14.000000000 +0100
@@ -58,7 +58,7 @@ MODULE_PARM_DESC(force, "Load even if co
static char *keymap_name; /* = NULL; */
module_param_named(keymap, keymap_name, charp, 0);
-MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected");
+MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected [generic, 1557/MS2141]");
static struct platform_device *wistron_device;
@@ -568,6 +568,42 @@ static struct key_entry keymap_wistron_m
{ KE_END, FE_UNTESTED }
};
+static struct key_entry keymap_wistron_generic[] = {
+ { KE_KEY, 0x01, {KEY_HELP} },
+ { KE_KEY, 0x02, {KEY_CONFIG} },
+ { KE_KEY, 0x03, {KEY_POWER} },
+ { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
+ { KE_KEY, 0x06, {KEY_SCREEN} }, /* Display on/off */
+ { KE_KEY, 0x08, {KEY_MUTE} },
+ { KE_KEY, 0x11, {KEY_PROG1} },
+ { KE_KEY, 0x12, {KEY_PROG2} },
+ { KE_KEY, 0x13, {KEY_PROG3} },
+ { KE_KEY, 0x14, {KEY_MAIL} },
+ { KE_KEY, 0x15, {KEY_WWW} },
+ { KE_KEY, 0x20, {KEY_VOLUMEUP} },
+ { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
+ { KE_KEY, 0x22, {KEY_REWIND} },
+ { KE_KEY, 0x23, {KEY_FORWARD} },
+ { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
+ { KE_KEY, 0x25, {KEY_STOPCD} },
+ { KE_KEY, 0x31, {KEY_MAIL} },
+ { KE_KEY, 0x36, {KEY_WWW} },
+ { KE_KEY, 0x37, {KEY_SCREEN} }, /* Display on/off */
+ { KE_KEY, 0x40, {KEY_WLAN} },
+ { KE_KEY, 0x49, {KEY_CONFIG} },
+ { KE_SW, 0x4a, {.sw = {SW_LID, 1}} }, /* lid close */
+ { KE_SW, 0x4b, {.sw = {SW_LID, 0}} }, /* lid open */
+ { KE_KEY, 0x6a, {KEY_CONFIG} },
+ { KE_KEY, 0x6d, {KEY_POWER} },
+ { KE_KEY, 0x71, {KEY_STOPCD} },
+ { KE_KEY, 0x72, {KEY_PLAYPAUSE} },
+ { KE_KEY, 0x74, {KEY_REWIND} },
+ { KE_KEY, 0x78, {KEY_FORWARD} },
+ { KE_WIFI, 0x30 },
+ { KE_BLUETOOTH, 0x44 },
+ { KE_END, 0 }
+};
+
/*
* If your machine is not here (which is currently rather likely), please send
* a list of buttons and their key codes (reported when loading this module
@@ -886,15 +922,17 @@ static struct dmi_system_id dmi_ids[] __
static int __init select_keymap(void)
{
+ dmi_check_system(dmi_ids);
if (keymap_name != NULL) {
if (strcmp (keymap_name, "1557/MS2141") == 0)
keymap = keymap_wistron_ms2141;
+ else if (strcmp (keymap_name, "generic") == 0)
+ keymap = keymap_wistron_generic;
else {
printk(KERN_ERR "wistron_btns: Keymap unknown\n");
return -EINVAL;
}
}
- dmi_check_system(dmi_ids);
if (keymap == NULL) {
if (!force) {
printk(KERN_ERR "wistron_btns: System unknown\n");
next prev parent reply other threads:[~2007-03-18 21:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <45ECA23A.5010503@tremplin-utc.net>
[not found] ` <d120d5000703060536k7743ece9hb20fa4d1f7ad7ad7@mail.gmail.com>
[not found] ` <45ED8809.70309@tremplin-utc.net>
[not found] ` <45F72D37.6090004@tremplin-utc.net>
2007-03-14 13:54 ` [PATCH 0/2] wistron_btns: More keymaps Dmitry Torokhov
2007-03-14 15:20 ` Éric Piel
2007-03-14 15:44 ` Dmitry Torokhov
2007-03-14 18:25 ` Vojtech Pavlik
2007-03-14 18:58 ` Dmitry Torokhov
2007-03-14 19:02 ` Dmitry Torokhov
2007-03-14 19:12 ` Éric Piel
2007-03-14 19:02 ` Vojtech Pavlik
2007-03-15 10:26 ` Éric Piel
2007-03-18 21:10 ` [PATCH 0/3] wistron_btns: More keymaps, take 2 Éric Piel
2007-03-27 3:39 ` Dmitry Torokhov
2007-03-18 21:10 ` [PATCH 1/3] wriston_btns: Add acerhk laptop database Éric Piel
2007-03-18 21:10 ` Éric Piel [this message]
2007-03-18 21:10 ` [PATCH 3/3] wistron_btns: Declare keymaps as initdata Éric Piel
2007-03-19 21:28 ` [PATCH 0/2] wistron_btns: More keymaps Dmitry Torokhov
2007-03-20 0:06 ` Éric Piel
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=45FDAACE.9060303@tremplin-utc.net \
--to=eric.piel@tremplin-utc.net \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@atrey.karlin.mff.cuni.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mitr@volny.cz \
--cc=otauber@web.de \
--cc=vojtech@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).