|
根据局天嵌的天嵌科技出品-Linux移植之Step By Step_V4.5_20100605.pdf 移植的触摸屏驱动程序,移植驱动正常,测试才如下
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <linux/input.h>
struct input_event buff;
int main(void)
{
int fd;
int ret;
int count=0;
fd = open("/dev/event0",O_RDWR);
if(fd<0)
{
perror("can not open event0\n");
return -1;
}
while(1)
{
ret = read(fd,&buff,sizeof(struct input_event));
//if(ret == sizeof(struct input_event))
printf("type: %d code: %d,value: %d\n",buff.type,buff.code,buff.value);
count++;
printf("count=%d\n",count);
}
close(fd);
}
1看输入子系统也看几遍啦 还是不太清楚,当测试程序执行read函数时内核调用的是哪个函数,
2测试程序中每次点击一次触摸屏就读好几次,打印好几个值,怎么实现点击一次只打印一个值,就是只读一次呢
|
|