int main(int argc, char *argv[]) { struct input_event ievent; int fdev, xaxis, yaxis, flag, ret; if ((fdev = open("/dev/input/ts", O_RDONLY)) < 0) { perror("cannot open input device"); return -1; } while(1) { if((ret = read(fdev ,&ievent ,sizeof(ievent))) < sizeof(ievent)) { printf("\nreceived only %d bytes on read", ret); return -1; } printf("\n%d,\t%d,\t%d", ievent.type, ievent.code, ievent.value); } return 0; }
0, 0, 0 1, 330, 1 3, 0, 657 3, 1, 327 3, 53, 657 3, 54, 327 3, 48, 22 3, 57, 0 0, 2, 0
0, 0, 0 3, 53, 657 3, 54, 327 3, 48, 38 3, 57, 0 0, 2, 0 0, 0, 0 1, 330, 0