如何在 Linux 上使用 Apple 魔术触控板作为绘图板

如何在 Linux 上使用 Apple 魔术触控板作为绘图板

我尝试在我的 Linux 笔记本电脑上使用“旧” Apple magic trackpad (AMT) 作为绘图板:

  • 戴尔XPS
  • ArchLinux
  • 韓國
  • Xfce 4

我将 Xorg 配置evdev为使用 AMT 驱动程序,因为synaptics它根本不提供绝对坐标,而且libinput似乎没有为 Xorg 提供绝对坐标。

到目前为止,AMT 已连接,我可以单击(使用硬件按钮),但点击和动作不起作用......

以下是一些有用命令的输出:

$ xinput list --long 12
Trackpad de Romain                          id=12   [slave  pointer  (2)]
    Reporting 7 classes:
        Class originated from: 12. Type: XIButtonClass
        Buttons supported: 5
        Button labels: "Button Left" "Button Unknown" "Button Unknown" "Button Wheel Up" "Button Wheel Down"
        Button state:
        Class originated from: 12. Type: XIValuatorClass
        Detail for Valuator 0:
          Label: Abs MT Position X
          Range: -2909.000000 - 3167.000000
          Resolution: 46000 units/m
          Mode: absolute
          Current value: -1556.000000
        Class originated from: 12. Type: XIValuatorClass
        Detail for Valuator 1:
          Label: Abs MT Position Y
          Range: -2456.000000 - 2565.000000
          Resolution: 45000 units/m
          Mode: absolute
          Current value: -1451.000000
        Class originated from: 12. Type: XIValuatorClass
        Detail for Valuator 2:
          Label: Abs MT Touch Major
          Range: 0.000000 - 1020.000000
          Resolution: 0 units/m
          Mode: absolute
          Current value: 0.000000
        Class originated from: 12. Type: XIValuatorClass
        Detail for Valuator 3:
          Label: Abs MT Touch Minor
          Range: 0.000000 - 1020.000000
          Resolution: 0 units/m
          Mode: absolute
          Current value: 0.000000
        Class originated from: 12. Type: XIValuatorClass
        Detail for Valuator 4:
          Label: Abs MT Orientation
          Range: -31.000000 - 32.000000
          Resolution: 0 units/m
          Mode: absolute
          Current value: -13.000000
        Class originated from: 12. Type: XITouchClass
        Touch mode: dependent
        Max number of touches: 16


$ xinput list-props 12
Device 'Trackpad de Romain':
    Device Enabled (162):   1
    Coordinate Transformation Matrix (164): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (295): 0
    Device Accel Constant Deceleration (296):   1.000000
    Device Accel Adaptive Deceleration (297):   1.000000
    Device Accel Velocity Scaling (298):    10.000000
    Device Product ID (286):    1452, 782
    Device Node (285):  "/dev/input/event20"
    Evdev Axis Inversion (299): 0, 0
    Evdev Axis Calibration (300):   <no items>
    Evdev Axes Swap (301):  0
    Axis Labels (302):  "Abs MT Position X" (293), "Abs MT Position Y" (294), "Abs MT Touch Major" (290), "Abs MT Touch Minor" (291), "Abs MT Orientation" (292), "None" (0), "None" (0)
    Button Labels (303):    "Button Left" (165), "Button Unknown" (287), "Button Unknown" (287), "Button Wheel Up" (168), "Button Wheel Down" (169)
    Evdev Scrolling Distance (304): 0, 0, 0
    Evdev Middle Button Emulation (305):    0
    Evdev Middle Button Timeout (306):  50
    Evdev Middle Button Button (307):   2
    Evdev Third Button Emulation (308): 0
    Evdev Third Button Emulation Timeout (309): 1000
    Evdev Third Button Emulation Button (310):  3
    Evdev Third Button Emulation Threshold (311):   20
    Evdev Wheel Emulation (312):    0
    Evdev Wheel Emulation Axes (313):   0, 0, 4, 5
    Evdev Wheel Emulation Inertia (314):    10
    Evdev Wheel Emulation Timeout (315):    200
    Evdev Wheel Emulation Button (316): 4
    Evdev Drag Lock Buttons (317):  0

运行sudo libinput debug-gui,一切正常(除了它似乎使用相对坐标而不是绝对坐标)。

运行sudo libinput debug-events实际上会显示类似的行event20 POINTER_MOTION ...,但光标不会移动......

最后运行xinput --test-xi2

  • 当在笔记本电脑的触控板上移动手指时,我收到一些Motion事件(EVENT type 6
  • 当在 AMT 上移动手指时,我收到一些TouchUpdate事件(EVENT type 19),其中估值器的值反映了手指在触摸板上的绝对位置。

我也尝试过libinput更改加速度配置文件来使用该flat配置文件。虽然行为与绝对坐标不同,但它适合绘制。但是,加速度配置文件不适用于触控板...根据libinput 问题,但我可以重新编译它以提供平面加速配置文件,但我不知道这是否允许选择配置文件或仅提供平面配置文件,在这种情况下我需要两个驱动程序,用于普通设备的原始驱动程序和用于 AMT 的修补驱动程序。

如何使 AMT 工作,至少在 Gimp 上。

答案1

正如预期的那样,重新编译libinput允许对触摸板使用不同的加速度配置文件(平面或自适应方案)。

然后只需创建一个 X.org 配置:

$ cat /etc/X11/xorg.conf.d/99-apple-magic-trackpad.conf

Section "InputClass"
    Identifier "Apple Magic Trackpad"
    MatchUSBID "05ac:030e"
    MatchIsTouchpad "on"
    Driver "libinput"
    Option "AccelProfile" "flat"
EndSection

您甚至可以在运行时更改加速度配置文件:

# Set flat acceleration scheme
xinput set-prop $deviceId 318 0, 1

# Set adaptive acceleration scheme
xinput set-prop $deviceId 318 1, 0

最后,对于 Arch 用户,我发布了AUR 上的软件包以实现这一点。

相关内容