现在的位置: 首页 > 综合 > 正文

linux读写属性节点

2016年12月19日 ⁄ 综合 ⁄ 共 438字 ⁄ 字号 评论关闭

/*路径*/

char const*const PCBVERPATCH ="sys/devices/system/soc/soc0/hw_pcb_version";

static int get_pcbversion(char const* path){
    int pcb_fd;
    int pcb_version=0;

    char pcbver[8]={'0'};

    int count;

    pcb_fd=open(PCBVERPATCH, O_RDONLY); /*open*/

if(pcb_fd){

          // count=write(pcb_fd, pcbver, 2) ;/*write两个字符,返回写入字符数量*/

          count=read(pcb_fd,pcbver,2); /*read读两个字符,返回读取字符数量*/
          ALOGE("PCBVERSION device %d %s\n",pcb_fd,pcbver);
}
close(pcb_fd);
    return pcb_version;
}

【上篇】
【下篇】

抱歉!评论已关闭.