Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1297709
  • 博文数量: 175
  • 博客积分: 2743
  • 博客等级: 少校
  • 技术积分: 4024
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-30 01:41
文章分类

全部博文(175)

文章存档

2015年(1)

2013年(53)

2012年(71)

2011年(50)

分类: LINUX

2011-11-08 16:24:44

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);
阅读(1449) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~