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

Re: One-Button iMac mouse



> Matteo Bigoi - Bigo! wrote:
> > I've rewritten this patch for 2.6!
> 
> Hello Bigo!
> 
> Great, but it does not work for me :-(
> 
> I have seen that you also added the option ADB_TRACKPAD_ABSOLUTE, so I
> assume that you have an ADB trackpad. My iBook G4 (PowerBook6,7) has a USB
> trackpad and this may be the cause why it does not work for me.
> 

I've seen that this patch works together with the one written by Loca
Bigliard1 for the adb touchpad [1]... I'm not an expert about C and
kernel but I think I've the solution ;-)
Try the patch attached in a vanilla kernel..
The documentation is in the help during a make menuconfig!

> However, I also tried with an external USB mouse, this also had no effect.
> 
> cu, Magnum
> 
[1] http://www.artha.org/shammash/ppc/adb_syn/ 

Ciao

		Bigo!

-- 
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'

------------------------------------------------------
           Registered Linux User # 365044
      http://dust.homelinux.org/~bigo/index.html
    Please don't send me any Micro$oft attachments!
------------------------------------------------------
		    
--- linux-2.6.16.11.ORIG/drivers/input/input.c	2006-04-24 22:20:24.000000000 +0200
+++ linux-2.6.16.11/drivers/input/input.c	2006-04-26 10:41:49.000000000 +0200
@@ -47,6 +47,10 @@ static LIST_HEAD(input_handler_list);
 
 static struct input_handler *input_table[8];
 
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+extern int mac_hid_mouse_emulate_buttons(int,int,int);
+#endif
+
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
 {
 	struct input_handle *handle;
@@ -72,6 +76,12 @@ void input_event(struct input_dev *dev, 
 			break;
 
 		case EV_KEY:
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+			if (mac_hid_mouse_emulate_buttons(2, code, value))
+				code = BTN_RIGHT;
+			if (mac_hid_mouse_emulate_buttons(3, code, value))
+				code = BTN_MIDDLE;
+#endif
 
 			if (code > KEY_MAX || !test_bit(code, dev->keybit) || !!test_bit(code, dev->key) == value)
 				return;
--- linux-2.6.16.11.ORIG/drivers/macintosh/mac_hid.c	2006-04-24 22:20:24.000000000 +0200
+++ linux-2.6.16.11/drivers/macintosh/mac_hid.c	2006-04-26 10:41:49.000000000 +0200
@@ -21,7 +21,11 @@ static int emumousebtn_input_register(vo
 static int mouse_emulate_buttons = 0;
 static int mouse_button2_keycode = KEY_RIGHTCTRL;	/* right control key */
 static int mouse_button3_keycode = KEY_RIGHTALT;	/* right option key */
+static int rclick_key_modifier	 = 0;			/* disabled */
+static int cclick_key_modifier	 = 0;			/* disabled */
 static int mouse_last_keycode = 0;
+static int rclick_key_modifier_down = 0;
+static int cclick_key_modifier_down = 0;
 
 #if defined(CONFIG_SYSCTL)
 /* file(s) in /proc/sys/dev/mac_hid */
@@ -50,6 +54,22 @@ ctl_table mac_hid_files[] = {
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name       = DEV_MAC_HID_RCLICK_KEY_MODIFIER,
+		.procname       = "rclick_key_modifier",
+		.data           = &rclick_key_modifier,
+		.maxlen         = sizeof(int),
+                .mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
+	{
+		.ctl_name       = DEV_MAC_HID_CCLICK_KEY_MODIFIER,
+		.procname       = "cclick_key_modifier",
+		.data           = &cclick_key_modifier,
+		.maxlen         = sizeof(int),
+                .mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
 	{ .ctl_name = 0 }
 };
 
@@ -98,6 +118,26 @@ int mac_hid_mouse_emulate_buttons(int ca
 			}
 			mouse_last_keycode = down ? keycode : 0;
 		}
+		if (rclick_key_modifier 
+		    && keycode == rclick_key_modifier)
+			rclick_key_modifier_down = down;
+
+		break;
+	case 2:
+		/* Called from input.c */
+		if (keycode == BTN_LEFT && rclick_key_modifier && rclick_key_modifier_down)
+			return 1;
+
+		if (cclick_key_modifier 
+		    && keycode == cclick_key_modifier)
+			cclick_key_modifier_down = down;
+
+		break;
+	case 3:
+		/* Called from input.c */
+		if (keycode == BTN_LEFT && cclick_key_modifier && cclick_key_modifier_down)
+			return 1;
+
 		break;
 	}
 	return 0;
--- linux-2.6.16.11.ORIG/include/linux/sysctl.h	2006-04-24 22:20:24.000000000 +0200
+++ linux-2.6.16.11/include/linux/sysctl.h	2006-04-26 10:41:49.000000000 +0200
@@ -843,7 +843,11 @@ enum {
 	DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
 	DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
 	DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
-	DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
+	DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6,
+	DEV_MAC_HID_RCLICK_KEY_MODIFIER=7,
+	DEV_MAC_HID_CCLICK_KEY_MODIFIER=8
+
+
 };
 
 /* /proc/sys/dev/scsi */
--- linux-2.6.16.11.ORIG/drivers/macintosh/Kconfig	2006-04-24 22:20:24.000000000 +0200
+++ linux-2.6.16.11/drivers/macintosh/Kconfig	2006-04-26 10:43:51.000000000 +0200
@@ -144,7 +144,17 @@ config MAC_EMUMOUSEBTN
 	  /proc/sys/dev/mac_hid/mouse_button_emulation
 	  /proc/sys/dev/mac_hid/mouse_button2_keycode
 	  /proc/sys/dev/mac_hid/mouse_button3_keycode
-
+	  /proc/sys/dev/mac_hid/rclick_key_modifier
+	  /proc/sys/dev/mac_hid/cclick_key_modifier
+	                 
+	  rclick_key_modifier allows the kernel to handle "Key+LClick" as a 
+	  right-click. It's disabled by default. Echo a keycode to it to 
+	  enable it.
+
+	  cclick_key_modifier allows the kernel to handle "Key+LClick" as a
+	  middle-click. It's disabled by default. Echo a keycode to it to
+	  enable it.
+	  
 	  If you have an Apple machine with a 1-button mouse, say Y here.
 
 config THERM_WINDTUNNEL

Attachment: signature.asc
Description: Digital signature


Reply to: