
From: Dmitry Torokhov <dtor_core@ameritech.net>

support Synaptics touchpads that have separate middle button


---

 25-akpm/drivers/input/mouse/synaptics.c |   11 +++++++++++
 25-akpm/drivers/input/mouse/synaptics.h |    2 ++
 2 files changed, 13 insertions(+)

diff -puN drivers/input/mouse/synaptics.c~new-set-of-input-patches-synaptics-middle-button-support drivers/input/mouse/synaptics.c
--- 25/drivers/input/mouse/synaptics.c~new-set-of-input-patches-synaptics-middle-button-support	2004-04-21 00:22:23.845410232 -0700
+++ 25-akpm/drivers/input/mouse/synaptics.c	2004-04-21 00:22:23.850409472 -0700
@@ -184,6 +184,8 @@ static void print_ident(struct synaptics
 		if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
 			printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n",
 			       (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)));
+		if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+			printk(KERN_INFO " -> middle button\n");
 		if (SYN_CAP_FOUR_BUTTON(priv->capabilities))
 			printk(KERN_INFO " -> four buttons\n");
 		if (SYN_CAP_MULTIFINGER(priv->capabilities))
@@ -342,6 +344,9 @@ static void set_input_params(struct inpu
 	set_bit(BTN_LEFT, dev->keybit);
 	set_bit(BTN_RIGHT, dev->keybit);
 
+	if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+		set_bit(BTN_MIDDLE, dev->keybit);
+
 	if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
 		set_bit(BTN_FORWARD, dev->keybit);
 		set_bit(BTN_BACK, dev->keybit);
@@ -470,6 +475,9 @@ static void synaptics_parse_hw_state(uns
 		hw->left  = (buf[0] & 0x01) ? 1 : 0;
 		hw->right = (buf[0] & 0x02) ? 1 : 0;
 
+		if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+			hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
+
 		if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
 			hw->up   = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
 			hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
@@ -569,6 +577,9 @@ static void synaptics_process_packet(str
 	input_report_key(dev, BTN_LEFT, hw.left);
 	input_report_key(dev, BTN_RIGHT, hw.right);
 
+	if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+		input_report_key(dev, BTN_MIDDLE, hw.middle);
+
 	if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
 		input_report_key(dev, BTN_FORWARD, hw.up);
 		input_report_key(dev, BTN_BACK, hw.down);
diff -puN drivers/input/mouse/synaptics.h~new-set-of-input-patches-synaptics-middle-button-support drivers/input/mouse/synaptics.h
--- 25/drivers/input/mouse/synaptics.h~new-set-of-input-patches-synaptics-middle-button-support	2004-04-21 00:22:23.846410080 -0700
+++ 25-akpm/drivers/input/mouse/synaptics.h	2004-04-21 00:22:23.850409472 -0700
@@ -44,6 +44,7 @@ extern void synaptics_reset(struct psmou
 
 /* synaptics capability bits */
 #define SYN_CAP_EXTENDED(c)		((c) & (1 << 23))
+#define SYN_CAP_MIDDLE_BUTTON(c)	((c) & (1 << 18))
 #define SYN_CAP_PASS_THROUGH(c)		((c) & (1 << 7))
 #define SYN_CAP_SLEEP(c)		((c) & (1 << 4))
 #define SYN_CAP_FOUR_BUTTON(c)		((c) & (1 << 3))
@@ -88,6 +89,7 @@ struct synaptics_hw_state {
 	int w;
 	unsigned int left:1;
 	unsigned int right:1;
+	unsigned int middle:1;
 	unsigned int up:1;
 	unsigned int down:1;
 	unsigned char ext_buttons;

_
