keypad.c

来自「台湾上尚公司linux嵌入式服务器平台键盘操作源码」· C语言 代码 · 共 42 行

C
42
字号
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/ioctl.h>int main() {    int fd, i = 0;    int tmp;    char data;    do {       usleep(10000);       fd = open("/dev/atop_keypad", O_RDWR | O_SYNC);    } while (fd < 0);// while(1) {    read(fd, &data, 1);    printf("%x\n", data);#if 0    if (data == ) {    }    if (data == ) {    }    if (data == ) {    }    if (data == ) {    }#endif    data = 0xab;    write(fd, &data, 1);        close(fd);    return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?