|
急!急!急!s3c2410s触摸屏驱动的测试程序
[复制链接]
我用的是up-netarm2410-s的板子。学了触摸屏驱动后就写了一个简单的测试程序,怎么总是读不出数据,触摸屏一点反应都没有。请大侠指点指点!小弟在此万分感谢!
#include
#include
#include
#include
#include
#include
typedef struct s3c2410_ts_event {
unsigned short pressure;
unsigned short x;
unsigned short y;
unsigned short pad;
} TS_EVENT;
main()
{
int fileno,len;
TS_EVENT ev;
memset(&ev, 0, sizeof(struct s3c2410_ts_event));
fileno = open("/dev/touchscreen",O_RDONLY);
if (fileno == -1) {
printf("open device error!\n");
return 0;
}
for(;;)
{
len=read(fileno, &ev, sizeof(struct s3c2410_ts_event))
if(len==sizeof(struct s3c2410_ts_event)) {
printf("x= %d, y= %d, flag=%d\n", ev.x, ev.y, ev.pressure);
}
}
close(fileno);
return 0;
}
|
|