Commit 3cb6d7c8 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Vojtech Pavlik

Input: support Synaptics touchpads that have separate middle button

parent 1a9e9e7c
...@@ -184,6 +184,8 @@ static void print_ident(struct synaptics_data *priv) ...@@ -184,6 +184,8 @@ static void print_ident(struct synaptics_data *priv)
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n", printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n",
(int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))); (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)) if (SYN_CAP_FOUR_BUTTON(priv->capabilities))
printk(KERN_INFO " -> four buttons\n"); printk(KERN_INFO " -> four buttons\n");
if (SYN_CAP_MULTIFINGER(priv->capabilities)) if (SYN_CAP_MULTIFINGER(priv->capabilities))
...@@ -342,6 +344,9 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) ...@@ -342,6 +344,9 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
set_bit(BTN_LEFT, dev->keybit); set_bit(BTN_LEFT, dev->keybit);
set_bit(BTN_RIGHT, 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)) { if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
set_bit(BTN_FORWARD, dev->keybit); set_bit(BTN_FORWARD, dev->keybit);
set_bit(BTN_BACK, dev->keybit); set_bit(BTN_BACK, dev->keybit);
...@@ -470,6 +475,9 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data ...@@ -470,6 +475,9 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
hw->left = (buf[0] & 0x01) ? 1 : 0; hw->left = (buf[0] & 0x01) ? 1 : 0;
hw->right = (buf[0] & 0x02) ? 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)) { if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
...@@ -569,6 +577,9 @@ static void synaptics_process_packet(struct psmouse *psmouse) ...@@ -569,6 +577,9 @@ static void synaptics_process_packet(struct psmouse *psmouse)
input_report_key(dev, BTN_LEFT, hw.left); input_report_key(dev, BTN_LEFT, hw.left);
input_report_key(dev, BTN_RIGHT, hw.right); 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)) { if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
input_report_key(dev, BTN_FORWARD, hw.up); input_report_key(dev, BTN_FORWARD, hw.up);
input_report_key(dev, BTN_BACK, hw.down); input_report_key(dev, BTN_BACK, hw.down);
......
...@@ -44,6 +44,7 @@ extern void synaptics_reset(struct psmouse *psmouse); ...@@ -44,6 +44,7 @@ extern void synaptics_reset(struct psmouse *psmouse);
/* synaptics capability bits */ /* synaptics capability bits */
#define SYN_CAP_EXTENDED(c) ((c) & (1 << 23)) #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_PASS_THROUGH(c) ((c) & (1 << 7))
#define SYN_CAP_SLEEP(c) ((c) & (1 << 4)) #define SYN_CAP_SLEEP(c) ((c) & (1 << 4))
#define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3)) #define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3))
...@@ -88,6 +89,7 @@ struct synaptics_hw_state { ...@@ -88,6 +89,7 @@ struct synaptics_hw_state {
int w; int w;
unsigned int left:1; unsigned int left:1;
unsigned int right:1; unsigned int right:1;
unsigned int middle:1;
unsigned int up:1; unsigned int up:1;
unsigned int down:1; unsigned int down:1;
unsigned char ext_buttons; unsigned char ext_buttons;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment