主题 : 触摸屏测试 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 4209
精华: 0
发帖: 10
金钱: 70 两
威望: 46 点
综合积分: 20 分
注册时间: 2009-03-04
最后登录: 2017-09-13
楼主  发表于: 2009-05-08 15:44

 触摸屏测试

移植友善提供的2.6.29后,有没有最简单的程序测试触摸屏,能打印出按下的坐标。
我使用的
#define TS_DEV "/dev/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;
}
运行后,按下后pressure一直为0。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-05-08 16:14
我已经回过你之前发的帖子了,这个测试程序和2.6.29的内核不兼容
http://www.aiothome.com/bbs/read.php?tid-1775-fpage-2-toread-1.html
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."