Fix sentelic multi-touch driver

Started by Olivier Goffart on Jun 27, 2012 · 10 messages from 3 authors · Last reply Jul 11, 2012

Subsystems (2)

Maintainers (2)

STALE5258d

open the first message on its own page

Message details and related content
Always report both finger between the sync.  Even if the documentation
of input-mt says one can only report one at the time, it does not
work otherwise. This fix scrolling in X11 which flickers a lot.

Ignore the duplicate or release events. They keep some gestures from
working (such as the two-finger tap)

This seems to fix the problems reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=43591

Signed-off-by: Olivier Goffart <redacted>
---
 drivers/input/mouse/sentelic.c | 46 +++++++++++++++++++++++++++++++++++++-----
 drivers/input/mouse/sentelic.h |  3 +++
 2 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 3f5649f..b205857 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -731,6 +731,17 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
 			 */
 			fgrs = 2;
 
+			if (abs_x == 0 && abs_y == 0) {
+				/*
+				 * We can ignore multi-finger release events.
+				 * We notice a finger has left the touchpad
+				 * when we receive events for the other finger.
+				 * And for the last finger, we receive
+				 * single-finger release events.
+				 */
+				return PSMOUSE_FULL_PACKET;
+			}
+
 			/* MFMC packet */
 			if (packet[0] & FSP_PB0_MFMC_FGR2) {
 				/* 2nd finger */
@@ -742,10 +753,16 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
 					 */
 					fgrs = 1;
 					fsp_set_slot(dev, 0, false, 0, 0);
+					fsp_set_slot(dev, 1, fgrs == 1,
+						     abs_x, abs_y);
+				} else {
+					ad->last_mt_fgr = 2;
+					fsp_set_slot(dev, 0, true,
+						     ad->finger1_abs_x,
+						     ad->finger1_abs_y);
+					fsp_set_slot(dev, 1, fgrs == 2,
+						     abs_x, abs_y);
 				}
-				ad->last_mt_fgr = 2;
-
-				fsp_set_slot(dev, 1, fgrs == 2, abs_x, abs_y);
 			} else {
 				/* 1st finger */
 				if (ad->last_mt_fgr == 1) {
@@ -755,10 +772,29 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
 					 * the 2nd finger is up
 					 */
 					fgrs = 1;
+					fsp_set_slot(dev, 0, fgrs != 0,
+						     abs_x, abs_y);
 					fsp_set_slot(dev, 1, false, 0, 0);
+				} else {
+					ad->finger1_abs_x = abs_x;
+					ad->finger1_abs_y = abs_y;
+
+					/*
+					 * There is a superflous event from the
+					 * driver when the two fingers are put
+					 * on the touchpad. Don't set
+					 * last_mt_fgr if we have not seen the
+					 * second figner yet, so the previous
+					 * workarond is not triggered and the
+					 * superflous event is ignored.
+					 * This is required to get the two
+					 * finger tap gesture working.
+					 */
+					if (ad->last_mt_fgr != 0)
+						ad->last_mt_fgr = 1;
+
+					return PSMOUSE_FULL_PACKET;
 				}
-				ad->last_mt_fgr = 1;
-				fsp_set_slot(dev, 0, fgrs != 0, abs_x, abs_y);
 			}
 		} else {
 			/* SFAC packet */
diff --git a/drivers/input/mouse/sentelic.h b/drivers/input/mouse/sentelic.h
index aa697ec..7224f84 100644
--- a/drivers/input/mouse/sentelic.h
+++ b/drivers/input/mouse/sentelic.h
@@ -117,6 +117,9 @@ struct fsp_data {
 	unsigned char	last_reg;	/* Last register we requested read from */
 	unsigned char	last_val;
 	unsigned int	last_mt_fgr;	/* Last seen finger(multitouch) */
+
+	unsigned short finger1_abs_x; /* finger1 absolute position */
+	unsigned short finger1_abs_y;
 };
 
 #ifdef CONFIG_MOUSE_PS2_SENTELIC
-- 
1.7.11.1
Message details and related content
On Wed, 27 Jun 2012, Olivier Goffart wrote:
Always report both finger between the sync.  Even if the documentation
of input-mt says one can only report one at the time, it does not
work otherwise. This fix scrolling in X11 which flickers a lot.
  I have a similar patch to address this issue. Would you please try to
see if https://bugzilla.kernel.org/attachment.cgi?id=73991 works for you?
Ignore the duplicate or release events. They keep some gestures from
working (such as the two-finger tap)

This seems to fix the problems reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=43591
  FWIW, https://bugzilla.kernel.org/show_bug.cgi?id=43197 is the original
thread of the aforementioned patch.

Thanks,

Tai-hwa Liang
Message details and related content
On Thursday 28 June 2012 16:02:15 Tai-hwa Liang wrote:
On Wed, 27 Jun 2012, Olivier Goffart wrote:
quoted
Always report both finger between the sync.  Even if the documentation
of input-mt says one can only report one at the time, it does not
work otherwise. This fix scrolling in X11 which flickers a lot.
   I have a similar patch to address this issue. Would you please try to
see if https://bugzilla.kernel.org/attachment.cgi?id=73991 works for you?

Hi,

That patch also fixes the issue here.  (It fixes scrolling and two finger tap)
But the case in which you put two finger into the touchpad then release one 
finger is not handled properly. (I took care of that issue)

(I have a Asus Zenbook UX31)

 
quoted
Ignore the duplicate or release events. They keep some gestures from
working (such as the two-finger tap)

This seems to fix the problems reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=43591
   FWIW, https://bugzilla.kernel.org/show_bug.cgi?id=43197 is the original
thread of the aforementioned patch.
Message details and related content
On Thu, 28 Jun 2012, Olivier Goffart wrote:
On Thursday 28 June 2012 16:02:15 Tai-hwa Liang wrote:
[...]
quoted
   I have a similar patch to address this issue. Would you please try to
see if https://bugzilla.kernel.org/attachment.cgi?id=73991 works for you?
Hi,

That patch also fixes the issue here.  (It fixes scrolling and two finger tap)
But the case in which you put two finger into the touchpad then release one
finger is not handled properly. (I took care of that issue)
  Would you please be more specific about the steps to reproduce this?
I've tested both of these two patches but failed to see the difference in
this case.

Thanks,

Tai-hwa Liang
Message details and related content
On Thursday 28 June 2012 17:17:50 Tai-hwa Liang wrote:
On Thu, 28 Jun 2012, Olivier Goffart wrote:
quoted
On Thursday 28 June 2012 16:02:15 Tai-hwa Liang wrote:
[...]
quoted
quoted
   I have a similar patch to address this issue. Would you please try to

see if https://bugzilla.kernel.org/attachment.cgi?id=73991 works for you?
Hi,

That patch also fixes the issue here.  (It fixes scrolling and two finger
tap) But the case in which you put two finger into the touchpad then
release one finger is not handled properly. (I took care of that issue)
   Would you please be more specific about the steps to reproduce this?
I've tested both of these two patches but failed to see the difference in
this case.

 - Touch the touchpad with one finger and move it: this moves the cursor
 - Place a second finger: this allows you to scoll
 - Release a finger: you should now be able to move the cursor again.  This is 
the part that does not work in one of the patch
Message details and related content
On Thu, 28 Jun 2012, Olivier Goffart wrote:
[...]
- Touch the touchpad with one finger and move it: this moves the cursor
- Place a second finger: this allows you to scoll
- Release a finger: you should now be able to move the cursor again.  This is
the part that does not work in one of the patch
  Sorry, I didn't realise that one of my patch submitted a few months ago
(namely, http://www.spinics.net/lists/linux-input/msg19443.html) isn't
in the master tree, which is different from my local working copy.

  With the correct flag(FSP_BIT_SWC1_EN_GID) being set, the hardware
clears MFMC bit during 2 -> 1 finger transition.  The attached patch is
an aggregated version against Dmitry's master branch, which supposes to fix the testing case listed above.

Thanks,

Tai-hwa Liang
Message details and related content
On Friday 29 June 2012 11:03:12 Tai-hwa Liang wrote:
On Thu, 28 Jun 2012, Olivier Goffart wrote:
[...]
quoted
- Touch the touchpad with one finger and move it: this moves the cursor
- Place a second finger: this allows you to scoll
- Release a finger: you should now be able to move the cursor again.  This
is the part that does not work in one of the patch
   Sorry, I didn't realise that one of my patch submitted a few months ago
(namely, http://www.spinics.net/lists/linux-input/msg19443.html) isn't
in the master tree, which is different from my local working copy.

   With the correct flag(FSP_BIT_SWC1_EN_GID) being set, the hardware
clears MFMC bit during 2 -> 1 finger transition.  The attached patch is
an aggregated version against Dmitry's master branch, which supposes to fix
the testing case listed above.

Thanks,

Tai-hwa Liang
I am testing against the stable 3.4.y branch.
With that patch, scrolling is very slow, and it emits middle click sometimes 
while I want to scroll fast. 

Looking at the debug output, i see a lot of NOTIFY packets, for the same  
number of packets/seconds (77). So then there is 5 times less multi touch 
events. Maybe that's why.

Regards
-- 
Olivier
Message details and related content
On Fri, 29 Jun 2012, Olivier Goffart wrote:
On Friday 29 June 2012 11:03:12 Tai-hwa Liang wrote:
[...]
quoted
   With the correct flag(FSP_BIT_SWC1_EN_GID) being set, the hardware
clears MFMC bit during 2 -> 1 finger transition.  The attached patch is
an aggregated version against Dmitry's master branch, which supposes to fix
the testing case listed above.
I am testing against the stable 3.4.y branch.
With that patch, scrolling is very slow, and it emits middle click sometimes
while I want to scroll fast.

Looking at the debug output, i see a lot of NOTIFY packets, for the same
number of packets/seconds (77). So then there is 5 times less multi touch
events. Maybe that's why.
  I see. It appears to me that we'd better to revert back to the last_mt_fgr
workaround to avoid such delay.

-- 
Thanks,

Tai-hwa Liang
Message details and related content
On Friday 29 June 2012 22:51:16 Tai-hwa Liang wrote:
On Fri, 29 Jun 2012, Olivier Goffart wrote:
quoted
On Friday 29 June 2012 11:03:12 Tai-hwa Liang wrote:
[...]
quoted
quoted
   With the correct flag(FSP_BIT_SWC1_EN_GID) being set, the hardware

clears MFMC bit during 2 -> 1 finger transition.  The attached patch is
an aggregated version against Dmitry's master branch, which supposes to
fix
the testing case listed above.
I am testing against the stable 3.4.y branch.
With that patch, scrolling is very slow, and it emits middle click
sometimes while I want to scroll fast.

Looking at the debug output, i see a lot of NOTIFY packets, for the same
number of packets/seconds (77). So then there is 5 times less multi touch
events. Maybe that's why.
   I see. It appears to me that we'd better to revert back to the
last_mt_fgr workaround to avoid such delay.
That last patch seems to work perfectly.

Thanks
-- 
Olivier
Message details and related content
On Friday 29 June 2012 17:00:39 Olivier Goffart wrote:
On Friday 29 June 2012 22:51:16 Tai-hwa Liang wrote:
quoted
On Fri, 29 Jun 2012, Olivier Goffart wrote:
quoted
On Friday 29 June 2012 11:03:12 Tai-hwa Liang wrote:
[...]
quoted
quoted
   With the correct flag(FSP_BIT_SWC1_EN_GID) being set, the hardware

clears MFMC bit during 2 -> 1 finger transition.  The attached patch is
an aggregated version against Dmitry's master branch, which supposes to
fix
the testing case listed above.
I am testing against the stable 3.4.y branch.
With that patch, scrolling is very slow, and it emits middle click
sometimes while I want to scroll fast.

Looking at the debug output, i see a lot of NOTIFY packets, for the same
number of packets/seconds (77). So then there is 5 times less multi
touch
events. Maybe that's why.
   I see. It appears to me that we'd better to revert back to the

last_mt_fgr workaround to avoid such delay.
That last patch seems to work perfectly.

Thanks
Hi,

Is there any news regarding this issue?  When is it going to be fixed 
upstream?
I am using that last patch and it is working very well.

-- 
Olivier
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help