From owner-freebsd-drivers@freebsd.org Wed May 29 17:17:26 2019 Return-Path: Delivered-To: freebsd-drivers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F2FA15A7D33; Wed, 29 May 2019 17:17:26 +0000 (UTC) (envelope-from list1@gjunka.com) Received: from msa1.earth.yoonka.com (yoonka.com [88.98.225.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "msa1.earth.yoonka.com", Issuer "msa1.earth.yoonka.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B41775E91; Wed, 29 May 2019 17:17:24 +0000 (UTC) (envelope-from list1@gjunka.com) Received: from crayon2.yoonka.com (crayon2.yoonka.com [10.70.7.20]) (authenticated bits=0) by msa1.earth.yoonka.com (8.15.2/8.15.2) with ESMTPSA id x4THHNmT076617 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 29 May 2019 17:17:23 GMT (envelope-from list1@gjunka.com) Subject: Re: Thinkpad t480s elantech touchpad device is not recognized: unknown touchpad firmware (firmware v.0x7f3001) To: freebsd-drivers@freebsd.org, x11-list freebsd References: <5f4e1f25-8c87-5fa5-1d7f-edbde63fde6e@gmail.com> From: Grzegorz Junka Message-ID: Date: Wed, 29 May 2019 17:17:23 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <5f4e1f25-8c87-5fa5-1d7f-edbde63fde6e@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB-large X-Rspamd-Queue-Id: 0B41775E91 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of list1@gjunka.com designates 88.98.225.149 as permitted sender) smtp.mailfrom=list1@gjunka.com X-Spamd-Result: default: False [-6.77 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:88.98.225.149]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[gjunka.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-3.63)[ip: (-9.50), ipnet: 88.98.192.0/18(-4.75), asn: 56478(-3.80), country: GB(-0.09)]; MX_GOOD(-0.01)[cached: gjunka.com]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.83)[-0.832,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:56478, ipnet:88.98.192.0/18, country:GB]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2019 17:17:26 -0000 Hi Andrey, I don't know much about drivers but I would suggest reposting to X11 list since it's as much related to drivers as it's to the GUI (and freebsd-drivers doesn't seem to be very active). GrzegorzJ On 16/05/2019 22:40, Andrey Kosachenko wrote: > Hi, > > Recently I've replaced my t410 with t480s model. > Before ordering the device I found positive feedback in terms of > FreeBSD compatibility (pages like > https://wiki.freebsd.org/Laptops/Thinkpad_T480) > > Apparently device is equipped with newer clickpad+trackpoint device > which is not recognized by 12R properly: > > FreeBSD beastie.intra 12.0-RELEASE-p3 FreeBSD 12.0-RELEASE-p3 #2 > r347114M: Sun May 12 00:08:31 EEST 2019 > root@beastie.intra:/usr/obj/usr/src/amd64.amd64/sys/BEASTIE-EVDEV amd64 > > Attempts to enable hw.psm.synaptics_support or(and) > hw.psm.elantech_support didn't help either. Though  trackpoint works > just fine after enabling hw.psm.trackpoint_support > > instead touchpad is recognized as generic PS/2 mouse (relevant strings > from dmesg) > > === > May 11 22:39:41 beastie kernel: atkbd0: [GIANT-LOCKED] > May 11 22:39:41 beastie kernel:   Unknown touchpad hardware (firmware > v.0x7f3001) > May 11 22:39:41 beastie kernel: psm0: irq 12 on atkbdc0 > May 11 22:39:41 beastie kernel: psm0: [GIANT-LOCKED] > May 11 22:39:41 beastie kernel: psm0: model Generic PS/2 mouse, device > ID 0 > === > > I was pretty much happy working with the device in general and with > the tuouchpad in particular (as a simple mouse). Even got accustomed > to the absence of double-finger scroll capability (which I could > simulate via holding mid-button+swipe on touchpad) and > triple-finger-tap as a midle-button-click). The only thing that I > failed to workaround was accidental palm touches which is really > painful and makes keyboard usage unbearable. Eventually I tried to > seek for normal solution. > > Lenovo site sujests for t480s devices "ELAN UltraNav Driver for > Windows 10 64-bit - ThinkPad T480s (Type 20L7, 20L8)" driver. Which > made me think it is elantech (not synaptics). Looking through the psm > sources quickly led me to the point where a very simple modification > and recompilation of the kernel helped to recognize touchpad properly. > In particular: > > === > [silent@beastie][/usr/src]svnlite diff sys/dev/atkbdc/psm.c > Index: sys/dev/atkbdc/psm.c > =================================================================== > --- sys/dev/atkbdc/psm.c        (revision 347114) > +++ sys/dev/atkbdc/psm.c        (working copy) > @@ -6929,7 +6929,7 @@ >  { >         static const int ic2hw[] = >         /*IC: 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f */ > -           { 0, 0, 2, 0, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0 }; > +           { 0, 0, 2, 0, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; >         static const int fw_sizes[][3] = { >                 /* FW.vers  MaxX  MaxY */ >                 { 0x020030, 1152,  768 }, > === > > I.e. after that simple modification system started to recognize fw > version: > > === > [silent@beastie][/usr/src]dmesg | egrep psm > psm0: irq 12 on atkbdc0 > psm0: [GIANT-LOCKED] > psm0: model Elantech Touchpad, device ID 0 > === > > and all expected touchpad features (multi-tap gestures and scrolling, > whatsoever) started to function properly under xorg+evdev. I'm happy > with a touchpad now however trackpoint stopped to work. In particular > attempt to use trackpoint causes strange flickering of the mice cursor > (which lasts few fractions of the second) after which cursor jumps to > the left-upper corner of the screen and it's impossible to move it > (via trackpoint) anymore (though swiping touchpad surface moves cursor > as expected). Also I found in Xorg.log messages emerging when a palm > touches the surface of a touchpad: > > === > [    65.729] (EE) event3  - ETPS/2 Elantech Touchpad: kernel bug: > Touch jump detected and discarded. > See > https://wayland.freedesktop.org/libinput/doc/1.12.6/touchpad-jumping-cursors.html > for details > > === > > > Additionally I found relevant topic in openbsd lists > http://openbsd-archive.7691.n7.nabble.com/ThinkPad-T480s-Elantech-v4-clickpad-configuration-td342242.html. > Eventually I narrow down it to the following changes: > https://github.com/openbsd/src/commit/8e9e9c10431cb45d93e2c0d81f668ff9575f8015#diff-ff06b79b08490ebbfa34b15aa4ebf370 > . I might be inherently wrong (due to lack of knowledge in C language > and driver implementation) however it seemed to me that the similar > logic the diff above reveals (besides fw detection) had already been > added to psm.c from FreeBSD sources earlier. > > > So I'm writing here for 2 purposes: > > 1) not sure that my modification is proper in terms of firmware > version detection (so can't send patch since there is a high chance it > will be rejected) > > 2) modification is definitely either incomplete or incorrect since it > brakes trackpoint functioning. > > Since I possess a laptop with a device which is not supported yet, I > might help to debug the issue or even dedicate some time and try to > add support for a new device (just need a nudge into proper direction) > > Thanks in advance! > > -- > WBR, > Andrey Kosachenko > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to > "freebsd-drivers-unsubscribe@freebsd.org"