struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
struct input_event buff;
int fd;
int read_nu;
fd = open("/dev/input/event0", O_RDWR);
if (fd < 0){
perror("can not open device led");
exit(1);
}
while(1){
while(read(fd,&buff,sizeof(struct input_event))==0);
printf("type:%d\n code:%d\n,value:%d\n",buff.type,buff.code,buff.value);
}
close(fd);
阅读(1486) | 评论(0) | 转发(0) |