#include <sys/types.h>
#include <sys/ipc.h>
#include <stdio.h>
#include <fcntl.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/ioctl.h>
#define TS_DEV "/dev/input/event0"
static int ts_fd=-1;
typedef struct {
unsigned short pressure;
unsigned short x;
unsigned short y;
unsigned short pad;
} TS_RET;
int main()
{
TS_RET data;
if((ts_fd=open(TS_DEV,O_RDONLY))<0)
{
printf("Error opening %s device!\n",TS_DEV);
return -1;
}
while(1)
{
read(ts_fd,&data,sizeof(data));
printf("x=%d,y=%d,pressure=%d\n",data.x,data.y,data.pressure);
}
return 0;
}
这样的测试程序可以吗,我试过怎么不行呢,按下触摸屏后串口终端打印出来的信息一直没有变化