Re: [PATCH] Wistron laptop button driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I'm not quite sure what has happened to the original patch, I hope it is
in someone's input tree.

Nevertheless, attached is a patch to add support for Thorsten's hardware.

Thanks,
	Mirek
Add buttons for AOpen/Wistron 1557/MS2141, as reported by Thorsten
Leemhuis.  The hardware has no usable DMI info, so add a module parameter.

Signed-off-by: Miloslav Trmac <[email protected]>

--- a/drivers/input/misc/wistron_btns.c	Tue Sep 20 11:08:45 2005
+++ b/drivers/input/misc/wistron_btns.c	Sun Sep 25 23:23:29 2005
@@ -44,6 +44,10 @@
 module_param(force, bool, 0);
 MODULE_PARM_DESC(force, "Load even if computer is not in database");
 
+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");
+
  /* BIOS interface implementation */
 
 static void __iomem *bios_entry_point; /* BIOS routine entry point */
@@ -238,6 +242,19 @@
 	{ KE_END, 0 }
 };
 
+static struct key_entry keymap_wistron_ms2141[] = {
+	{ KE_KEY,  0x11, KEY_PROG1 },
+	{ KE_KEY,  0x12, KEY_PROG2 },
+	{ KE_WIFI, 0x30, 0 },
+	{ 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_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
    with force=1) and the output of dmidecode to $MODULE_AUTHOR. */
@@ -254,6 +271,27 @@
 	{ 0, }
 };
 
+static int __init select_keymap(void)
+{
+	if (keymap_name != NULL) {
+		if (strcmp (keymap_name, "1557/MS2141") == 0)
+			keymap = keymap_wistron_ms2141;
+		else {
+			printk(KERN_WARNING "wistron_btns: Keymap unknown\n");
+			return -EINVAL;
+		}
+	}
+	dmi_check_system(dmi_ids);
+	if (keymap == NULL) {
+		if (force == 0) {
+			printk(KERN_WARNING "wistron_btns: System unknown\n");
+			return -ENODEV;
+		}
+		keymap = keymap_empty;
+	}
+	return 0;
+}
+
  /* Input layer interface */
 
 static struct input_dev input_dev = {
@@ -337,14 +375,9 @@
 {
 	int err;
 
-	dmi_check_system(dmi_ids);
-	if (keymap == NULL) {
-		if (force == 0) {
-			printk(KERN_WARNING "wistron_btns: System unknown\n");
-			return -ENODEV;
-		}
-		keymap = keymap_empty;
-	}
+	err = select_keymap ();
+	if (err != 0)
+		return err;
 	err = map_bios();
 	if (err != 0)
 		return err;

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux