+ input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update.patch added to -mm tree

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

 



The patch titled

     input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick update

has been added to the -mm tree.  Its filename is

     input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick update
From: Michael Hanselmann <linux-kernel@xxxxxxxxx>


Here's a small update with user-defineable keycodes.

Signed-off-by: Michael Hanselmann <linux-kernel@xxxxxxxxx>
Cc: Dmitry Torokhov <dtor_core@xxxxxxxxxxxxx>
Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/macintosh/Kconfig   |    5 ++++-
 drivers/macintosh/mac_hid.c |   34 ++++++++++++++++++++++++++--------
 include/linux/sysctl.h      |    2 ++
 3 files changed, 32 insertions(+), 9 deletions(-)

diff -puN drivers/macintosh/Kconfig~input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update drivers/macintosh/Kconfig
--- devel/drivers/macintosh/Kconfig~input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update	2006-05-25 14:12:39.000000000 -0700
+++ devel-akpm/drivers/macintosh/Kconfig	2006-05-25 14:12:39.000000000 -0700
@@ -145,9 +145,12 @@ config MAC_EMUMOUSEBTN
 	  /proc/sys/dev/mac_hid/mouse_button2_keycode
 	  /proc/sys/dev/mac_hid/mouse_button3_keycode
 	  /proc/sys/dev/mac_hid/key_click
+	  /proc/sys/dev/mac_hid/key_click_button2_keycode
+	  /proc/sys/dev/mac_hid/key_click_button3_keycode
 
 	  When key_click is enabled by writing a value other than 0 into it,
-	  Ctrl+Click is for right click and Command+Click for middle click.
+	  Ctrl+Click is for right click and Command+Click for middle click by
+	  default. You can change the keycodes using the respective settings.
 
 	  If you have an Apple machine with a 1-button mouse, say Y here.
 
diff -puN drivers/macintosh/mac_hid.c~input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update drivers/macintosh/mac_hid.c
--- devel/drivers/macintosh/mac_hid.c~input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update	2006-05-25 14:12:39.000000000 -0700
+++ devel-akpm/drivers/macintosh/mac_hid.c	2006-05-25 14:12:39.000000000 -0700
@@ -20,6 +20,8 @@ static int mouse_emulate_buttons;
 static int mouse_button2_keycode = KEY_RIGHTCTRL;	/* right control key */
 static int mouse_button3_keycode = KEY_RIGHTALT;	/* right option key */
 static int key_click;
+static int key_click_button2_keycode = KEY_LEFTCTRL;
+static int key_click_button3_keycode = KEY_LEFTMETA;
 static int key_click_active;
 static int key_click_button;
 static int key_pressed;
@@ -60,6 +62,22 @@ ctl_table mac_hid_files[] = {
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= DEV_MAC_HID_KEY_CLICK_BUTTON2_KEYCODE,
+		.procname	= "key_click_button2_keycode",
+		.data		= &key_click_button2_keycode,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= DEV_MAC_HID_KEY_CLICK_BUTTON3_KEYCODE,
+		.procname	= "key_click_button3_keycode",
+		.data		= &key_click_button3_keycode,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
 	{ .ctl_name = 0 }
 };
 
@@ -98,8 +116,8 @@ int mac_hid_mouse_emulate_buttons(unsign
 		return 0;
 
 	if (key_click &&
-	    (keycode == KEY_LEFTCTRL || keycode == KEY_RIGHTCTRL ||
-	     keycode == KEY_LEFTMETA || keycode == KEY_RIGHTMETA)) {
+	    (keycode == key_click_button2_keycode ||
+	     keycode == key_click_button3_keycode)) {
 		if (down && !key_pressed && !key_click_active)
 			key_pressed = keycode;
 		else if (!down && keycode == key_pressed) {
@@ -142,8 +160,7 @@ int mac_hid_mouse_click(unsigned int cod
 		input_report_key(emumousebtn, key_click_active, 0);
 		input_sync(emumousebtn);
 
-		if (key_click_active == KEY_LEFTMETA ||
-		    key_click_active == KEY_RIGHTMETA)
+		if (key_click_active == key_click_button3_keycode)
 			code = BTN_MIDDLE;
 		else
 			code = BTN_RIGHT;
@@ -175,6 +192,8 @@ int mac_hid_repeat_key(unsigned int keyc
 
 int __init mac_hid_init(void)
 {
+	int i;
+
 	emumousebtn = input_allocate_device();
 	if (!emumousebtn)
 		return -ENOMEM;
@@ -189,10 +208,9 @@ int __init mac_hid_init(void)
 	emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
 	emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y);
 
-	set_bit(KEY_LEFTCTRL, emumousebtn->keybit);
-	set_bit(KEY_RIGHTCTRL, emumousebtn->keybit);
-	set_bit(KEY_LEFTMETA, emumousebtn->keybit);
-	set_bit(KEY_RIGHTMETA, emumousebtn->keybit);
+	/* We do not know the key codes the user will assign for key+click */
+	for (i = 1; i < KEY_UNKNOWN; ++i)
+		set_bit(i, emumousebtn->keybit);
 
 	input_register_device(emumousebtn);
 
diff -puN include/linux/sysctl.h~input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update include/linux/sysctl.h
--- devel/include/linux/sysctl.h~input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update	2006-05-25 14:12:39.000000000 -0700
+++ devel-akpm/include/linux/sysctl.h	2006-05-25 14:12:39.000000000 -0700
@@ -873,6 +873,8 @@ enum {
 	DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
 	DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6,
 	DEV_MAC_HID_KEY_CLICK=7,
+	DEV_MAC_HID_KEY_CLICK_BUTTON2_KEYCODE=8,
+	DEV_MAC_HID_KEY_CLICK_BUTTON3_KEYCODE=9,
 };
 
 /* /proc/sys/dev/scsi */
_

Patches currently in -mm which might be from linux-kernel@xxxxxxxxx are

input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick.patch
input-powermac-cleanup-of-mac_hid-and-support-for-ctrlclick-and-commandclick-update.patch
rewritten-backlight-infrastructure-for-portable-apple-computers.patch
rewritten-backlight-infrastructure-for-portable-apple-computers-fix.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux