static int test_touch_screen()
{
if(init_device(TOUS_DEV) < 0)
return -1;
while(1)
{
read(ts_fd, &data, sizeof(data));
if (data.type == EV_KEY)
{
printf(" type: EV_KEY, event = %s, value = %d\n\n",
data.code == BTN_TOUCH ? "BTN_TOUCH" : "Unkown", data.value);
}
else if(data.type == EV_ABS)
{
printf(" type: EV_ABS, event = %s, value = %d\n\n",
data.code == ABS_X ? "ABS_X" :
data.code == ABS_Y ? "ABS_Y" :
data.code == ABS_PRESSURE ? "ABS_PRESSURE" :"Unkown", data.value);
}
}
return 0;
}
static int test_touch_pancel()
{
if(init_device(TOUP_DEV) < 0)
return -1;
while(1)
{
read(ts_fd, &data, sizeof(data));
if (data.type == EV_KEY)
{
printf(" type = EV_KEY, code = %s, value = %d\n",
data.code == BTN_LEFT ? "MOUSE_LEFT" :
data.code == BTN_RIGHT ? "MOUSE_RIGHT" :
data.code == BTN_MIDDLE ? "MOUSE_MIDDLE" :
data.code == BTN_SIDE ? "MOUSE_SIDE" :
"Unkonw", data.value);
}
else if(data.type == EV_REL)
{
printf(" type = EV_ABS, code = %s, value = %d\n",
data.code == REL_X ? "ABS_X" :
data.code == REL_Y ? "ABS_Y" :
data.code == ABS_WHEEL ? "MOUSE_WHEEL" :
data.code == ABS_PRESSURE ? "ABS_PRESSURE" :
"Unkown", data.value);
}
}
return 0;
}
int main()
{
static int i;
select: