![触控板按钮/单击和拖动不起作用,发送按键事件(Surface Pro2 Ubuntu 16.04)](https://linux22.com/image/1004550/%E8%A7%A6%E6%8E%A7%E6%9D%BF%E6%8C%89%E9%92%AE%2F%E5%8D%95%E5%87%BB%E5%92%8C%E6%8B%96%E5%8A%A8%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%8C%E5%8F%91%E9%80%81%E6%8C%89%E9%94%AE%E4%BA%8B%E4%BB%B6%EF%BC%88Surface%20Pro2%20Ubuntu%2016.04%EF%BC%89.png)
我已经在 Surface Pro 2 上使用 Ubuntu 几年了(从 14.04 开始),现在使用 16.04(内核 4.3+),开箱即用,基本运行正常。然而,有一件事让我很烦,那就是触控板按钮。
- 点击(触摸板上的任意位置)即可正常工作
- 按下物理点击按钮会弹出下面的覆盖层。某些应用程序(例如 nautilus、firefox、sublimetext)会记录点击,并且点击工作正常(尽管有覆盖层)。其他应用程序(例如 gimp)根本不响应点击(但会响应轻击)
- 单击并拖动也会弹出相同的覆盖,并且在某些应用程序中有效(例如 nautilus、firefox、sublimetext),但在其他应用程序中再次完全被忽略(例如 gimp)。
- 在任何情况下,双击(触摸板上的任意位置)按住并拖动均不起作用(无法单击和拖动)
- 两个手指滚动很好用
- 我在“设置”>“鼠标和触摸板”中没有触摸板选项卡
- 我正在使用 gnome 3 桌面
多年来我一直随身携带鼠标,只是为了能够在 gimp 中进行简单的点击和拖动,但我受够了!这个覆盖是什么意思?如何使用这个触控板在 gimp 中进行点击和拖动?
更新:从 xinput --test 中,我看到触摸板按钮也会发送按键事件。我该如何防止这种情况发生?
uname -a
Linux MSA-SP2-UBUNTU 4.10.0-40-generic #44~16.04.1-Ubuntu SMP Thu Nov 9 15:37:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
新输入
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ MICROSOFT SAM id=9 [slave pointer (2)]
⎜ ↳ MICROSOFT SAM id=10 [slave pointer (2)]
⎜ ↳ Atmel Atmel maXTouch Digitizer id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Front LifeCam id=12 [slave keyboard (3)]
↳ Rear LifeCam id=13 [slave keyboard (3)]
xinput--测试10
key release 36
motion a[0]=483 a[1]=646
motion a[0]=480 a[1]=647
motion a[0]=478 a[1]=648
motion a[0]=475 a[1]=649
motion a[0]=473 a[1]=650
motion a[0]=467 a[1]=644
motion a[0]=468 a[1]=643
motion a[1]=642
motion a[1]=641
# tapping
button press 1
button release 1
motion a[0]=467
motion a[0]=466
motion a[0]=465
# clicking touchpad button
key press 201
button press 1
key release 201
# releasing touchpad button
button release 1
motion a[0]=463
motion a[0]=462
xinput--watch-props 10 复制代码
Device 'MICROSOFT SAM':
Device Enabled (139): 1
Coordinate Transformation Matrix (141): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (267): 0
Device Accel Constant Deceleration (268): 1.000000
Device Accel Adaptive Deceleration (269): 1.000000
Device Accel Velocity Scaling (270): 10.000000
Device Product ID (259): 1118, 1961
Device Node (260): "/dev/input/event5"
Evdev Axis Inversion (271): 0, 0
Evdev Axes Swap (273): 0
Axis Labels (274): "Rel X" (149), "Rel Y" (150), "Rel Horiz Wheel" (292), "Rel Dial" (293), "Rel Vert Wheel" (294)
Button Labels (275): "Button Left" (142), "Button Middle" (143), "Button Right" (144), "Button Wheel Up" (145), "Button Wheel Down" (146), "Button Horiz Wheel Left" (147), "Button Horiz Wheel Right" (148), "Button Side" (290), "Button Extra" (291), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262)
Evdev Scrolling Distance (276): 1, 1, 1
Evdev Middle Button Emulation (277): 0
Evdev Middle Button Timeout (278): 50
Evdev Middle Button Button (279): 2
Evdev Third Button Emulation (280): 0
Evdev Third Button Emulation Timeout (281): 1000
Evdev Third Button Emulation Button (282): 3
Evdev Third Button Emulation Threshold (283): 20
Evdev Wheel Emulation (284): 0
Evdev Wheel Emulation Axes (285): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (286): 10
Evdev Wheel Emulation Timeout (287): 200
Evdev Wheel Emulation Button (288): 4
Evdev Drag Lock Buttons (289): 0
猫/ proc /总线/输入/设备
I: Bus=0019 Vendor=0000 Product=0005 Version=0000
N: Name="Lid Switch"
P: Phys=PNP0C0D/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C0D:00/input/input0
U: Uniq=
H: Handlers=event0
B: PROP=0
B: EV=21
B: SW=1
I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1
U: Uniq=
H: Handlers=kbd event1
B: PROP=0
B: EV=3
B: KEY=10000000000000 0
I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2
U: Uniq=
H: Handlers=kbd event2
B: PROP=0
B: EV=3
B: KEY=10000000000000 0
I: Bus=0003 Vendor=045e Product=07a9 Version=0111
N: Name="MICROSOFT SAM"
P: Phys=usb-0000:00:14.0-3/input1
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.1/0003:045E:07A9.0002/input/input3
U: Uniq=0.1.0000
H: Handlers=sysrq kbd mouse0 event3
B: PROP=0
B: EV=10001f
B: KEY=c03 30001 0 300000000000000 200e800000000000 100000020000000
B: REL=3
B: ABS=1000003
B: MSC=10
I: Bus=0019 Vendor=0000 Product=0006 Version=0000
N: Name="Video Bus"
P: Phys=LNXVIDEO/video/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input4
U: Uniq=
H: Handlers=kbd event4
B: PROP=0
B: EV=3
B: KEY=3e000b00000000 0 0 0
I: Bus=0003 Vendor=045e Product=07a9 Version=0111
N: Name="MICROSOFT SAM"
P: Phys=usb-0000:00:14.0-3/input2
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.2/0003:045E:07A9.0003/input/input5
U: Uniq=0.1.0000
H: Handlers=sysrq kbd mouse1 event5 leds
B: PROP=0
B: EV=12001f
B: KEY=3f0003007f 0 0 483ffff17aff32d bf54444600000000 1f0001 130f938b17c007 ffe77bfad9415fff febeffdff3cfffff fffffffffffffffe
B: REL=1c3
B: ABS=ffffff0100000000
B: MSC=10
B: LED=7
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card1/input6
U: Uniq=
H: Handlers=event6
B: PROP=0
B: EV=21
B: SW=10
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel PCH Headphone"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card1/input7
U: Uniq=
H: Handlers=event7
B: PROP=0
B: EV=21
B: SW=4
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel HDMI HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:03.0/sound/card0/input8
U: Uniq=
H: Handlers=event8
B: PROP=0
B: EV=21
B: SW=140
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel HDMI HDMI/DP,pcm=7"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:03.0/sound/card0/input9
U: Uniq=
H: Handlers=event9
B: PROP=0
B: EV=21
B: SW=140
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel HDMI HDMI/DP,pcm=8"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:03.0/sound/card0/input10
U: Uniq=
H: Handlers=event10
B: PROP=0
B: EV=21
B: SW=140
I: Bus=0003 Vendor=03eb Product=8209 Version=0111
N: Name="Atmel Atmel maXTouch Digitizer"
P: Phys=usb-0000:00:14.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4:1.0/0003:03EB:8209.0004/input/input11
U: Uniq=
H: Handlers=mouse2 event11
B: PROP=2
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=3273800000000003
I: Bus=0003 Vendor=045e Product=0794 Version=0306
N: Name="Front LifeCam"
P: Phys=usb-0000:00:14.0-5/button
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-5/2-5:1.0/input/input12
U: Uniq=
H: Handlers=kbd event12
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0
I: Bus=0003 Vendor=045e Product=0795 Version=0307
N: Name="Rear LifeCam"
P: Phys=usb-0000:00:14.0-6/button
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb2/2-6/2-6:1.0/input/input13
U: Uniq=
H: Handlers=kbd event13
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0
答案1
我在 Surface Pro 2 上安装 Fedora39 和 openSUSE 时遇到了这个问题,所以这仍然是所有发行版的驱动程序问题。要解决该问题,您可以重新映射触发密钥代码 201使用 udev 规则。我基本上遵循了archi wiki udev 教程,导致以下步骤(我猜可以应用不同的文件位置,硬件字符串等):
- 使用 找出按键的扫描码
sudo evtest
。在我的例子中,适用的硬件是/dev/input/event7:微软 SAM 键盘和扫描码70072 - 查找 udev 规则的硬件标识符,
sudo evemu-describe /dev/input/event7
在我的例子中返回的是输入设备ID:总线0x03 供应商0x3eb 产品0x8209 版本0x111 sudo nano /etc/udev/hwdb.d/90-fixSurfaceKeyboard.hwdb
使用以下输入 创建一个具有 udev 规则的新 hdwb 文件(相应地调整扫描代码和 HW ID)
请注意,总线 ID 等的十六进制代码必须大写,否则规则不会触发evdev:input:b0003v045Ep07A9e0111* KEYBOARD_KEY_70072=reserved
- 重新加载所有内容:
sudo systemd-hwdb update sudo udevadm trigger
- 检查输出是否
udevadm info <path to device e.g. /dev/input/event7>
包含新规则,例如E:KEYBOARD_KEY_70072=保留如果不是这种情况,请重新启动您的机器并重新检查您的规则
扫描码现在被忽略并且左键单击按预期工作(X11 和 Wayland)