由于触屏上报的坐标不准,写一个简单的程序测试。代码为:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <dirent.h>
#include <fcntl.h>
#include <linux/input.h>
#include <unistd.h>
#define EVENT_DIR "/dev/input/event"
int main(int argc, char *argv[])
{
int fd;
int id = 0;
char ids = 0;
int res = 0;
char event_file[100] = {0};
struct input_event event;
//0 - 0x30
//9 - 0x39
if ((argc > 1) && strlen(argv[1]) == 1) {
ids = argv[1][0];
if ((ids >= 0x30) && (ids <= 0x39)) {
id = ids - 0x30;
}
}
snprintf(event_file, sizeof(event_file), "%s%d", EVENT_DIR, id);
fd = open(event_file, O_RDWR);
if (fd < 0) {
printf("failed to open file: %s\n", event_file);
return -1;
} else {
pr