[PATCH] Input: Lenovo S10-3t's touchpad support

Previous thread: Mr Cheung. by Eric on Saturday, November 27, 2010 - 5:28 am. (1 message)

Next thread: [RFC 0/9] Change the copyright info. by Justin P. Mattock on Friday, November 26, 2010 - 11:21 pm. (21 messages)
From: Yan Li
Date: Friday, November 26, 2010 - 8:56 pm

This is for kernel bug #18122 and MeeGo bug #4807.

Current code detects Clickpad by checking the 8 and 20 bits of 0x0c
cap. However, the code returns true if either of those bits is 1,
while it should only return true when both are 1. This has lead to the
touchpad on Lenovo S10-3t be mistakenly recognized as Clickpad and its
BTN_LEFT and BTN_RIGHT blocked.

So far we've found that the S10-3ts are shipped with two slightly
different models of touchpads, of which the 0x0c cap is either
0x5a0400 or 0x4a0500. They are not Clickpad and return BTN_LEFT and
BTN_RIGHT normally.

This patch fixed this issue by checking both sign bits are 1. Tested
on my S10-3t and worked well.

Signed-off-by: Yan Li <yan.i.li@intel.com>
---
 drivers/input/mouse/synaptics.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 613a365..0c1083c 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -51,7 +51,11 @@
 #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_CAP_CLICKPAD(ex0c)		((ex0c) & 0x100100)
+/* Synaptics' ClickPad has both 8th and 20th bits set in the 0x0c
+ * cap. Other models (like those shipped with Lenovo S10-3t) may have
+ * either one of them set but not both, and they are *not* ClickPad
+ * although they look similar. */
+#define SYN_CAP_CLICKPAD(ex0c)		((ex0c) & 0x100100 == 0x100100)
 #define SYN_CAP_MAX_DIMENSIONS(ex0c)	((ex0c) & 0x020000)
 
 /* synaptics modes query bits */
-- 
1.7.2.3


-- 
Best regards,
Li, Yan

MeeGo Team, Opensource Technology Center, SSG, Intel
Office tel.: +86-10-82171695 (inet: 8-758-1695)
OpenPGP key: 5C6C31EF
IRC: yanli on network irc.freenode.net
--

From: Dmitry Torokhov
Date: Saturday, November 27, 2010 - 12:55 am

Hi Yan,



Moreover, Takashi's HP returns 0x5a 0x04 0x00 in response to 0x0c query
and _is_ a clickpad.


In C comparison operators have higher precedence than bitwise ones. Your
expression reduces to ((ex0c) & 1) which is not correct. The proper
expression would be:

#define SYN_CAP_CLICKPAD(ex0c)		(((ex0c) & 0x100100) == 0x100100)

but it really contradicts the data I have...

Thanks.

-- 
Dmitry
--

From: Li, Yan I
Date: Monday, November 29, 2010 - 7:18 pm

Wait, you said there are "2 button clickpad"? If so the current way
the kernel handles clickpad is totally wrong:

    if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
        /* Clickpads report only left button */
        __clear_bit(BTN_RIGHT, dev->keybit);
        __clear_bit(BTN_MIDDLE, dev->keybit);
    }

It could only handle those "1 button clickpad", which emits solely
BTN_MIDDLE (and the kernel sends it out as BTN_LEFT instead). It can't
handle "2 button clickpad" correctly.

So I think the touchpad installed on the S10-3t is a "2 button
clickpad" and it emits BTN_LEFT and BTN_RIGHT as usual.

Also IIRC the current X synaptics driver detects clickpad by checking
whether it has one button only, obviously this could not work with 2
button clickpad either.

-- 
Best regards,
Li, Yan

MeeGo Team, Opensource Technology Center, SSG, Intel
Office tel.: +86-10-82171695 (inet: 8-758-1695)
OpenPGP key: 5C6C31EF
IRC: yanli on network irc.freenode.net
--

From: Takashi Iwai
Date: Tuesday, November 30, 2010 - 12:12 am

At Tue, 30 Nov 2010 10:18:40 +0800,

The "normal" clickpad also reports that bit.  I don't see any
difference between Lenovo and HP machines wrt caps values.
It shows the exact same numbers below:

Synaptics Touchpad, model: 1, fw: 7.4, id: 0x1e0b1, caps:
0xd04771/0xe40000/0x5a0400


Takashi
--

From: Li, Yan I
Date: Tuesday, November 30, 2010 - 1:09 am

My S10-3t shows this:
model: 1, fw: 7.4, id: 0x1e0b1, caps: 0xd04771/0xa40000/0x4a0500

-- 
Best regards,
Li, Yan

MeeGo Team, Opensource Technology Center, SSG, Intel
Office tel.: +86-10-82171695 (inet: 8-758-1695)
OpenPGP key: 5C6C31EF
IRC: yanli on network irc.freenode.net
--

Previous thread: Mr Cheung. by Eric on Saturday, November 27, 2010 - 5:28 am. (1 message)

Next thread: [RFC 0/9] Change the copyright info. by Justin P. Mattock on Friday, November 26, 2010 - 11:21 pm. (21 messages)