Date: Fri, 17 May 2019 01:40:12 +0300 From: Andrey Kosachenko <andrey.kosachenko@gmail.com> To: freebsd-drivers@freebsd.org Subject: Thinkpad t480s elantech touchpad device is not recognized: unknown touchpad firmware (firmware v.0x7f3001) Message-ID: <5f4e1f25-8c87-5fa5-1d7f-edbde63fde6e@gmail.com>
next in thread | raw e-mail | index | archive | help
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: <PS/2 Mouse> 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: <PS/2 Mouse> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5f4e1f25-8c87-5fa5-1d7f-edbde63fde6e>