在 Ubuntu 上恢复 Apple Magic Trackpad 2 设置

在 Ubuntu 上恢复 Apple Magic Trackpad 2 设置

尽管花了很多时间(两天),我还是无法解决这个问题,所以我决定在这里询问。 在 Ubuntu 上使用时,如何恢复 Apple Magic Trackpad 2 的默认设置?

我的问题如下:我正在使用 Ubuntu 20.04 LTS。使用 Apple Magic Trackpad 2 一段时间后没有出现重大问题,但它停止工作了。(我通过电缆使用它)。我总是要用力点击才能移动光标。无法使用。我找到了一种解决方法 这里(Apple Magic Trackpad 2 配置)

它建议使用类似命令

xinput 设置属性 17 296 2, 2, 0

xinput list首先识别触控板的 ID(不是持久的!)。现在是 21。

⎜ ↳ Apple Inc. Magic Trackpad 2 id=21 [从属指针 (2)]

这些是我通过键入来识别的其属性xinput watch-props 21

Device 'Apple Inc. Magic Trackpad 2':
Device Enabled (171):   1
Coordinate Transformation Matrix (173): 1.000000, 0.000000, 0.000000, 0.000000,    1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (304): 1
Device Accel Constant Deceleration (305):   2.500000
Device Accel Adaptive Deceleration (306):   1.000000
Device Accel Velocity Scaling (307):    22.886030
Synaptics Edges (331):  -3031, 3287, -2048, 2157
Synaptics Finger (332): 70, 75, 0
Synaptics Tap Time (333):   180
Synaptics Tap Move (334):   402
Synaptics Tap Durations (335):  180, 180, 100
Synaptics ClickPad (336):   1
Synaptics Middle Button Timeout (337):  0
Synaptics Two-Finger Pressure (338):    279
Synaptics Two-Finger Width (339):   7
Synaptics Scrolling Distance (340): -182, 182
Synaptics Edge Scrolling (341): 0, 0, 0
Synaptics Two-Finger Scrolling (342):   1, 1
Synaptics Move Speed (343): 1.000000, 1.750000, 0.021875, 0.000000
Synaptics Off (344):    0
Synaptics Locked Drags (345):   0
Synaptics Locked Drags Timeout (346):   5000
Synaptics Tap Action (347): 0, 0, 0, 0, 1, 3, 2
Synaptics Click Action (348):   1, 3, 2
Synaptics Circular Scrolling (349): 0
Synaptics Circular Scrolling Distance (350):    0.100000
Synaptics Circular Scrolling Trigger (351): 0
Synaptics Circular Pad (352):   0
Synaptics Palm Detection (353): 1
Synaptics Palm Dimensions (354):    10, 198
Synaptics Coasting Speed (355): 20.000000, 50.000000
Synaptics Pressure Motion (356):    29, 158
Synaptics Pressure Motion Factor (357): 1.000000, 1.000000
Synaptics Resolution Detect (358):  1
Synaptics Grab Event Device (359):  0
Synaptics Gestures (360):   1
Synaptics Capabilities (361):   1, 0, 0, 1, 1, 1, 0
Synaptics Pad Resolution (362): 44, 47
Synaptics Area (363):   0, 0, 0, 0
Synaptics Soft Button Areas (364):  0, 0, 0, 0, 0, 0, 0, 0
Synaptics Noise Cancellation (365): 45, 45
Device Product ID (297):    1452, 613
Device Node (296):  "/dev/input/event25"

到目前为止,我还没有修改任何东西。根据上面提到的解决方法,我们现在需要识别“Synaptics Finger”ID,在本例中为 332(也不是持久的):

xinput set-prop 21 332 2, 2, 0

此后,它似乎开始起作用了。

但是,每当我重新启动计算机或触控板时,所有更改都会消失。我最初为这些命令添加了快捷方式;但是,它并不有效,因为拔下触控板后 ID 往往会发生变化。我也考虑过编写一个脚本,但是,它应该在我插入/打开触控板时生效 - 而不是在打开计算机时。

我想删除连接此触控板时存储的所有设置。就像一开始一样。 类似于以下解决方案苹果系统

到目前为止,我还尝试了以下命令恢复设置 - 但它们没有效果。 dconf reset -f / dconf reset -f /org/gnome/desktop/peripherals/mouse/ dconf reset -f /org/gnome/desktop/peripherals/touchpad/

在 Ubuntu 上使用时,如何恢复 Apple Magic Trackpad 2 的默认设置?或者,如何使这些更改持久?

非常感谢您的帮助!

答案1

我找到了一种使这些设置永久生效的方法。

将此部分添加到您的 /etc/X11/xorg.conf 文件中:

Section "InputClass"
    Identifier "Apple Magic Trackpad"
    MatchIsTouchpad "on"
    MatchUSBID "05ac:0265"
    Driver        "synaptics"
    Option        "VertScrollDelta" "50"
    Option        "HorizScrollDelta" "50"
    Option        "MinSpeed"        "0.6"
    Option        "MaxSpeed"        "1.3"
    Option        "AccelFactor"     "0.08"
    Option        "VertResolution"  "1"
    Option        "HorizResolution" "3"
    Option        "TapButton1"      "1"
    Option "TapButton3" "2"
    Option "VertEdgeScroll" "on"
    Option "VertTwoFingerScroll" "on"
    Option "HorizEdgeScroll" "on"
    Option "HorizTwoFingerScroll" "on"
    Option "CircularScrolling" "on"
    Option "CircScrollTrigger" "2"
    Option "EmulateTwoFingerMinZ" "40"
    Option "EmulateTwoFingerMinW" "8"
    Option "CoastingSpeed" "0"
    Option "FingerLow" "2"
    Option "FingerHigh" "2"
    Option "MaxTapTime" "125"
EndSection

这两个选项可以像 xinput 一样发挥作用:

Option "FingerLow" "2"
Option "FingerHigh" "2"

使用你的设备 ID 更新 USB ID,通过“lsusb”获取

希望有所帮助。

问候。

答案2

我使用以下脚本来设置 Logitech T650 和 Apple Magic Trackpad 2 的触控板设置

我使用 KDE 并将脚本添加为启动脚本,我保存了脚本~/bin/user-settings.sh,您可以通过执行手动调用它~/bin/user-settings.sh

我还需要调整的是

  1. 点按并拖动选择对我来说不起作用。单击并拖动以进行选择
  2. 我很不高兴无法在 KDE 中设置这些设置
  3. 你需要 libinput

我的系统上安装了以下软件包(Ubuntu 22.04 / KDE 5.24)

❯❯❯ sudo dpkg --list |grep input            
ii  inputattach                                   1:1.7.1-1build2                             amd64        utility to connect serial-attached peripherals to the input subsystem
ii  khotkeys:amd64                                4:5.24.4-0ubuntu1                           amd64        configure input actions settings
ii  khotkeys-data                                 4:5.24.4-0ubuntu1                           all          configure input actions settings
ii  libinput-bin                                  1.20.0-1                                    amd64        input device management and event handling library - udev quirks
ii  libinput10:amd64                              1.20.0-1                                    amd64        input device management and event handling library - shared library
ii  libqt5hunspellinputmethod5:amd64              5.15.3+dfsg-1                               amd64        Qt virtual keyboard - helper library for Hunspell input method
ii  libxcb-xinput0:amd64                          1.14-3ubuntu3                               amd64        X C Binding, xinput extension
ii  python3-evdev                                 1.4.0+dfsg-1build2                          amd64        Python 3 bindings for the Linux input subsystem
ii  xinput                                        1.6.3-1build2                               amd64        Runtime configuration and test of XInput devices
ii  xserver-xorg-input-all                        1:7.7+23ubuntu2                             amd64        X.Org X server -- input driver metapackage
ii  xserver-xorg-input-libinput                   1.2.1-1                                     amd64        X.Org X server -- libinput input driver
ii  xserver-xorg-input-synaptics                  1.9.1-1ubuntu3                              amd64        Synaptics TouchPad driver for X.Org server
ii  xserver-xorg-input-wacom                      1:1.0.0-3ubuntu1                            amd64        X.Org X server -- Wacom input driver

下面是脚本。让我知道你的想法,也许我们可以得到一个完美的设置?

#!/usr/bin/env bash

# set touchpad settings
echo "Set Trackpad Settings"
DEVICE_NAME_IDENTIFIER="T650|Magic Trackpad 2"
# next we get the id of the device
DEVICE_ID=$(xinput -list |grep -iE "$DEVICE_NAME_IDENTIFIER"  | cut -d "=" -f2 | awk '{ print $1 }')

if [[ $DEVICE_ID -gt 0 ]] ; then
    echo "Logitech Touchpad T650 or Apple Magic Trackpad found - applying settings"
    # next we find all of the id's of the properties we want to set
    #xinput list-props $DEVICE_ID 

    SETTINGS=(
        'Device Accel Profile|2'
        'Device Accel Constant Deceleration|1.500000'
        'Device Accel Adaptive Deceleration|1.000000'
        'Device Accel Velocity Scaling|1.00000'
        'Synaptics Tap Time|110'
        'Synaptics Tap Move|180'
        'Synaptics Tap Durations|120, 110, 110'
        'Synaptics Middle Button Timeout|100'
        'Synaptics Two-Finger Pressure|162'
        'Synaptics Scrolling Distance|50, 50'
        'Synaptics Two-Finger Scrolling|1, 1'
        'Synaptics Move Speed|1.97737, 3.919290, 0.054371, 0.000000'
        'Synaptics Locked Drags|0'
        'Synaptics Locked Drags Timeout|5000'
        'Synaptics Tap Action|2, 3, 0, 0, 1, 3, 0'
        'Synaptics Click Action|1, 3, 0'
        'Synaptics Circular Scrolling|0'
        'Synaptics Circular Scrolling Distance|0.100007'
        'Synaptics Circular Scrolling Trigger|0'
        'Synaptics Palm Detection|0'
        'Synaptics Coasting Speed|95.000000, 95.000000'
        'Synaptics Pressure Motion|110, 110'
        'Synaptics Off|0'
        'Synaptics Pressure Motion Factor|1.000000, 1.000000'
        'Synaptics Resolution Detect|1'
        'Synaptics Gestures|1'
        # 'Synaptics Capabilities|1, 0, 0, 1, 1, 1, 1'
        'Synaptics Area|0, 0, 0, 0'
        'Synaptics Noise Cancellation|10, 10'
        'Synaptics Finger|2, 4, 0'
    )

    for fields in "${SETTINGS[@]}" # quotes around settings array needed otherwise strings are split by space
        do
            # echo "fields are: $fields"
            IFS=$'|' read -r property setting <<< "$fields"
            # echo "property: $property value: $setting"
            SYNAPTICS_PROP_ID=$(xinput list-props $DEVICE_ID |grep -m1 "$property" | cut -d "(" -f2 | cut -d ")" -f1 |grep -o '[0-9]\+')
            CURENT_PROPERTY_VALUE=$(xinput list-props $DEVICE_ID |grep -m1 "$property")
            echo "Current vs New: $CURENT_PROPERTY_VALUE:$setting"
            xinput set-prop $DEVICE_ID $SYNAPTICS_PROP_ID $setting
        done
    
else
    echo "Logitech Touchpad T650 or Apple Magic Trackpad not found - exiting"
    exit 1

fi

相关内容