⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xsb_edr_keypad_test.c

📁 在PXA270上的IO驱动
💻 C
字号:
#include <sys/time.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <signal.h>struct input_event{	struct timeval time;	unsigned short type;	unsigned short code;	unsigned int value;};int fd_key, fd_sw, fd_led, fd_max;fd_set readfds;void handle();int main(void){    char buf;   int dac_value;   long oflags;       fd_key= open("/dev/xsb_edr_kbd",O_RDWR);        fd_max = fd_key;     signal(SIGIO, &handle);   fcntl(fd_key, F_SETOWN, getpid());   oflags = fcntl(fd_key, F_GETFL);   fcntl(fd_key, F_SETFL, oflags | FASYNC);    while(1)    {    }}void handle(){  char buf=0;        {           FD_ZERO(&readfds);      FD_SET(fd_key, &readfds); //     FD_SET(fd_sw, &readfds);              select(fd_max + 1, &readfds, NULL, NULL, NULL);      if ( FD_ISSET(fd_key, &readfds))         {            read(fd_key, &buf, sizeof(char));    	   printf("Scancode is 0x%08x\n", buf);           }         }}

⌨️ 快捷键说明

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