Techyou labs
真正的爱应该超越生命的长度,心灵的宽度,灵魂的深度
常用标签

输入子系统由输入子驱动层(input driver),系统核心层(input core)和事件处理层(Event Handler)三部分组成。一个输入事件,比如滑动触摸屏都是通过input driver -> input core -> event handler -> user space 到达用户空间传给应用程序。

X server默认使用 libinput 驱动(xf86-input-libinput) 处理输入设备,xf86-input-evdev 和相关驱动是后备方案。配置文件是 /usr/share/X11/xorg.conf.d/ 中的 10-evdev.conf 40-libinput.conf

Udev由 systemd 通过 xorg-server提供,会自动检测硬件,使用 evdev 或 libinput 处理设备的输入.


Input Devices
  /dev/input

Input Drivers


xserver-xorg-input-all                驱动包
  xserver-xorg-input-evdev        键盘,触摸屏
  xserver-xorg-input-vmmouse      鼠标
  xserver-xorg-input-wacom        数位板/触摸板

其他


xserver-xorg-input-libinput     键盘
  xserver-xorg-input-synaptics    触摸板 (即将弃用)
  xserver-xorg-input-joystick     遥杆
  xserver-xorg-input-mtrack         触摸板 (推荐使用)
  xserver-xorg-input-mutrack        触摸板 (年久失修)
  xserver-xorg-input-void           空输入设备
  xserver-xorg-input-xwiimote       Wii设备
  xserver-xorg-input-acecad         绘图板
Input Conf
/etc/X11/xorg.conf
/usr/share/X11/xorg.conf.d/
/usr/share/X11/xkb

Input Log
/var/log/Xorg.0.log

linux下的触摸手势方案挺多,早先的touchegg,后来的libinput-gestures, 以及最近gebaar-libinput。当然紧跟libinput上有的xf86-input-mtrack配置更简单。

debian系列用户直接安装对应的驱动包即可,当然也可以手动编译安装最新的版本,地址在文末


apt-get install xserver-xorg-input-mtrack

xinput list 查看自己的触控板标识以及支持情况,比如我的


renothing@desktop:~[master]$ xinput list
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                  id=12   [slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse                id=9    [slave  pointer  (2)]

xinput list 12


Reporting 7 classes:
                Class originated from: 12. Type: XIButtonClass
                Buttons supported: 7
                Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
                Button state:
                Class originated from: 12. Type: XIValuatorClass
                Detail for Valuator 0:
                  Label: Rel X
                  Range: -1.000000 - -1.000000
                  Resolution: 0 units/m
                  Mode: relative
                Class originated from: 12. Type: XIValuatorClass
...

懒得做说明,直接贴配置文件 /etc/X11/xorg.conf.d/10-mtrack.conf


Section "InputClass"
        Identifier "ETPS/2 Elantech Touchpad"
        MatchIsTouchpad "true"
        Driver "mtrack"
        MatchDevicePath "/dev/input/event*"
        Option  "Sensitivity" "1.1"
        Option  "FingerHigh" "5"
        Option  "FingerLow" "5"
        Option  "IgnoreThumb" "true"
        Option  "ThumbRatio" "70"
        Option  "ThumbSize" "25"
        Option  "IgnorePalm" "true"
        # This ignores tap-to-click, which causes more problems than benefit in my experience
        Option  "TapButton1" "0"
        Option  "TapButton2" "0"
        Option  "TapButton3" "0"
        # If you want a middle-click, then "ClickFinger2" should be value "2"
        Option  "ClickFinger1" "1"
        Option  "ClickFinger2" "1"
        Option  "ClickFinger3" "3"
        Option  "ButtonMoveEmulate" "true"
        Option  "ButtonIntegrated" "true"
        Option  "ButtonEnable" "true"
        # "ButtonZonesEnable" means that your trackpad gets divided into three equal sections, where clicking any third of the touchpad sends the click code in "ClickFingerX". Since I didn't
 want middle-click, the left two thirds of my touchpad are left click, and the right third is right click:
        Option  "ButtonZonesEnable" "false"
        Option  "ClickTime" "25"
        # Ensures that bottom 5% of touchpad doesn't register taps
        Option  "EdgeBottomSize" "5"
        Option  "SwipeLeftButton" "8"
        Option  "SwipeRightButton" "9"
        Option  "SwipeUpButton" "0"
        Option  "SwipeDownButton" "0"
        Option  "SwipeDistance" "700"
        # ScrollCoast makes touchpad feel a bit more Mac-like, although it coasts in chunks and isn't relative to speed at which two finger scroll was happening
        Option  "ScrollCoastDuration" "600"
        Option  "ScrollCoastEnableSpeed" "0.05"
        # This sets up Macbook-like natural scroll. If you want to scroll down by swiping your fingers down, reverse the "5" and the "4" here:
        Option  "ScrollUpButton" "5"
        Option  "ScrollDownButton" "4"
        Option  "ScrollLeftButton" "7"
        Option  "ScrollRightButton" "6"
        # Without this option set to a high value, there are types of click+hold-and-move functionality (most easily reproed by click and then move up-right) that get ignored
        Option  "Hold1Move1StationaryMaxMove" "1000"
        # Smaller ScrollDistance translates to faster scrolling. ScrollDistance of 10 scrolls a long page in one swipe.
        Option  "ScrollDistance" "22"
        Option  "ScrollClickTime" "12"
        Option  "ScrollSensitivity" "0"
EndSection

具体配置选项请参考官网手册:https://github.com/p2rkw/xf86-input-mtrack

参考:

暂无评论

添加新评论