lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 14 Jun 2011 16:28:29 +0800
From:	Ike Panhc <ike.pan@...onical.com>
To:	platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-input@...r.kernel.org
Cc:	Matthew Garrett <mjg@...hat.com>,
	Dmitry Torohov <dmitry.torokhov@...il.com>
Subject: [PATCH] ideapad: let Fn+F5 also trigger KEY_BLUETOOTH

The design for ideapad Fn-F5 key is not only for wifi but for all
radio device including wifi, bluetooth and wwan. Idealy it shall
acts like this:

    wifi on          wifi off         wifi on         wifi off
     bt on   ----->   bt on   ----->   bt off  ----->  bt off

This patch will switch wifi mode every key-push and switch
bluetooth mode every two key-push.

Signed-off-by: Ike Panhc <ike.pan@...onical.com>
---
 drivers/platform/x86/ideapad-laptop.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index bfdda33..e92ab14 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -328,6 +328,7 @@ static void ideapad_platform_exit(struct ideapad_private *priv)
 static const struct key_entry ideapad_keymap[] = {
 	{ KE_KEY, 0x06, { KEY_SWITCHVIDEOMODE } },
 	{ KE_KEY, 0x0D, { KEY_WLAN } },
+	{ KE_KEY, 0x0D, { KEY_BLUETOOTH } },
 	{ KE_END, 0 },
 };
 
@@ -379,7 +380,22 @@ static void __devexit ideapad_input_exit(struct ideapad_private *priv)
 static void ideapad_input_report(struct ideapad_private *priv,
 				 unsigned long scancode)
 {
-	sparse_keymap_report_event(priv->inputdev, scancode, 1, true);
+	static int bt_event_round;
+
+	if (scancode == 0x0D) {
+		bt_event_round++;
+		if (bt_event_round & 1) {
+			input_report_key(priv->inputdev, KEY_BLUETOOTH, 1);
+			input_sync(priv->inputdev);
+			input_report_key(priv->inputdev, KEY_BLUETOOTH, 0);
+			input_sync(priv->inputdev);
+		}
+		input_report_key(priv->inputdev, KEY_WLAN, 1);
+		input_sync(priv->inputdev);
+		input_report_key(priv->inputdev, KEY_WLAN, 0);
+		input_sync(priv->inputdev);
+	} else
+		sparse_keymap_report_event(priv->inputdev, scancode, 1, true);
 }
 
 /*
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ