aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorEric Piel <eric.piel@tremplin-utc.net>2007-04-12 01:32:41 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-04-12 01:32:41 -0400
commit7b0a4cd7601774d1312f477a879f86b0968880fd (patch)
treedc2027782067e4a4b819e2100d70c793fc2a2649 /drivers/input/misc
parent6480e2a275ff8ff48ae23a011616fcf819ed7a4e (diff)
Input: wistron - introduce generic keymap
It turns out that the keymaps in the wistron driver are almost 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> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/wistron_btns.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 47de377330b8..b9ef1dfc9a07 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -58,7 +58,7 @@ MODULE_PARM_DESC(force, "Load even if computer is not in database");
58 58
59static char *keymap_name; /* = NULL; */ 59static char *keymap_name; /* = NULL; */
60module_param_named(keymap, keymap_name, charp, 0); 60module_param_named(keymap, keymap_name, charp, 0);
61MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); 61MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected [generic, 1557/MS2141]");
62 62
63static struct platform_device *wistron_device; 63static struct platform_device *wistron_device;
64 64
@@ -568,6 +568,42 @@ static struct key_entry keymap_wistron_md96500[] = {
568 { KE_END, FE_UNTESTED } 568 { KE_END, FE_UNTESTED }
569}; 569};
570 570
571static struct key_entry keymap_wistron_generic[] = {
572 { KE_KEY, 0x01, {KEY_HELP} },
573 { KE_KEY, 0x02, {KEY_CONFIG} },
574 { KE_KEY, 0x03, {KEY_POWER} },
575 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
576 { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Display on/off */
577 { KE_KEY, 0x08, {KEY_MUTE} },
578 { KE_KEY, 0x11, {KEY_PROG1} },
579 { KE_KEY, 0x12, {KEY_PROG2} },
580 { KE_KEY, 0x13, {KEY_PROG3} },
581 { KE_KEY, 0x14, {KEY_MAIL} },
582 { KE_KEY, 0x15, {KEY_WWW} },
583 { KE_KEY, 0x20, {KEY_VOLUMEUP} },
584 { KE_KEY, 0x21, {KEY_VOLUMEDOWN} },
585 { KE_KEY, 0x22, {KEY_REWIND} },
586 { KE_KEY, 0x23, {KEY_FORWARD} },
587 { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
588 { KE_KEY, 0x25, {KEY_STOPCD} },
589 { KE_KEY, 0x31, {KEY_MAIL} },
590 { KE_KEY, 0x36, {KEY_WWW} },
591 { KE_KEY, 0x37, {KEY_DISPLAYTOGGLE} }, /* Display on/off */
592 { KE_KEY, 0x40, {KEY_WLAN} },
593 { KE_KEY, 0x49, {KEY_CONFIG} },
594 { KE_SW, 0x4a, {.sw = {SW_LID, 1}} }, /* lid close */
595 { KE_SW, 0x4b, {.sw = {SW_LID, 0}} }, /* lid open */
596 { KE_KEY, 0x6a, {KEY_CONFIG} },
597 { KE_KEY, 0x6d, {KEY_POWER} },
598 { KE_KEY, 0x71, {KEY_STOPCD} },
599 { KE_KEY, 0x72, {KEY_PLAYPAUSE} },
600 { KE_KEY, 0x74, {KEY_REWIND} },
601 { KE_KEY, 0x78, {KEY_FORWARD} },
602 { KE_WIFI, 0x30 },
603 { KE_BLUETOOTH, 0x44 },
604 { KE_END, 0 }
605};
606
571/* 607/*
572 * If your machine is not here (which is currently rather likely), please send 608 * If your machine is not here (which is currently rather likely), please send
573 * a list of buttons and their key codes (reported when loading this module 609 * a list of buttons and their key codes (reported when loading this module
@@ -886,15 +922,17 @@ static struct dmi_system_id dmi_ids[] __initdata = {
886 922
887static int __init select_keymap(void) 923static int __init select_keymap(void)
888{ 924{
925 dmi_check_system(dmi_ids);
889 if (keymap_name != NULL) { 926 if (keymap_name != NULL) {
890 if (strcmp (keymap_name, "1557/MS2141") == 0) 927 if (strcmp (keymap_name, "1557/MS2141") == 0)
891 keymap = keymap_wistron_ms2141; 928 keymap = keymap_wistron_ms2141;
929 else if (strcmp (keymap_name, "generic") == 0)
930 keymap = keymap_wistron_generic;
892 else { 931 else {
893 printk(KERN_ERR "wistron_btns: Keymap unknown\n"); 932 printk(KERN_ERR "wistron_btns: Keymap unknown\n");
894 return -EINVAL; 933 return -EINVAL;
895 } 934 }
896 } 935 }
897 dmi_check_system(dmi_ids);
898 if (keymap == NULL) { 936 if (keymap == NULL) {
899 if (!force) { 937 if (!force) {
900 printk(KERN_ERR "wistron_btns: System unknown\n"); 938 printk(KERN_ERR "wistron_btns: System unknown\n");