Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753403AbdGSI5L (ORCPT ); Wed, 19 Jul 2017 04:57:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:57861 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751815AbdGSI5G (ORCPT ); Wed, 19 Jul 2017 04:57:06 -0400 Date: Wed, 19 Jul 2017 10:57:04 +0200 Message-ID: From: Takashi Iwai To: Paul Donohue Cc: Laura Abbott , Masaki Ota , Dmitry Torokhov , Pali Rohar , Nick Fletcher , "linux-input@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "scott.s.lowe@gmail.com" Subject: Re: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: ALPS - fix V8+ protocol handling (73 03 28)") In-Reply-To: <20170712162841.GI1855@TopQuark.net> References: <75b84b97-5f36-a3be-bb4e-e43cd72d9921@redhat.com> <20170619184315.GF1855@TopQuark.net> <0995261b-8d19-64af-9b66-e1eab579a3d4@redhat.com> <20170619232026.GG1855@TopQuark.net> <20170711195821.GG1855@TopQuark.net> <20170712162841.GI1855@TopQuark.net> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4000 Lines: 100 On Wed, 12 Jul 2017 18:28:41 +0200, Paul Donohue wrote: > > On Wed, Jul 12, 2017 at 09:16:43AM +0200, Takashi Iwai wrote: > > On Tue, 11 Jul 2017 21:58:21 +0200, > > Paul Donohue wrote: > > > > > > On Tue, Jul 11, 2017 at 05:50:07PM +0200, Takashi Iwai wrote: > > > > Hi, just joining to the party in the middle, as I'm also facing the > > > > same problem on Dell E7270 laptop. Has this issue already been > > > > addressed? > > > > > > > > If not, the following was my result: > > > > > > > > - the first patch slowed the pointer movement a lot, it's even slower > > > > than the old kernel (e.g. 4.4.x). > > > > The two finger scroll works fine on all touchpad area now. > > > > > > > > - the second patch made the pointer movement even faster than now (as > > > > I feel, not quite sure). The two finger scroll doesn't work at the > > > > right side of the touchpad. > > > > > > > > > > > > The kernel output from the first patch is below: > > > > psmouse serio1: alps: test1 pitch 37x37 num-electrodes 8x7 physical size 25x22mm res 69x69 max 1792x1536 > > > > > > > > Let me know if you have any further test. > > > > > > > > > > > > thanks, > > > > > > > > Takashi > > > > > > Do you have the kernel output from the second patch? > > > > Here it is: > > > > psmouse serio1: alps: test2 pitch 50x54 num-electrodes 20x11 physical size 95x54mm res 25x23 max 2432x1280 > > Thanks! > > Wow, this is weird ... Values that cause scrolling issues for you work fine for me. > > It looks like the priv->x_max value that is causing your problem, but perhaps you can confirm this with another test: > Revert the patches above, then just before the 'return' at the end of alps_update_device_area_ss4_v2() add the following line: > priv->x_max = 1792; > I suspect this line will make two-finger scrolling work again. > > It might also help if you could experiment with other x_max values. 2432 is the correct value that causes problems for you.. Does a small value like 500 or a large value like 5000 change the behavior? > > Another test you can try is to add a print statement in the 'case SS4_PACKET_ID_TWO' section of alps_decode_ss4_v2() and print out the f->mt[0].x and f->mt[1].x values. With x_max set to 2432, what range of x values does this print when scrolling works, and what range of values are printed when scrolling doesn't work? Sorry for the late reply. I checked your suggestion, and noticed that actually x_max is a red herring. Then I started looking at the output of evtest (should have done from the beginning!), and the problem became obvious: the reported X values for MT with finger > 1 are doubled, e.g. it reports 4800 instead of 2400. The MT_Y coordinate looks OK, so it's only about MT_X. And finger=1 reports correctly. After reading the code, I ended up the patch like below. This seems working through a quick test. Could anyone check the patch to see whether it works / breaks anything? The evtest showed that the MT_X for finger 3 and 4 are also bogus, and the patch should address it, too. My only concern so far is whether correcting this globally is right, or it's specific to some certain models. This needs the confirmation from ALPS people... thanks, Takashi --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h @@ -96,8 +96,8 @@ enum SS4_PACKET_ID { #define SS4_BTN_V2(_b) ((_b[0] >> 5) & SS4_MASK_NORMAL_BUTTONS) -#define SS4_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 5) & 0x00E0) | \ - ((_b[1 + _i * 3] << 5) & 0x1F00) \ +#define SS4_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 4) & 0x0070) | \ + ((_b[1 + (_i) * 3] << 4) & 0x0F80) \ ) #define SS4_STD_MF_Y_V2(_b, _i) (((_b[1 + (_i) * 3] << 3) & 0x0010) | \ @@ -106,7 +106,7 @@ enum SS4_PACKET_ID { ) #define SS4_BTL_MF_X_V2(_b, _i) (SS4_STD_MF_X_V2(_b, _i) | \ - ((_b[0 + (_i) * 3] >> 3) & 0x0010) \ + ((_b[0 + (_i) * 3] >> 2) & 0x0008) \ ) #define SS4_BTL_MF_Y_V2(_b, _i) (SS4_STD_MF_Y_V2(_b, _i) | \