📄 hpi_test.c
字号:
/*************************************************************************** HPI Drivers --------------------------------- begin : March 10th,2008 copyright : wangpingan email : wang8y8y@163.com QQ : 276708824 ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h> /**********************main******************************/ int main() { int fd,nread; char read_buf[2048]; //open HPI if((fd=open("/dev/hpi",O_RDWR))<=0) { printf("Could not open hpi device!\n"); return -1; } else { printf("HPI device open ok!\n"); } //read HPI if ((nread=read(fd,read_buf,2048))<0) { printf("Could not read hpi device!\n"); return -1; } else { printf("HPI device read success!\n"); printf("read is %s\n",read_buf); } //close HPI close(fd); return 0; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -