天嵌 ARM开发社区

 找回密码
 注册
查看: 1782|回复: 0

每日一问之触摸屏 哎

[复制链接]
wang12zhedi 发表于 2012-11-26 17:04:04 | 显示全部楼层 |阅读模式
根据局天嵌的天嵌科技出品-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测试程序中每次点击一次触摸屏就读好几次,打印好几个值,怎么实现点击一次只打印一个值,就是只读一次呢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-6-16 07:12 , Processed in 1.031250 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表