2015-02-06 20:04:51

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

Hi,

This is the second episode of the Lenovo 2015 party :)

Thanks to Andrew, we now have an idea within the driver of what are the extra
buttons aimed for, and the patch series looks cleaner.
Many thanks for your help.

I marked only patches 1/7, 2/7 and 3/7 as stable because they are really
stable fixes. Without the rest of the series, user-space can cope with the
kernel result, and so there is IMO no need to backport too many patches in
stable. I bet distributions will cherry-pick the rest of the series however.

Cheers,
Benjamin

Benjamin Tissoires (7):
Input: synaptics - fix middle button on Lenovo 2015 products
Input: synaptics - handle spurious release of trackstick buttons
Input: synaptics - do not retrieve the board id on old firmwares
Input: synaptics - retrieve the extended capabilities in query $10
Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
Input: synaptics - re-route tracksticks buttons on the Lenovo 2015
series
Input: synaptics - Remove X1 Carbon 3rd gen from the topbuttonpad list

drivers/input/mouse/synaptics.c | 129 +++++++++++++++++++++++++++++-----------
drivers/input/mouse/synaptics.h | 28 +++++++++
2 files changed, 122 insertions(+), 35 deletions(-)

--
2.1.0


2015-02-06 20:04:48

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 1/7] Input: synaptics - fix middle button on Lenovo 2015 products

From: Dmitry Torokhov <[email protected]>

On the X1 Carbon 3rd gen (with a 2015 broadwell cpu), the physical middle
button of the trackstick (attached to the touchpad serio device, of course)
seems to get lost.

Actually, the touchpads reports 3 extra buttons, which falls in the switch
below to the '2' case. Let's handle the case of odd numbers also, so that
the middle button finds its way back.

Cc: [email protected]
Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- used Dmitry's version
- fixed typo in synaptics_parse_ext_buttons() (buf[4] -> buf[5])

drivers/input/mouse/synaptics.c | 44 ++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 6506d22..3bd7032 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -653,6 +653,18 @@ static void synaptics_parse_agm(const unsigned char buf[],
}
}

+static void synaptics_parse_ext_buttons(const unsigned char buf[],
+ struct synaptics_data *priv,
+ struct synaptics_hw_state *hw)
+{
+ unsigned int ext_bits =
+ (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
+ unsigned int ext_mask = GENMASK(ext_bits - 1, 0);
+
+ hw->ext_buttons = buf[4] & ext_mask;
+ hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits;
+}
+
static bool is_forcepad;

static int synaptics_parse_hw_state(const unsigned char buf[],
@@ -739,28 +751,9 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
}

- if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) &&
+ if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 0 &&
((buf[0] ^ buf[3]) & 0x02)) {
- switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
- default:
- /*
- * if nExtBtn is greater than 8 it should be
- * considered invalid and treated as 0
- */
- break;
- case 8:
- hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0;
- hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0;
- case 6:
- hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0;
- hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0;
- case 4:
- hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0;
- hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0;
- case 2:
- hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0;
- hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0;
- }
+ synaptics_parse_ext_buttons(buf, priv, hw);
}
} else {
hw->x = (((buf[1] & 0x1f) << 8) | buf[2]);
@@ -827,6 +820,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
{
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
+ int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
int i;

input_report_key(dev, BTN_LEFT, hw->left);
@@ -840,8 +834,12 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
input_report_key(dev, BTN_BACK, hw->down);
}

- for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
- input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i));
+ for (i = 0; i < ext_bits; i++) {
+ input_report_key(dev, BTN_0 + 2 * i,
+ hw->ext_buttons & (1 << i));
+ input_report_key(dev, BTN_1 + 2 * i,
+ hw->ext_buttons & (1 << (i + ext_bits)));
+ }
}

static void synaptics_report_mt_data(struct psmouse *psmouse,
--
2.1.0

2015-02-06 20:04:52

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 2/7] Input: synaptics - handle spurious release of trackstick buttons

The Fimware 8.1 has a bug in which the extra buttons are only sent
when the ExtBit is 1.
This should be fixed in a future FW update which should have a bump
of the minor version.

Cc: [email protected]
Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- break out extra buttons reporting in its own function
- use firmware version to remove the spurious releases

drivers/input/mouse/synaptics.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 3bd7032..a033fc7 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -815,14 +815,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
}
}

-static void synaptics_report_buttons(struct psmouse *psmouse,
- const struct synaptics_hw_state *hw)
+static void synaptics_report_ext_buttons(struct psmouse *psmouse,
+ const struct synaptics_hw_state *hw)
{
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
int i;

+ if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
+ return;
+
+ /* bug in FW 8.1, buttons are reported only when ExtBit is 1 */
+ if ((SYN_ID_FULL(priv->identity) == 0x801) &&
+ !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
+ return;
+
+ for (i = 0; i < ext_bits; i++) {
+ input_report_key(dev, BTN_0 + 2 * i,
+ hw->ext_buttons & (1 << i));
+ input_report_key(dev, BTN_1 + 2 * i,
+ hw->ext_buttons & (1 << (i + ext_bits)));
+ }
+}
+
+static void synaptics_report_buttons(struct psmouse *psmouse,
+ const struct synaptics_hw_state *hw)
+{
+ struct input_dev *dev = psmouse->dev;
+ struct synaptics_data *priv = psmouse->private;
+
input_report_key(dev, BTN_LEFT, hw->left);
input_report_key(dev, BTN_RIGHT, hw->right);

@@ -834,12 +856,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
input_report_key(dev, BTN_BACK, hw->down);
}

- for (i = 0; i < ext_bits; i++) {
- input_report_key(dev, BTN_0 + 2 * i,
- hw->ext_buttons & (1 << i));
- input_report_key(dev, BTN_1 + 2 * i,
- hw->ext_buttons & (1 << (i + ext_bits)));
- }
+ synaptics_report_ext_buttons(psmouse, hw);
}

static void synaptics_report_mt_data(struct psmouse *psmouse,
--
2.1.0

2015-02-06 20:04:50

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 3/7] Input: synaptics - do not retrieve the board id on old firmwares

The board id capability has been added in firmware 7.5.

Cc: [email protected]
Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- brand new

drivers/input/mouse/synaptics.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index a033fc7..d7b2e93 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -253,6 +253,10 @@ static int synaptics_board_id(struct psmouse *psmouse)
struct synaptics_data *priv = psmouse->private;
unsigned char bid[3];

+ /* firmwares prior 7.5 have no board_id encoded */
+ if (SYN_ID_FULL(priv->identity) < 0x705)
+ return 0;
+
if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
return -1;
priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
--
2.1.0

2015-02-06 20:06:24

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 4/7] Input: synaptics - retrieve the extended capabilities in query $10

Newer Synaptics touchpads need to get information from the query $10.
Retrieve it if available.

Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- brand new

drivers/input/mouse/synaptics.c | 23 ++++++++++++++++++++---
drivers/input/mouse/synaptics.h | 23 +++++++++++++++++++++++
2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index d7b2e93..40e79b0 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -244,11 +244,24 @@ static int synaptics_model_id(struct psmouse *psmouse)
return 0;
}

+static int synaptics_more_extended_queries(struct psmouse *psmouse)
+{
+ struct synaptics_data *priv = psmouse->private;
+ unsigned char buf[3];
+
+ if (synaptics_send_cmd(psmouse, SYN_QUE_MEXT_CAPAB_10, buf))
+ return -1;
+
+ priv->ext_cap_10 = (buf[0]<<16) | (buf[1]<<8) | buf[2];
+
+ return 0;
+}
+
/*
- * Read the board id from the touchpad
+ * Read the board id and the "More Extended Queries" from the touchpad
* The board id is encoded in the "QUERY MODES" response
*/
-static int synaptics_board_id(struct psmouse *psmouse)
+static int synaptics_query_modes(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char bid[3];
@@ -260,6 +273,10 @@ static int synaptics_board_id(struct psmouse *psmouse)
if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
return -1;
priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
+
+ if (SYN_MEXT_CAP_BIT(bid[0]))
+ return synaptics_more_extended_queries(psmouse);
+
return 0;
}

@@ -452,7 +469,7 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
return -1;
if (synaptics_firmware_id(psmouse))
return -1;
- if (synaptics_board_id(psmouse))
+ if (synaptics_query_modes(psmouse))
return -1;
if (synaptics_capability(psmouse))
return -1;
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 6faf9bb..9723092 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -22,6 +22,7 @@
#define SYN_QUE_EXT_CAPAB_0C 0x0c
#define SYN_QUE_EXT_MAX_COORDS 0x0d
#define SYN_QUE_EXT_MIN_COORDS 0x0f
+#define SYN_QUE_MEXT_CAPAB_10 0x10

/* synatics modes */
#define SYN_BIT_ABSOLUTE_MODE (1 << 7)
@@ -53,6 +54,7 @@
#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
+#define SYN_MEXT_CAP_BIT(m) ((m) & (1 << 1))

/*
* The following describes response for the 0x0c query.
@@ -89,6 +91,26 @@
#define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400)
#define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800)

+/*
+ * The following descibes response for the 0x10 query.
+ *
+ * byte mask name meaning
+ * ---- ---- ------- ------------
+ * 1 0x01 ext buttons are stick buttons exported in the extended
+ * capability are actually meant to be used
+ * by the tracktick (pass-through).
+ * 1 0x02 SecurePad the touchpad is a SecurePad, so it
+ * contains a built-in fingerprint reader.
+ * 1 0xe0 more ext count how many more extented queries are
+ * available after this one.
+ * 2 0xff SecurePad width the width of the SecurePad fingerprint
+ * reader.
+ * 3 0xff SecurePad height the height of the SecurePad fingerprint
+ * reader.
+ */
+#define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000)
+#define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000)
+
/* synaptics modes query bits */
#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
#define SYN_MODE_RATE(m) ((m) & (1 << 6))
@@ -143,6 +165,7 @@ struct synaptics_data {
unsigned long int capabilities; /* Capabilities */
unsigned long int ext_cap; /* Extended Capabilities */
unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
+ unsigned long int ext_cap_10; /* Ext Caps from 0x10 query */
unsigned long int identity; /* Identification */
unsigned int x_res, y_res; /* X/Y resolution in units/mm */
unsigned int x_max, y_max; /* Max coordinates (from FW) */
--
2.1.0

2015-02-06 20:06:26

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 5/7] Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015

The 2015 series of the Lenovo thinkpads added back the hardware buttons
on top of the touchpad for the trackstick.

Unfortunately, Lenovo used the PNPIDs that are supposed to be
"5 buttons" touchpads, so the new laptops also have the
INPUT_PROP_TOPBUTTONPAD. Yay!

Instead of manually removing each of the new ones, or hoping that we
know all the current ones, we can consider that the PNPIDs list that
were given contains touchpads that have the trackstick buttons, either
physically wired to them, or emulated with the top software button
property.

Thanks to the extra buttons capability in query $10, we can reliably
detect the physical buttons from the software ones, and so we can
remove the TOPBUTTONPAD property even if it was declared as such.

Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- rely on SYN_CAP_EXT_BUTTONS_STICK to remove INPUT_PROP_TOPBUTTONPAD, not on
the BTN_0 heuristic

drivers/input/mouse/synaptics.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 40e79b0..79c4a87 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1209,7 +1209,8 @@ static void set_input_params(struct psmouse *psmouse,

if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
- if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
+ if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) &&
+ !SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10))
__set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
/* Clickpads report only left button */
__clear_bit(BTN_RIGHT, dev->keybit);
--
2.1.0

2015-02-06 20:05:59

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 6/7] Input: synaptics - re-route tracksticks buttons on the Lenovo 2015 series

The 2015 series of the Lenovo thinkpads added back the hardware buttons
on top of the touchpad for the trackstick.

Unfortunately, they are wired to the touchpad, and not the trackstick.
Thus, they are seen as extra buttons from the kernel point of view.

This leads to a problem in user space because extra buttons on synaptics
devices used to be used as scroll up/down buttons. So in the end, the
experience for the user is scroll events for buttons left and right
when using the trackstick. Yay!

Fortunatelly, the firmware advertizes such behavior in the extended
capability $10, and so we can re-route the buttons through the
pass-through interface.

Hallelujah-expressed-by: Peter Hutterer <[email protected]>
Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- forward only 3 extra buttons, not the whole array. The PS/2 base protocol
handles only 3 buttons, so giving more than 3 will mess up REL_X and REL_Y.
- rely on SYN_CAP_EXT_BUTTONS_STICK to know if the re-routing has to be put in
place or not

drivers/input/mouse/synaptics.c | 45 +++++++++++++++++++++++++++++++----------
drivers/input/mouse/synaptics.h | 5 +++++
2 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 79c4a87..dfe8235 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -585,18 +585,20 @@ static int synaptics_is_pt_packet(unsigned char *buf)
return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4;
}

-static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet)
+static void synaptics_pass_pt_packet(struct psmouse *psmouse,
+ struct serio *ptport, unsigned char *packet)
{
+ struct synaptics_data *priv = psmouse->private;
struct psmouse *child = serio_get_drvdata(ptport);

if (child && child->state == PSMOUSE_ACTIVATED) {
- serio_interrupt(ptport, packet[1], 0);
+ serio_interrupt(ptport, packet[1] | priv->pt_buttons, 0);
serio_interrupt(ptport, packet[4], 0);
serio_interrupt(ptport, packet[5], 0);
if (child->pktsize == 4)
serio_interrupt(ptport, packet[2], 0);
} else
- serio_interrupt(ptport, packet[1], 0);
+ serio_interrupt(ptport, packet[1] | priv->pt_buttons, 0);
}

static void synaptics_pt_activate(struct psmouse *psmouse)
@@ -842,6 +844,7 @@ static void synaptics_report_ext_buttons(struct psmouse *psmouse,
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
+ char buf[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
int i;

if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
@@ -852,12 +855,30 @@ static void synaptics_report_ext_buttons(struct psmouse *psmouse,
!((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
return;

- for (i = 0; i < ext_bits; i++) {
- input_report_key(dev, BTN_0 + 2 * i,
- hw->ext_buttons & (1 << i));
- input_report_key(dev, BTN_1 + 2 * i,
- hw->ext_buttons & (1 << (i + ext_bits)));
+ if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10)) {
+ for (i = 0; i < ext_bits; i++) {
+ input_report_key(dev, BTN_0 + 2 * i,
+ hw->ext_buttons & (1 << i));
+ input_report_key(dev, BTN_1 + 2 * i,
+ hw->ext_buttons & (1 << (i + ext_bits)));
+ }
+ return;
}
+
+ /*
+ * This generation of touchpads has the trackstick buttons
+ * physically wired to the touchpad. Re-route them through
+ * the pass-through interface.
+ */
+ if (!priv->pt_port)
+ return;
+
+ /* the trackstick expects at most 3 buttons */
+ priv->pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) |
+ SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 |
+ SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2;
+
+ synaptics_pass_pt_packet(psmouse, priv->pt_port, buf);
}

static void synaptics_report_buttons(struct psmouse *psmouse,
@@ -1098,7 +1119,8 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse)
if (SYN_CAP_PASS_THROUGH(priv->capabilities) &&
synaptics_is_pt_packet(psmouse->packet)) {
if (priv->pt_port)
- synaptics_pass_pt_packet(priv->pt_port, psmouse->packet);
+ synaptics_pass_pt_packet(psmouse, priv->pt_port,
+ psmouse->packet);
} else
synaptics_process_packet(psmouse);

@@ -1200,8 +1222,9 @@ static void set_input_params(struct psmouse *psmouse,
__set_bit(BTN_BACK, dev->keybit);
}

- for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
- __set_bit(BTN_0 + i, dev->keybit);
+ if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10))
+ for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
+ __set_bit(BTN_0 + i, dev->keybit);

__clear_bit(EV_REL, dev->evbit);
__clear_bit(REL_X, dev->relbit);
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 9723092..8102a72 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -111,6 +111,10 @@
#define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000)
#define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000)

+#define SYN_CAP_EXT_BUTTON_STICK_L(eb) (!!((eb) & 0x01))
+#define SYN_CAP_EXT_BUTTON_STICK_M(eb) (!!((eb) & 0x02))
+#define SYN_CAP_EXT_BUTTON_STICK_R(eb) (!!((eb) & 0x04))
+
/* synaptics modes query bits */
#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
#define SYN_MODE_RATE(m) ((m) & (1 << 6))
@@ -179,6 +183,7 @@ struct synaptics_data {
bool disable_gesture; /* disable gestures */

struct serio *pt_port; /* Pass-through serio port */
+ unsigned char pt_buttons; /* Pass-through buttons */

/*
* Last received Advanced Gesture Mode (AGM) packet. An AGM packet
--
2.1.0

2015-02-06 20:05:41

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH v2 7/7] Input: synaptics - Remove X1 Carbon 3rd gen from the topbuttonpad list

Lenovo decided to switch back to physical buttons for the trackstick
on their latest series. The PNPId list was provided before they reverted
back to physical buttons, so it contains the new models too.
We can know from the touchpad capabilities that the touchpad has physical
buttons, so removing the ids from the list is not mandatory. It is still
nicer to remove the wrong ids, so start by removing the X1 Carbon 3rd gen,
with the PNPId of LEN0048.

Signed-off-by: Benjamin Tissoires <[email protected]>
---

v2:
- no changes

drivers/input/mouse/synaptics.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index dfe8235..7267738 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -186,7 +186,6 @@ static const char * const topbuttonpad_pnp_ids[] = {
"LEN0045",
"LEN0046",
"LEN0047",
- "LEN0048",
"LEN0049",
"LEN2000",
"LEN2001", /* Edge E431 */
--
2.1.0

2015-02-17 03:23:07

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

On Fri, Feb 6, 2015 at 3:04 PM, Benjamin Tissoires
<[email protected]> wrote:
> Hi,
>
> This is the second episode of the Lenovo 2015 party :)
>
> Thanks to Andrew, we now have an idea within the driver of what are the extra
> buttons aimed for, and the patch series looks cleaner.
> Many thanks for your help.
>
> I marked only patches 1/7, 2/7 and 3/7 as stable because they are really
> stable fixes. Without the rest of the series, user-space can cope with the
> kernel result, and so there is IMO no need to backport too many patches in
> stable. I bet distributions will cherry-pick the rest of the series however.
>

Guys,

any chances we consider this for 3.20 (or whatever it will be numbered)?
I'd really like to see this accepted upstream in one way or one other
so we will prevent the mess we had to deal with last year.

Cheers,
Benjamin

> Benjamin Tissoires (7):
> Input: synaptics - fix middle button on Lenovo 2015 products
> Input: synaptics - handle spurious release of trackstick buttons
> Input: synaptics - do not retrieve the board id on old firmwares
> Input: synaptics - retrieve the extended capabilities in query $10
> Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
> Input: synaptics - re-route tracksticks buttons on the Lenovo 2015
> series
> Input: synaptics - Remove X1 Carbon 3rd gen from the topbuttonpad list
>
> drivers/input/mouse/synaptics.c | 129 +++++++++++++++++++++++++++++-----------
> drivers/input/mouse/synaptics.h | 28 +++++++++
> 2 files changed, 122 insertions(+), 35 deletions(-)
>
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2015-02-21 23:59:12

by Michael Mullin

[permalink] [raw]
Subject: re: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I have applied Benjamin's Lenovo touchpad patches onto
the 3.19 kernel at sha of 18a8d49973667aa016e68826eeb374788b7c63b0
(Feb 21).

In conjunction with synaptic touchpad application found at
http://cgit.freedesktop.org/xorg/driver/xf86-input-synaptics/
(sha of 37d34f0356cc556dd8a49ec5d1ed64d49417a9b2 jan 15),
and with the additional configuration file

# cat /etc/X11/xorg.conf.d/20-lenovo-touchpad.conf
Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc.
Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with
TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"
MatchDevicePath "/dev/input/event*"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "false"

both my trackpad and touchpoint (and the left and right touchpoint
buttons, along with the middle click and middle scroll)
work as expected on my Lenovo X1 Carbon 3rd Gen.

I am sure that all owners of the new Lenovo laptops would
appreciate these patches going into the 3.20 kernel

Thank you
Michael Mullin

2015-02-25 14:36:09

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

On Mon, Feb 16, 2015 at 10:23 PM, Benjamin Tissoires
<[email protected]> wrote:
> On Fri, Feb 6, 2015 at 3:04 PM, Benjamin Tissoires
> <[email protected]> wrote:
>> Hi,
>>
>> This is the second episode of the Lenovo 2015 party :)
>>
>> Thanks to Andrew, we now have an idea within the driver of what are the extra
>> buttons aimed for, and the patch series looks cleaner.
>> Many thanks for your help.
>>
>> I marked only patches 1/7, 2/7 and 3/7 as stable because they are really
>> stable fixes. Without the rest of the series, user-space can cope with the
>> kernel result, and so there is IMO no need to backport too many patches in
>> stable. I bet distributions will cherry-pick the rest of the series however.
>>
>
> Guys,
>
> any chances we consider this for 3.20 (or whatever it will be numbered)?
> I'd really like to see this accepted upstream in one way or one other
> so we will prevent the mess we had to deal with last year.
>

Hans, Dmitry,

well, it's been 3 weeks since I received the loaner I have to support
these touchpads. I will have to return it next week or the week after
at most. That means that I will not be able to conduct more tests at
that point.
Can I ask you to please review the series?

Sorry for pushing, but I am running out of time and I'd like to be
able to include the fixes in RHEL/Fedora too.

Cheers,
Benjamin

>> Benjamin Tissoires (7):
>> Input: synaptics - fix middle button on Lenovo 2015 products
>> Input: synaptics - handle spurious release of trackstick buttons
>> Input: synaptics - do not retrieve the board id on old firmwares
>> Input: synaptics - retrieve the extended capabilities in query $10
>> Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
>> Input: synaptics - re-route tracksticks buttons on the Lenovo 2015
>> series
>> Input: synaptics - Remove X1 Carbon 3rd gen from the topbuttonpad list
>>
>> drivers/input/mouse/synaptics.c | 129 +++++++++++++++++++++++++++++-----------
>> drivers/input/mouse/synaptics.h | 28 +++++++++
>> 2 files changed, 122 insertions(+), 35 deletions(-)
>>
>> --
>> 2.1.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/

2015-02-25 14:58:29

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

Hi,

On 25-02-15 15:36, Benjamin Tissoires wrote:
> On Mon, Feb 16, 2015 at 10:23 PM, Benjamin Tissoires
> <[email protected]> wrote:
>> On Fri, Feb 6, 2015 at 3:04 PM, Benjamin Tissoires
>> <[email protected]> wrote:
>>> Hi,
>>>
>>> This is the second episode of the Lenovo 2015 party :)
>>>
>>> Thanks to Andrew, we now have an idea within the driver of what are the extra
>>> buttons aimed for, and the patch series looks cleaner.
>>> Many thanks for your help.
>>>
>>> I marked only patches 1/7, 2/7 and 3/7 as stable because they are really
>>> stable fixes. Without the rest of the series, user-space can cope with the
>>> kernel result, and so there is IMO no need to backport too many patches in
>>> stable. I bet distributions will cherry-pick the rest of the series however.
>>>
>>
>> Guys,
>>
>> any chances we consider this for 3.20 (or whatever it will be numbered)?
>> I'd really like to see this accepted upstream in one way or one other
>> so we will prevent the mess we had to deal with last year.
>>
>
> Hans, Dmitry,
>
> well, it's been 3 weeks since I received the loaner I have to support
> these touchpads. I will have to return it next week or the week after
> at most. That means that I will not be able to conduct more tests at
> that point.
> Can I ask you to please review the series?

Ah, sorry I missed you did a v2 (I did review v1).

Series looks good to me and is:

Acked-by: Hans de Goede <[email protected]>

Regards,

Hans

>
> Sorry for pushing, but I am running out of time and I'd like to be
> able to include the fixes in RHEL/Fedora too.
>
> Cheers,
> Benjamin
>
>>> Benjamin Tissoires (7):
>>> Input: synaptics - fix middle button on Lenovo 2015 products
>>> Input: synaptics - handle spurious release of trackstick buttons
>>> Input: synaptics - do not retrieve the board id on old firmwares
>>> Input: synaptics - retrieve the extended capabilities in query $10
>>> Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
>>> Input: synaptics - re-route tracksticks buttons on the Lenovo 2015
>>> series
>>> Input: synaptics - Remove X1 Carbon 3rd gen from the topbuttonpad list
>>>
>>> drivers/input/mouse/synaptics.c | 129 +++++++++++++++++++++++++++++-----------
>>> drivers/input/mouse/synaptics.h | 28 +++++++++
>>> 2 files changed, 122 insertions(+), 35 deletions(-)
>>>
>>> --
>>> 2.1.0
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to [email protected]
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at http://www.tux.org/lkml/

2015-04-09 13:00:16

by Yves-Alexis Perez

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

On jeu., 2015-03-19 at 11:58 -0400, Benjamin Tissoires wrote:
> >
> > Am I right? Thanks for the information, I'll also try to point our
> > kernel maintainers to that thread and ask them if it's possible to
> > backport them to the 3.16 kernel for Jessie.
>
> Yes, please do. For the record, they are already in Fedora.

I've opened a Debian bug [1] to request the patch serie to be backported
to the 3.16 kernel used by Debian and Ubuntu, but Ben Hutchings asked
for more information than just the merge commit id.

The merge contains the following commits:

09d042a2eb90ee2c86d80c48ad096ae3f5776cef Revert "Input: synaptics - use dmax in input_mt_assign_slots"
6067fe5e0bf29f525561c8281d01011cfc9ebbd4 Merge branch 'synaptics' into for-linus
8f004f3f4daf5dc98dc78f8e62497ad834053855 Input: synaptics - remove X250 from the topbuttonpad list
860e6f7fcbe5653ec4e394f9ee335f2032398beb Input: synaptics - remove X1 Carbon 3rd gen from the topbuttonpad list
cdd9dc195916ef5644cfac079094c3c1d1616e4c Input: synaptics - re-route tracksticks buttons on the Lenovo 2015 series
3adde1f59195df2965f632e22b31f97fb371612f Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
06aa374bc70468b517dd36b95c48c8f391c08a27 Input: synaptics - retrieve the extended capabilities in query $10
b57a7128be24062b5b5b26032b7cd58f1651547e Input: synaptics - do not retrieve the board id on old firmwares
ebc80840b850db72f7ae84fbcf77630ae5409629 Input: synaptics - handle spurious release of trackstick buttons
dc5465dc8a6d5cae8a0e1d8826bdcb2e4cb261ab Input: synaptics - fix middle button on Lenovo 2015 products
02e07492cdfae9c86e3bd21c0beec88dbcc1e9e8 Input: synaptics - skip quirks when post-2013 dimensions
5b3089ddb540401c1ad2e385a03d7e89ff954585 Input: synaptics - support min/max board id in min_max_pnpid_table
b05f4d1c332a22f98c037fa64f249aa30877adaf Input: synaptics - remove obsolete min/max quirk for X240
ac097930f0730a9b777737de2b51e0fc49d2be7a Input: synaptics - query min dimensions for fw v8.1
9aff65982d0f58a78a27769fba7e97bc937b2593 Input: synaptics - log queried and quirked dimension values
8b04baba10b007f8b6c245a50be73cf09cc3a414 Input: synaptics - split synaptics_resolution(), query first

Are they all needed or is there a more minimal but still working list?

Thanks for your work and regards.

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780862
--
Yves-Alexis

2015-04-09 13:56:33

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] New Lenovos 2015 touchpads: party time!

On Apr 09 2015 or thereabouts, Yves-Alexis Perez wrote:
> On jeu., 2015-03-19 at 11:58 -0400, Benjamin Tissoires wrote:
> > >
> > > Am I right? Thanks for the information, I'll also try to point our
> > > kernel maintainers to that thread and ask them if it's possible to
> > > backport them to the 3.16 kernel for Jessie.
> >
> > Yes, please do. For the record, they are already in Fedora.
>
> I've opened a Debian bug [1] to request the patch serie to be backported
> to the 3.16 kernel used by Debian and Ubuntu, but Ben Hutchings asked
> for more information than just the merge commit id.
>
> The merge contains the following commits:
>
> 09d042a2eb90ee2c86d80c48ad096ae3f5776cef Revert "Input: synaptics - use dmax in input_mt_assign_slots"
> 6067fe5e0bf29f525561c8281d01011cfc9ebbd4 Merge branch 'synaptics' into for-linus
> 8f004f3f4daf5dc98dc78f8e62497ad834053855 Input: synaptics - remove X250 from the topbuttonpad list
> 860e6f7fcbe5653ec4e394f9ee335f2032398beb Input: synaptics - remove X1 Carbon 3rd gen from the topbuttonpad list
> cdd9dc195916ef5644cfac079094c3c1d1616e4c Input: synaptics - re-route tracksticks buttons on the Lenovo 2015 series
> 3adde1f59195df2965f632e22b31f97fb371612f Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
> 06aa374bc70468b517dd36b95c48c8f391c08a27 Input: synaptics - retrieve the extended capabilities in query $10
> b57a7128be24062b5b5b26032b7cd58f1651547e Input: synaptics - do not retrieve the board id on old firmwares
> ebc80840b850db72f7ae84fbcf77630ae5409629 Input: synaptics - handle spurious release of trackstick buttons
> dc5465dc8a6d5cae8a0e1d8826bdcb2e4cb261ab Input: synaptics - fix middle button on Lenovo 2015 products
> 02e07492cdfae9c86e3bd21c0beec88dbcc1e9e8 Input: synaptics - skip quirks when post-2013 dimensions
> 5b3089ddb540401c1ad2e385a03d7e89ff954585 Input: synaptics - support min/max board id in min_max_pnpid_table
> b05f4d1c332a22f98c037fa64f249aa30877adaf Input: synaptics - remove obsolete min/max quirk for X240
> ac097930f0730a9b777737de2b51e0fc49d2be7a Input: synaptics - query min dimensions for fw v8.1
> 9aff65982d0f58a78a27769fba7e97bc937b2593 Input: synaptics - log queried and quirked dimension values
> 8b04baba10b007f8b6c245a50be73cf09cc3a414 Input: synaptics - split synaptics_resolution(), query first
>
> Are they all needed or is there a more minimal but still working list?

8b04baba...b57a7128 are marked as stable@ and will/should be backported
in debian too. This leaves us the minimum patches to backport in
addition to those 9:
06aa374bc70468b517dd36b95c48c8f391c08a27 Input: synaptics - retrieve the extended capabilities in query $10
3adde1f59195df2965f632e22b31f97fb371612f Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
cdd9dc195916ef5644cfac079094c3c1d1616e4c Input: synaptics - re-route tracksticks buttons on the Lenovo 2015 series

09d042a2eb (Revert "Input: synaptics - use dmax in
input_mt_assign_slots") is only required if the reverted commit is
already in the debian tree, which I doubt given that it was introduced
in v3.19 or v4.0.

Hope this helps.

Cheers,
Benjamin

>
> Thanks for your work and regards.
>
> [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780862
> --
> Yves-Alexis