我试图从触摸板上读取原始多点触控数据,但我没有得到我期望的结果。
我首先使用lsinput
确定设备ID:
/dev/input/event0
bustype : BUS_HOST
vendor : 0x0
product : 0x5
version : 0
name : "Lid Switch"
phys : "PNP0C0D/button/input0"
bits ev : EV_SYN EV_SW
/dev/input/event1
bustype : BUS_HOST
vendor : 0x0
product : 0x1
version : 0
name : "Power Button"
phys : "PNP0C0C/button/input0"
bits ev : EV_SYN EV_KEY
/dev/input/event2
bustype : BUS_HOST
vendor : 0x0
product : 0x1
version : 0
name : "Power Button"
phys : "LNXPWRBN/button/input0"
bits ev : EV_SYN EV_KEY
/dev/input/event3
bustype : BUS_I8042
vendor : 0x1
product : 0x1
version : 43907
name : "AT Translated Set 2 keyboard"
phys : "isa0060/serio0/input0"
bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP
/dev/input/event4
bustype : BUS_HOST
vendor : 0x0
product : 0x6
version : 0
name : "Video Bus"
phys : "LNXVIDEO/video/input0"
bits ev : EV_SYN EV_KEY
/dev/input/event5
bustype : BUS_HOST
vendor : 0x0
product : 0x6
version : 0
name : "Video Bus"
phys : "LNXVIDEO/video/input0"
bits ev : EV_SYN EV_KEY
/dev/input/event6
bustype : BUS_I8042
vendor : 0x2
product : 0x7
version : 433
name : "SynPS/2 Synaptics TouchPad"
phys : "isa0060/serio1/input0"
bits ev : EV_SYN EV_KEY EV_ABS
/dev/input/event7
bustype : BUS_HOST
vendor : 0x0
product : 0x0
version : 0
name : "Ideapad extra buttons"
phys : "ideapad/input0"
bits ev : EV_SYN EV_KEY EV_MSC
/dev/input/event8
bustype : BUS_USB
vendor : 0x4f2
product : 0xb57e
version : 34624
name : "EasyCamera: EasyCamera"
phys : "usb-0000:00:14.0-6/button"
bits ev : EV_SYN EV_KEY
/dev/input/event9
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH Mic"
phys : "ALSA"
bits ev : EV_SYN EV_SW
/dev/input/event10
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH Headphone"
phys : "ALSA"
bits ev : EV_SYN EV_SW
/dev/input/event11
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH HDMI/DP,pcm=3"
phys : "ALSA"
bits ev : EV_SYN EV_SW
/dev/input/event12
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH HDMI/DP,pcm=7"
phys : "ALSA"
bits ev : EV_SYN EV_SW
/dev/input/event13
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH HDMI/DP,pcm=8"
phys : "ALSA"
bits ev : EV_SYN EV_SW
/dev/input/event14
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH HDMI/DP,pcm=9"
phys : "ALSA"
bits ev : EV_SYN EV_SW
/dev/input/event15
bustype : (null)
vendor : 0x0
product : 0x0
version : 0
name : "HDA Intel PCH HDMI/DP,pcm=10"
phys : "ALSA"
bits ev : EV_SYN EV_SW
由于我没有看到列出的任何设备here,我决定选择/dev/input/event6
(SynPS/2 Synaptics TouchPad
),这似乎与我想要的最接近。
现在,我已经编写了一个简单易用的代码来尝试从中获取最大MT点数:
int main(void)
{
struct libevdev *dev;
int fd;
int rc;
fd = open("/dev/input/event6", O_RDONLY|O_NONBLOCK);
if (fd < 0)
fprintf(stderr, "error: %d %s\n", errno, strerror(errno));
rc = libevdev_new_from_fd(fd, &dev);
if (rc < 0)
fprintf(stderr, "error: %d %s\n", -rc, strerror(-rc));
int n = libevdev_get_num_slots(dev);
printf("%d\n", n);
return 0;
}
我可以使用gcc -levdev myfile.c
进行编译并正确运行,但我只能获得2
。
这是否意味着我的触控板仅处理两个点?这很奇怪,因为它可以在Windows上处理(至少)4个。
你对此有什么想法吗?
小更新:使用libinput-debug-events
,我得到以下输出
使用1个手指时:
event6 POINTER_MOTION +0.79s 0.00/ -6.22
event6 POINTER_MOTION +0.80s 0.00/-11.26
event6 POINTER_MOTION +0.81s 0.00/ -9.93
event6 POINTER_MOTION +0.82s 1.69/ -9.05
使用2根手指时:
event6 POINTER_AXIS +0.60s vert -9.27* horiz 1.19* (finger)
event6 POINTER_AXIS +0.62s vert -13.25* horiz 2.03* (finger)
event6 POINTER_AXIS +0.65s vert -15.89* horiz 2.03* (finger)
使用3根手指时:
event6 GESTURE_PINCH_UPDATE +0.68s 4 1.42/-1.54 ( 5.49/-5.97 unaccelerated) 0.99 @ 0.15
event6 GESTURE_PINCH_UPDATE +0.71s 4 0.00/-0.31 ( 0.00/-0.89 unaccelerated) 0.99 @ 0.07
event6 GESTURE_PINCH_UPDATE +0.73s 4 1.03/-3.44 ( 3.20/-10.74 unaccelerated) 0.98 @ 0.74
使用4根手指时:
event6 GESTURE_SWIPE_UPDATE +0.80s 4 0.00/-0.89 ( 0.00/-6.86 unaccelerated)
event6 GESTURE_SWIPE_UPDATE +0.82s 4 0.00/-1.18 ( 0.00/-7.16 unaccelerated)
event6 GESTURE_SWIPE_UPDATE +0.84s 4 0.68/-3.48 ( 3.20/-16.40 unaccelerated)
所以看起来我的系统上有一些能够检测和阅读至少四个手指的东西......但出于某种原因,我无法用libevdev获取它们。 。