我是靠谱客的博主 诚心缘分,最近开发中收集的这篇文章主要介绍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 screen调用测试程序所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部