linux触摸屏校准软件,Linux系统下Libinput驱动的应用(主要在触摸屏校准)

Devices with absolute axes are those that send positioning data for an axis in a device-specific coordinate range, defined by a minimum and a maximum value.

Compare this to relative devices (e.g. a mouse) that can only detect directional data, not positional data.

libinput supports three types of devices with absolute axes:

multi-touch screens

single-touch screens

Touchpads are technically absolute devices but libinput converts the axis values to directional motion and posts events as relative events. Touchpads do not count as absolute devices in libinput.

For all absolute devices in libinput, the default unit for x/y coordinates is in mm off the top left corner on the device, or more specifically off the device's sensor. If the device is physically rotated from its natural position and this rotation was communicated to libinput (e.g. by setting the device left-handed), the coordinate origin is

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是两种Linux触摸屏校准的方法: 1. 使用tslib编写触摸屏校准程序 如果你使用的是嵌入式Linux系统,并且已经安装了QT5.6版本和tslib库,你可以编写一个触摸屏校准程序。以下是一个示例程序: ```c #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <linux/input.h> #include <tslib.h> #define DEVICE_NAME "/dev/input/event0" #define CALIBRATION_FILE "/etc/pointercal" int main(int argc, char *argv[]) { struct tsdev *ts; struct ts_sample samp[5]; int fd, i; struct ts_sample *calib; struct ts_sample *calib_result; int xres, yres; ts = ts_open(DEVICE_NAME, 0); if (!ts) { perror("ts_open"); exit(1); } if (ts_config(ts)) { perror("ts_config"); exit(1); } calib = malloc(sizeof(struct ts_sample) * 5); calib_result = malloc(sizeof(struct ts_sample) * 5); printf("Please touch the screen at the center of the cross.\n"); for (i = 0; i < 5; i++) { ts_read(ts, &samp[i], 1); calib[i] = samp[i]; } calib_result[2].x = xres / 2; calib_result[2].y = yres / 2; printf("Please touch the screen at the top-left corner of the screen.\n"); for (i = 0; i < 5; i++) { ts_read(ts, &samp[i], 1); calib[i].x = samp[i].x; calib[i].y = samp[i].y; } calib_result[0].x = 0; calib_result[0].y = 0; printf("Please touch the screen at the bottom-right corner of the screen.\n"); for (i = 0; i < 5; i++) { ts_read(ts, &samp[i], 1); calib[i].x = samp[i].x; calib[i].y = samp[i].y; } calib_result[4].x = xres - 1; calib_result[4].y = yres - 1; printf("Please touch the screen at the top-right corner of the screen.\n"); for (i = 0; i < 5; i++) { ts_read(ts, &samp[i], 1); calib[i].x = samp[i].x; calib[i].y = samp[i].y; } calib_result[1].x = xres - 1; calib_result[1].y = 0; printf("Please touch the screen at the bottom-left corner of the screen.\n"); for (i = 0; i < 5; i++) { ts_read(ts, &samp[i], 1); calib[i].x = samp[i].x; calib[i].y = samp[i].y; } calib_result[3].x = 0; calib_result[3].y = yres - 1; ts_close(ts); fd = open(CALIBRATION_FILE, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { perror("open"); exit(1); } dprintf(fd, "%d %d %d %d %d %d %d %d %d\n", calib_result[0].x, calib_result[0].y, calib_result[1].x, calib_result[1].y, calib_result[2].x, calib_result[2].y, calib_result[3].x, calib_result[3].y, calib_result[4].x, calib_result[4].y); close(fd); printf("Calibration data saved to %s.\n", CALIBRATION_FILE); return 0; } ``` 2. 使用xinput_calibrator命令行工具校准触摸设备 如果你使用的是Linux桌面系统,你可以使用xinput_calibrator命令行工具校准触摸设备。以下是一个示例命令: ``` xinput_calibrator -v --device <device name or id> ``` 其中,`<device name or id>`是你要校准的触摸设备的名称或ID。你可以使用`xinput list`命令查看所有输入设备的列表。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值