完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
#include
#include #include #include #include #include #include #include #include<time.h> #include #include #include int main(){ int keys_fd; struct input_event t; keys_fd=open("/dev/input/event1",O_RDONLY); if(keys_fd<=0){ printf("open file erro!n"); return 0; } while(1) { if(read(keys_fd,&t,sizeof(t))==sizeof(t)) { if(t.type==EV_KEY&&t.value==1) { printf("The keyCode is %xn",t.code);//这一步不执行,前几天是好的(确保代码没问题)求大神帮忙解决 if(t.code==KEY_ESC){break;} } } } close(keys_fd); return 0; } |
|
相关推荐
2个回答
|
|
|
代码执行到while()之前就停止了
|
|
|
|
|
|
这程序~
|
|
|
|
|
只有小组成员才能发言,加入小组>>
12660 浏览 0 评论
14718 浏览 9 评论
8159 浏览 0 评论
基于Amazon Echo 和 Raspberry Pi 的自动窗帘控制
7580 浏览 1 评论
【下载】《Linux+树莓派玩转智能家居》——亲手进行树莓派应用制作
174631 浏览 374 评论
2463浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 15:25 , Processed in 0.968626 second(s), Total 80, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
8075