软件总框图:
输入管理单元测试
添加input_test.c,内容如下
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <linux/fb.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include "input_manager.h"
int main(int argc, char **argv)
{
InputEvent event;
int ret;
InputInit();
InputDeviceInit();
while (1)
{
printf("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
ret = GetInputEvent(&event);
printf("%s %s %d, ret = %d\n", __FILE__, __FUNCTION__, __LINE__, ret);
if (ret)
{
printf("GetInputEvent err\n");
return -1;
}
else
{
printf("%s %s %d, event.iType = %d\n", __FILE__, __FUNCTION__, __LINE__, event.iType);
if (event.iType == INPUT_TYPE_TOUCH)
{
printf("iType =%d\r\n", event.iType);
printf("iX =%d\r\n", event.iX);
printf("iY =%d\r\n", event.iY);
printf("iPressure =%d\r\n", event.iPressure);
}
else if (event.iType == INPUT_TYPE_NET)
{
printf("iType =%d\r\n", event.iType);
printf("str =%s\r\n", event.str);
}
}
}
}
修改Makefile,编译调试。生成.test文件,运行测试。
网络输入测试:
触摸屏输入测试: