如何捕获触摸屏事件?

如何捕获触摸屏事件?

我想捕获触摸屏生成的事件,并将它们列在终端窗口中。我试过了xev,但它没有显示触摸屏事件。

我正在使用 Ubuntu 17.10 和 Xorg。

有命令可以执行此操作吗?

答案1

解决方案是使用

xinput --test-xi2 --root

这是示例输出...

xinput --test-xi2 --root
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=15   [slave  pointer  (2)]
⎜   ↳ HP Bluetooth Mouse Z5000                  id=18   [slave  pointer  (2)]
⎜   ↳ ELAN22CA:00 04F3:22CA Pen Pen (0)         id=19   [slave  pointer  (2)]
⎜   ↳ ELAN22CA:00 04F3:22CA                     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)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ Power Button                              id=9    [slave  keyboard (3)]
    ↳ HP TrueVision FHD RGB-IR: HP Tr           id=10   [slave  keyboard (3)]
    ↳ ELAN22CA:00 04F3:22CA Pen                 id=12   [slave  keyboard (3)]
    ↳ Intel Virtual Button driver               id=13   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]
    ↳ HP Wireless hotkeys                       id=16   [slave  keyboard (3)]
    ↳ HP WMI hotkeys                            id=17   [slave  keyboard (3)]
.
.
.
EVENT type 22 (RawTouchBegin)
    device: 2 (11)
    detail: 117
    valuators:
          0: 33301.98 (33301.98)
          1: 4413.52 (4413.52)

EVENT type 6 (Motion)
    device: 11 (11)
    detail: 0
    flags: emulated
    root: 749.29/540.47
    event: 749.29/540.47
    buttons:
    modifiers: locked 0 latched 0 base 0 effective: 0
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
        0: 33301.98
        1: 4413.52
    windows: root 0x211 event 0x211 child 0x80331f

相关内容