Xinput 设置对我的鼠标和/或触摸板没有影响,并且在注销/重启后也不会持久。

Xinput 设置对我的鼠标和/或触摸板没有影响,并且在注销/重启后也不会持久。

我是一名 Linux 学习者,所以请对我讲得轻松一点。我使用的是 Linux mint 和 XFCE4,没有特别定制。我在使用 Elantech 触摸板的笔记本电脑上使用它。默认情况下,使用 Elantech 触摸板非常糟糕。它非常不准确,使用起来令人沮丧,尤其是因为它在尝试细微移动时速度太快。当我尝试在 XFCE4 设置 gui 和 xinput 中更改 sens 和加速度的设置时,例如:

xinput set-prop 'Elan Touchpad' 'Device Accel Constant Deceleration' 1.0

什么都没发生。这也适用于我的 USB 鼠标。起初我以为这些可能只在重新启动后才适用,所以我就这样做了。当它恢复时,列出的所有道具

xinput list-props 'Elan Touchpad'

被重置为我重启之前的状态。经过进一步测试,我发现在注销并登录后,它们也被重置了。

我现在的位置是:

Xinput 设置更改是否需要重启?如果不需要,则似乎是其他软件在控制我的鼠标,我需要对此进行诊断。

在登录/启动过程中,可能在哪里设置这些设置?它们不在 /usr/share/X11/xorg.conf.d 中,是的,我已经检查过了。

我可以用新的鼠标驱动程序完全避免这个问题吗?有没有推荐的 Elantech 触摸板?我见过其他人也有这个问题(糟糕的 elan pad 驱动程序),但没有建议。

非常感谢。

答案1

确保 xinput 接受这些设置且没有错误。然后可以将它们放入 shell 脚本中。我的脚本位于 .xinputrc 中,由 .xinitrc 加载。我的 i2c 触摸板可能不一样,所以要小心,不要逐字复制所有内容。这是我的设置:

#!/bin/sh
xinput --set-prop "ELAN1300:00 04F3:3057 Touchpad" "Device Accel Profile" "1"
xinput --set-prop "ELAN1300:00 04F3:3057 Touchpad" "Device Accel Constant Deceleration" "1.000000"
xinput --set-prop "ELAN1300:00 04F3:3057 Touchpad" "Device Accel Adaptive Deceleration" "1.000000"
xinput --set-prop "ELAN1300:00 04F3:3057 Touchpad" "Device Accel Velocity Scaling" "1.000000"
xinput --set-ptr-feedback "ELAN1300:00 04F3:3057 Touchpad" 4 2 1

然后可以使用 xinput 找到设置:

Device 'ELAN1300:00 04F3:3057 Touchpad':
Device Enabled (152):   1
Coordinate Transformation Matrix (154): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (280): 1
Device Accel Constant Deceleration (281):   1.000000
Device Accel Adaptive Deceleration (282):   1.000000
Device Accel Velocity Scaling (283):    1.000000
Synaptics Edges (284):  128, 3080, 119, 2091
Synaptics Finger (285): 5, 60, 0
Synaptics Tap Time (286):   180
Synaptics Tap Move (287):   171
Synaptics Tap Durations (288):  180, 2, 100
Synaptics ClickPad (289):   1
Synaptics Middle Button Timeout (290):  0
Synaptics Two-Finger Pressure (291):    282
Synaptics Two-Finger Width (292):   7
Synaptics Scrolling Distance (293): 154, 77
Synaptics Edge Scrolling (294): 0, 0, 0
Synaptics Two-Finger Scrolling (295):   1, 0
Synaptics Move Speed (296): 1.000000, 1.000000, 0.000000, 0.000000
Synaptics Off (297):    1 <- because of syndaemon with typing
Synaptics Locked Drags (298):   0
Synaptics Locked Drags Timeout (299):   5000
Synaptics Tap Action (300): 0, 0, 0, 0, 0, 0, 0
Synaptics Click Action (301):   1, 3, 2
Synaptics Circular Scrolling (302): 0
Synaptics Circular Scrolling Distance (303):    0.100000
Synaptics Circular Scrolling Trigger (304): 0
Synaptics Circular Pad (305):   0
Synaptics Palm Detection (306): 1
Synaptics Palm Dimensions (307):    10, 200
Synaptics Coasting Speed (308): 20.000000, 50.000000
Synaptics Pressure Motion (309):    30, 160
Synaptics Pressure Motion Factor (310): 1.000000, 1.000000
Synaptics Grab Event Device (311):  0
Synaptics Gestures (312):   1
Synaptics Capabilities (313):   1, 0, 0, 1, 1, 0, 0
Synaptics Pad Resolution (314): 32, 31
Synaptics Area (315):   0, 0, 0, 0
Synaptics Soft Button Areas (316):  1924, 0, 1812, 0, 1283, 1892, 1812, 0
Synaptics Noise Cancellation (317): 19, 19
Device Product ID (276):    1267, 12375
Device Node (275):  "/dev/input/event15"

Xorg.0.log 中显示的一些设置我不知道如何设置,所以这仍然是一个谜:

 [21.058] (II) config/udev: Adding input device ELAN1300:00 04F3:3057 Touchpad (/dev/input/event15)
 [21.058] (**) ELAN1300:00 04F3:3057 Touchpad: Applying InputClass "evdev touchpad catchall"
 [21.058] (**) ELAN1300:00 04F3:3057 Touchpad: Applying InputClass "libinput touchpad catchall"
 [21.058] (**) ELAN1300:00 04F3:3057 Touchpad: Applying InputClass "touchpad catchall"
 [21.058] (**) ELAN1300:00 04F3:3057 Touchpad: Applying InputClass "Default clickpad buttons"
 [21.058] (**) ELAN1300:00 04F3:3057 Touchpad: Applying InputClass "touchpad catchall"
 [21.058] (**) ELAN1300:00 04F3:3057 Touchpad: Applying InputClass "Synaptics Clickpad"
 [21.058] (II) LoadModule: "synaptics"
 [21.059] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so
 [21.060] (II) Module synaptics: vendor="X.Org Foundation"
 [21.060]   compiled for 1.20.0, module version = 1.9.1
 [21.060]   Module class: X.Org XInput Driver
 [21.060]   ABI class: X.Org XInput driver, version 24.1
 [21.060] (II) Using input driver 'synaptics' for 'ELAN1300:00 04F3:3057 Touchpad'
 [21.060] (**) ELAN1300:00 04F3:3057 Touchpad: always reports core events
 [21.060] (**) Option "Device" "/dev/input/event15"
 [21.186] (II) synaptics: ELAN1300:00 04F3:3057 Touchpad: found clickpad property
 [21.186] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: x-axis range 0 - 3208 (res 31)
 [21.186] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: y-axis range 0 - 2210 (res 32)
 [21.186] (II) synaptics: ELAN1300:00 04F3:3057 Touchpad: device does not report pressure, will use touch data.
 [21.186] (II) synaptics: ELAN1300:00 04F3:3057 Touchpad: device does not report finger width.
 [21.186] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: buttons: left double triple
 [21.186] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: Vendor 0x4f3 Product 0x3057
 [21.186] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: invalid pressure range.  defaulting to 0 - 255
 [21.186] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: invalid finger width range.  defaulting to 0 - 15
 [21.186] (**) Option "FingerLow" "5"
 [21.186] (**) Option "FingerHigh" "60"
 [21.186] (**) Option "MaxTapTime" "1"
 [21.186] (**) Option "MaxDoubleTapTime" "2"
 [21.186] (**) Option "HasSecondarySoftButtons" "0"
 [21.186] (**) Option "EmulateMidButtonTime" "0"
 [21.187] (**) Option "VertScrollDelta" "154"
 [21.187] (**) Option "CornerCoasting" "0"
 [21.187] (**) Option "LockedDrags" "0"
 [21.187] (**) Option "CircularPad" "0"
 [21.187] (**) Option "PalmDetect" "1"
 [21.187] (**) Option "MinSpeed" "0.9"
 [21.187] (**) Option "MaxSpeed" "0.9"
 [21.187] (**) Option "AccelFactor" "0"
 [21.187] (**) Option "SoftButtonAreas" "60% 0 82% 0 40% 59% 82% 0"
 [21.187] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: touchpad found
 [21.187] (**) ELAN1300:00 04F3:3057 Touchpad: always reports core events
 [21.206] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-6/i2c-ELAN1300:00/0018:04F3:3057.0001/input/input18/event15"
 [21.206] (II) XINPUT: Adding extended input device "ELAN1300:00 04F3:3057 Touchpad" (type: TOUCHPAD, id 11)
 [21.206] (**) synaptics: ELAN1300:00 04F3:3057 Touchpad: (accel) MinSpeed is now constant deceleration 1.1
 [21.206] (**) synaptics: ELAN1300:00 04F3:3057 Touchpad: (accel) MaxSpeed is now 1.00
 [21.206] (**) synaptics: ELAN1300:00 04F3:3057 Touchpad: (accel) AccelFactor is now 0.000
 [21.206] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) keeping acceleration scheme 1
 [21.206] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) acceleration profile 1
 [21.206] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) acceleration factor: 2.000
 [21.206] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) acceleration threshold: 4
 [21.207] (--) synaptics: ELAN1300:00 04F3:3057 Touchpad: touchpad found
 [21.208] (II) config/udev: Adding input device ELAN1300:00 04F3:3057 Touchpad (/dev/input/mouse0)
 [21.208] (**) ELAN1300:00 04F3:3057 Touchpad: Ignoring device from InputClass "touchpad ignore duplicates"

我的 /etc/X11/xorg.conf.d/70-synaptics.conf 具有前面答案中提到的这些内容,但没有您正在进行的 xinput 设置,并且不包含在 synaptics 驱动程序中:

Section "InputClass"
    Identifier "Synaptics Clickpad"
    Driver "synaptics"
    MatchIsTouchpad "on"

    Option "SoftButtonAreas" "60% 0 82% 0 40% 59% 82% 0"
    Option "MaxTapTime" "1"
    Option "MaxDoubleTapTime" "2"
    Option "HasSecondarySoftButtons" "0"
    Option "EmulateMidButtonTime" "0"
    Option "CornerCoasting" "0"
    Option "FingerLow" "5"
    Option "FingerHigh" "60"
    Option "LockedDrags" "0"
    Option "CircularPad" "0"
    Option "PalmDetect" "1"
    Option "AccelFactor" "0"
    Option "VertScrollDelta" "154"
    Option "MinSpeed" "0.9"
    Option "MaxSpeed" "0.9"
    Option "AccelProfile" "flat"
    Option "AccelSpeed" "0.0"
EndSection

我希望有一种简单的方法可以将 xinput 中的当前设置转储到每次都可以加载并轻松修改的配置文件中。一个简单的 awk 脚本可能也可以工作。

编辑:谜底揭开。我终于将加速设置放入一个新文件中:/etc/X11/xorg.conf.d/80-pointer.conf

Section "InputClass"
  Identifier "ELAN1300"
  MatchIsTouchpad "on"
  MatchProduct "ELAN1300:00"
  Option "AccelerationProfile" "1"
  Option "AccelerationScheme" "predictable"
  Option "AccelerationThreshold" "5"
  Option "AccelerationNumerator" "2"
  Option "AccelerationDenominator" "1"
  Option "ConstantDeceleration" "2.4"
  Option "AdaptiveDeceleration" "2.1"
EndSection

然后我在我的 Xorg.0.log 中得到了这些:

[ 16732.671] (II) XINPUT: Adding extended input device "ELAN1300:00 04F3:3057 Touchpad" (type: TOUCHPAD, id 11)
[ 16732.671] (**) synaptics: ELAN1300:00 04F3:3057 Touchpad: (accel) MinSpeed is now constant deceleration 2.5
[ 16732.671] (**) synaptics: ELAN1300:00 04F3:3057 Touchpad: (accel) MaxSpeed is now 1.75
[ 16732.671] (**) synaptics: ELAN1300:00 04F3:3057 Touchpad: (accel) AccelFactor is now 0.051
[ 16732.671] (**) Option "AccelerationScheme" "predictable"
[ 16732.671] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) keeping acceleration scheme 1
[ 16732.671] (**) Option "ConstantDeceleration" "2.4"
[ 16732.671] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) constant deceleration by 2.4
[ 16732.671] (**) Option "AdaptiveDeceleration" "2.1"
[ 16732.671] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) adaptive deceleration by 2.1
[ 16732.671] (**) Option "AccelerationProfile" "1"
[ 16732.672] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) acceleration profile 1
[ 16732.672] (**) Option "AccelerationNumerator" "2"
[ 16732.672] (**) Option "AccelerationDenominator" "1"
[ 16732.672] (**) Option "AccelerationThreshold" "5"
[ 16732.672] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) acceleration factor: 2.000
[ 16732.672] (**) ELAN1300:00 04F3:3057 Touchpad: (accel) acceleration threshold: 5

因此,不再需要使用 shell 脚本来更改这些设置。它们是 Xserver 的一部分,而不是 synaptics 驱动程序的一部分。这些加速设置似乎工作正常,尽管我还没有弄清楚它们。我实际上是在尝试更好地控制点击和单击。我现在使用 VertEdgeScroll 而不是 VertTwoFingerScroll,一些不稳定性已经消失。

答案2

1)xinput更改直接作用于 X 服务器输入驱动程序。这些更改立即生效,无需重新启动,也不会存储在任何地方,因此在重新启动或重启 X 服务器后,这些更改将消失。

2) 要进行永久性更改,最简单的方法是创建一个xorg.conf带有InputDeviceInputClass部分的。默认情况下不存在这些部分xorg.conf(事实上,通常根本没有xorg.conf),必须添加。

请注意,选项的名称并不总是与xinput属性列表中的名称完全相同。注意空格和大小写。有关详细信息,请参阅man xorg.conf以及man evdevElan Touchpad 驱动程序的手册页(请参阅Xorg.log)。网络上也有很多教程。

3) 我不熟悉 Elan Touchpad,也没有看到完整的属性列表,但属性通常协同工作,并且可能仅在某些模式或配置(由其他属性控制)下有效。因此,您可能需要在“设备加速恒定减速”的更改生效之前设置其他属性。此外,请确保再次检查-list-props设置是否已注册。

相关内容