按键中断驱动的应用程序
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
/*thirddrvtest on*/
int main(int argc,char **argv) {
int fd;
unsigned char key_val;
fd=open("/dev/buttons",O_RDWR );
//这个 " /dev/xxx" 后面不能有空格
if (fd<0) {
printf("can't open!\n");
}
while (1) {
read (fd, &key_val, 1);
printf("key_val =0x%x\n", key_val);
} return 0; }