public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dell-wmi Switch support and Tablet switch definition
@ 2009-06-19 11:15 Rafi Rubin
  2009-06-19 14:02 ` Matthew Garrett
  0 siblings, 1 reply; 6+ messages in thread
From: Rafi Rubin @ 2009-06-19 11:15 UTC (permalink / raw)
  To: linux-acpi; +Cc: Rafi Rubin

Added a bit of missing code needed to handle switch events.

Added the definitions for the hinge rotation as seen on the
Latitude XT tablet.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
---
 drivers/platform/x86/dell-wmi.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 0f900cc..c0da4d2 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -44,6 +44,7 @@ struct key_entry {
 	char type;		/* See KE_* below */
 	u16 code;
 	u16 keycode;
+   u8  state;
 };
 
 enum { KE_KEY, KE_SW, KE_IGNORE, KE_END };
@@ -58,6 +59,10 @@ static struct key_entry dell_wmi_keymap[] = {
 	{KE_KEY, 0xe045, KEY_PROG1},
 	{KE_KEY, 0xe009, KEY_EJECTCD},
 
+	/* Definitions for the hinge switch */
+	{KE_SW , 0xe046, SW_TABLET_MODE,1},
+	{KE_SW , 0xe047, SW_TABLET_MODE,0},
+
 	/* These also contain the brightness level at offset 6 */
 	{KE_KEY, 0xe006, KEY_BRIGHTNESSUP},
 	{KE_KEY, 0xe005, KEY_BRIGHTNESSDOWN},
@@ -172,10 +177,18 @@ static void dell_wmi_notify(u32 value, void *context)
 		 */
 		key = dell_wmi_get_entry_by_scancode(buffer[1] & 0xFFFF);
 		if (key) {
-			input_report_key(dell_wmi_input_dev, key->keycode, 1);
-			input_sync(dell_wmi_input_dev);
-			input_report_key(dell_wmi_input_dev, key->keycode, 0);
-			input_sync(dell_wmi_input_dev);
+         switch (key->type) {
+         case KE_KEY:
+				input_report_key(dell_wmi_input_dev, key->keycode, 1);
+				input_sync(dell_wmi_input_dev);
+				input_report_key(dell_wmi_input_dev, key->keycode, 0);
+				input_sync(dell_wmi_input_dev);
+            break;
+         case KE_SW:
+            input_report_switch(dell_wmi_input_dev, key->keycode, key->state);
+            input_sync(dell_wmi_input_dev);
+            break;
+         }
 		} else if (buffer[1] & 0xFFFF)
 			printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
 			       buffer[1] & 0xFFFF);
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-19 20:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 11:15 [PATCH] dell-wmi Switch support and Tablet switch definition Rafi Rubin
2009-06-19 14:02 ` Matthew Garrett
2009-06-19 19:28   ` Rafi Rubin
2009-06-19 19:40     ` Matthew Garrett
2009-06-19 20:31       ` Rafi Rubin
2009-06-19 20:34         ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox