kbddemo.c
来自「uClinux 基于S3C44B0X 键盘驱动」· C语言 代码 · 共 41 行
C
41 行
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <errno.h>#include <fcntl.h>#include <sys/ioctl.h>#include <sys/stat.h>main(void){ int i,cc; char buf[1]; int fd; if( ( fd=open("/dev/keyboard",O_RDWR|O_NONBLOCK) ) ==-1 ){ printf("open keyboard err\n"); exit(-1); } else printf("keyboard opened\n"); for(;;) { cc = read(fd, buf, 1); if(cc > 0) printf("keyboard read 0x%2x\n",buf[0]); if(buf[0] > 0) printf("keyboard read 0x%2x!!!!!!!!!!!!!!!\n",buf[0]); //if( buf[0] == 0x11 ) // break; } //getchar(); close(fd); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?