鼠标垫在联想 Thinkpad 中不起作用

Rui*_*iro 4 debian synaptic

我在这里遇到了一个奇怪的问题 - 集成的突触鼠标/橡胶鼠标在 Linux 中不起作用。

The integrated mouse/mousepad only works as long Windows has activated them firstly. I can do many reboots in Linux and they do keep working. They will be recognized as long the notebook has not lost power.

If the notebook depletes all battery, I will only able to use the mousepad/mouse again if I boot in Windows firstly.

So I can reproduce the bug easily taking the battery out while Linux is running. In that way, the mousepad won't be recognized until I boot up in Windows again. So it seems the opensource drivers are not able to recognized the device when the hardware it is in an unknown (initialization) state.

I am using Debian 9/Antix 17.1 in a 2016 Lenovo ThinkPad E560, i7-6500U CPU @ 2.50GHz, 16GB of RAM and an SSD disk.

The machine has a dual card, however I deactived the radeon with radeon.modeset=0 in the kernel parameters. So the relevant parameters are:

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)
Run Code Online (Sandbox Code Playgroud)

My xserver-xorg relevant packages are:

xserver-xorg - 7.7+19
xserver-xorg-core - 1.19.2-1.0nosystemd2
xserver-xorg-input-libinput - 0.23.0-2
xserver-xorg-input-synaptics - 1.9.0-1+b1
xserver-xorg-video-intel - 2.99.917+git20161206-1
Run Code Online (Sandbox Code Playgroud)

I already tried running the stock Debian kernels present in the Antix repositories, 4.10.5-antix.3-amd64-smp and 4.18.4-antix.1-amd64-smp without any changes in symptoms; as @StephenKitt told me there were changes on synaptics handling on newer versions.

My current kernel parameters are:

$ cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-4.18.4-antix.1-amd64-smp root=UUID=00c17984-859f-4197-8bd8-b346ddd092bd ro iommu=1 intel_iommu=on iommu=pt ipv6.disable=1 intremap=no_x2apic_optout radeon.modeset=0
Run Code Online (Sandbox Code Playgroud)

I also followed some recommendations online to change in xorg the mousepad handling from xserver-xorg-input-synaptics to xserver-xorg-input-libinput, installing the latter, and doing:

 cd /etc/X11/xorg.conf.d
 ln -s /usr/share/X11/xorg.conf.d/40-libinput.conf 
Run Code Online (Sandbox Code Playgroud)

The symptoms remain unchanged.

我还在 Windows 10 的设备管理器中查看了设备/驱动程序的名称,它是一个名为“Ultranav”的双鼠标鼠标垫/键盘橡胶制品。libinput-list-devices也将其命名为“AlpsPS/2 ALPS DualPoint TouchPad”。其他一些人也调用其他联想型号这款鼠标 Elantech。

我也装libinput-tools了调试的情况。有趣的是,运行命令libinput-list-devices鼠标是在运行 Windows 之后看到的,之前它是不存在的。

我已经提出了与内核团队一起填补错误的建议。

该怎么办?

dmidecode制造商和型号的相关数据为:

# dmidecode -s system-manufacturer
LENOVO
# dmidecode -s system-product-name
20EV000YPG
# dmidecode -s system-version
ThinkPad E560
Run Code Online (Sandbox Code Playgroud)

libunput-list-devices启动 Windows 10 前后的差异。

$ diff libunput-list-devices-before_windows.txt after-windows.txt
2c2
< Kernel:           /dev/input/event8
---
> Kernel:           /dev/input/event10
20c20
< Kernel:           /dev/input/event10
---
> Kernel:           /dev/input/event12
38c38
< Kernel:           /dev/input/event7
---
> Kernel:           /dev/input/event9
128c128
< Kernel:           /dev/input/event18
---
> Kernel:           /dev/input/event20
163,164c163,164
< Device:           ThinkPad Extra Buttons
< Kernel:           /dev/input/event9
---
> Device:           AlpsPS/2 ALPS DualPoint Stick
> Kernel:           /dev/input/event6
165a166,202
> Seat:             seat0, default
> Capabilities:     pointer 
> Tap-to-click:     n/a
> Tap-and-drag:     n/a
> Tap drag lock:    n/a
> Left-handed:      disabled
> Nat.scrolling:    disabled
> Middle emulation: disabled
> Calibration:      n/a
> Scroll methods:   *button
> Click methods:    none
> Disable-w-typing: n/a
> Accel profiles:   flat *adaptive
> Rotation:         n/a
> 
> Device:           AlpsPS/2 ALPS DualPoint TouchPad
> Kernel:           /dev/input/event7
> Group:            7
> Seat:             seat0, default
> Size:             97.50x53.87mm
> Capabilities:     pointer 
> Tap-to-click:     disabled
> Tap-and-drag:     enabled
> Tap drag lock:    disabled
> Left-handed:      disabled
> Nat.scrolling:    disabled
> Middle emulation: disabled
> Calibration:      n/a
> Scroll methods:   *two-finger edge 
> Click methods:    *button-areas clickfinger 
> Disable-w-typing: enabled
> Accel profiles:   none
> Rotation:         n/a
> 
> Device:           ThinkPad Extra Buttons
> Kernel:           /dev/input/event11
> Group:            8
Run Code Online (Sandbox Code Playgroud)

Rui*_*iro 5

有趣的是,在搜索 bug 的单词变体(包括 Lenovo、Alps 和 Ultranav)时,我在 Arch Linux wiki libinput的帖子中发现了一篇建议内核参数的文章

根本没有检测到触摸板

注意:不是 libinput 问题。Touchpad_Synaptics#No_Multi-touch_in_some_Elantech_touchpads 中链接了对参数的解释,这比说“尝试其中一些”要好得多。

如果未检测到触摸板设备并将其显示为设备,则可能的解决方案可能是使用这些内核参数中的一个或多个。

i8042.noloop i8042.nomux i8042.nopnp i8042.reset

然后我做了一些测试,并在我的情况下,它足以给内核参数添加发现i8042.resetGRUB_CMDLINE_LINUX_DEFAULT/etc/default/grub文件并运行:

update-grub2
Run Code Online (Sandbox Code Playgroud)

之后,我取出电池尝试复制该错误。机器死机并重启Linux后,Ultranav/Elantech内置鼠标已经被识别并开始工作,无需先启动Windows 10。

我会说这是一个内核错误。

与其他笔记本类似,Lenovo Thinkpad 需要添加到 Linux 内核中的 i8042 设备重置列表中,其中有一个需要 i8042 芯片组重置的家庭机器列表,以便始终如一地检测其 Elantech TouchPad。

我在找到这些错误条目后发现了这个后来的要求 Input: i8042 - add Lenovo LaVie Z to the i8042 reset list and Input: i8042: add Lenovo ThinkPad L460 to i8042 reset list

从Linux内核源代码的可视化来看,将Lenovo ThinkPad E560添加到i8042重置列表的源代码也没有出现在最新的4.19-rc2内核源代码中。

所以为了添加它,我写了一个简单的 diff/patch,可以用来代替 grub 中的 i8042.reset 内核参数:

--- drivers/input/serio/i8042-x86ia64io.h.old   2018-09-06 04:53:36.460003164 +0100
+++ drivers/input/serio/i8042-x86ia64io.h   2018-09-06 04:57:16.833465129 +0100
@@ -655,6 +655,14 @@
            DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
        },
    },
+   {
+                /* Lenovo ThinkPad E560 */
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                        DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad E560"),
+                },
+        },
+
    { }
 };
Run Code Online (Sandbox Code Playgroud)

附注。按照@StephenKitt 的建议,我尝试将此帖子作为 Linux 内核错误报告发送到 linux-input@vger.kernel.org