现在又一个问题,想读取触摸屏的坐标怎么读取啊,
触摸屏是输入子系统
是读取/dev/input/event0
但我只能读取一个坐标是对的
有人做过这个或者是知道触摸屏坐标怎么读取吗?
帮小弟一把
我写的程序为
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/time.h>
#include <errno.h>
#include <linux/input.h>
int main()
{
int fd,count;
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
struct input_event ev_button[3];
fd = open("/dev/input/event0", 0);
if (fd < 0) {
perror("open device buttons");
exit(1);
}
count=read(fd,ev_button,sizeof(struct input_event));
printf("type:%d code:%d value:%d\n",ev_button[2].type,ev_button[2].code,ev_button[2].value);
printf("type:%d code:%d value:%d\n",ev_button[0].type,ev_button[0].code,ev_button[0].value);
printf("type:%d code:%d value:%d\n",ev_button[1].type,ev_button[1].code,ev_button[1].value);
printf("type:%d code:%d value:%d\n",ev_button[3].type,ev_button[3].code,ev_button[3].value);
close(fd);
return 0;
}