#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
typedef struct {
unsigned short pressure; // touch pressure
unsigned short x; // calibrated X
unsigned short y; // calibrated Y
unsigned short millisecs; // timestamp of this event
} TS_EVENT;
int tsfd = -1;
int main(void)
{
TS_EVENT te;
tsfd = open("/dev/touchscreen/0", O_RDONLY);
if( tsfd < 0 )
{
printf("touch driver open errorn");
return -1;
}
while(1)
{
if (read(tsfd, (void *)&te, sizeof(TS_EVENT)) < 0)
{
printf("ts read error");
return -1;
}
printf("%d, %d, %d, %dn", te.pressure, te.x, te.y, te.millisecs);
}
close(tsfd);
}
예전에 aesop 2.4.20으로 배포할때 테스트하던 프로그램입니다.
2.6은 틀린 방식으로 동작하는데, 다른 방법으로 읽어야 하니...이 프로그램으로는
안 읽힐 듯 합니다...^^