我是靠谱客的博主 诚心缘分,这篇文章主要介绍Linux程序之触摸,linux触摸屏touch screen调用测试程序,现在分享给大家,希望可以做个参考。

linux触摸屏touch screen调用测试程序

#include

#include

static int event0_fd = -1;

struct input_event ev0[64];

static int handle_event0()

{

int button = 0, realx=0, realy=0, i, rd;

rd = read(event0_fd, ev0, sizeof(struct input_event)* 64);

if(rd < sizeof(struct input_event)) return 0;

for(i=0;i

{

if(EV_ABS == ev0[i].type)

{

if(ev0[i].code == 0) {

realx = ev0[i].value;

} else if(ev0[i].code == 1) {

realy = ev0[i].value;

}

}

printf("event(%d):type:%d; code:%3d; value:%3d; realx:%3d; realy:%3dn",i,ev0[i].type,ev0[i].code,ev0[i].value,realx,realy);

}

return 1;

}

int main(void)

{

int done = 1;

event0_fd = open("/dev/event1",02);

if(event0_fd <0) {

printf("open input device errorn");

return -1;

}

while (done)

{

printf("begin handle_event0...n");

done = handle_event0();

printf("end handle_event0...n");

}

if(event0_fd > 0)

{

close(event0_fd);

event0_fd = -1;

}

return 0;

}

最后

以上就是诚心缘分最近收集整理的关于Linux程序之触摸,linux触摸屏touch screen调用测试程序的全部内容,更多相关Linux程序之触摸,linux触摸屏touch内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(180)

评论列表共有 0 条评论

立即
投稿
返回
顶部