Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: synaptics - use SERIO_OOB_DATA to handle trackstick buttons

Instead of using custom method of "passing" extended buttons from the
touchpad to trackstick, let's switch to the newly introduced SERIO_OOB_DATA
channel.

Tested-By: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+13 -14
+13 -13
drivers/input/mouse/synaptics.c
··· 597 597 return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; 598 598 } 599 599 600 - static void synaptics_pass_pt_packet(struct psmouse *psmouse, 601 - struct serio *ptport, 600 + static void synaptics_pass_pt_packet(struct serio *ptport, 602 601 unsigned char *packet) 603 602 { 604 - struct synaptics_data *priv = psmouse->private; 605 603 struct psmouse *child = serio_get_drvdata(ptport); 606 604 607 605 if (child && child->state == PSMOUSE_ACTIVATED) { 608 - serio_interrupt(ptport, packet[1] | priv->pt_buttons, 0); 606 + serio_interrupt(ptport, packet[1], 0); 609 607 serio_interrupt(ptport, packet[4], 0); 610 608 serio_interrupt(ptport, packet[5], 0); 611 609 if (child->pktsize == 4) ··· 854 856 struct input_dev *dev = psmouse->dev; 855 857 struct synaptics_data *priv = psmouse->private; 856 858 int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1; 857 - char buf[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 858 859 int i; 859 860 860 861 if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) ··· 880 883 * physically wired to the touchpad. Re-route them through 881 884 * the pass-through interface. 882 885 */ 883 - if (!priv->pt_port) 884 - return; 886 + if (priv->pt_port) { 887 + u8 pt_buttons; 885 888 886 - /* The trackstick expects at most 3 buttons */ 887 - priv->pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) | 888 - SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | 889 - SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; 889 + /* The trackstick expects at most 3 buttons */ 890 + pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) | 891 + SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | 892 + SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; 890 893 891 - synaptics_pass_pt_packet(psmouse, priv->pt_port, buf); 894 + serio_interrupt(priv->pt_port, 895 + PSMOUSE_OOB_EXTRA_BTNS, SERIO_OOB_DATA); 896 + serio_interrupt(priv->pt_port, pt_buttons, SERIO_OOB_DATA); 897 + } 892 898 } 893 899 894 900 static void synaptics_report_buttons(struct psmouse *psmouse, ··· 1132 1132 if (SYN_CAP_PASS_THROUGH(priv->capabilities) && 1133 1133 synaptics_is_pt_packet(psmouse->packet)) { 1134 1134 if (priv->pt_port) 1135 - synaptics_pass_pt_packet(psmouse, priv->pt_port, 1135 + synaptics_pass_pt_packet(priv->pt_port, 1136 1136 psmouse->packet); 1137 1137 } else 1138 1138 synaptics_process_packet(psmouse);
-1
drivers/input/mouse/synaptics.h
··· 183 183 bool disable_gesture; /* disable gestures */ 184 184 185 185 struct serio *pt_port; /* Pass-through serio port */ 186 - unsigned char pt_buttons; /* Pass-through buttons */ 187 186 188 187 /* 189 188 * Last received Advanced Gesture Mode (AGM) packet. An AGM packet