#include
#include
#include
#include
#include
#include
#include
#define TS_DEV "/dev/touchscreen/0" //设备文件要看下/dev目录
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;
}
阅读(917) | 评论(0) | 转发(1) |