zoukankan      html  css  js  c++  java
  • Proc文件系统接口调试

    在tpd_i2c_probe I2C的探测函数中创建proc接口

         //------------------------------------------------------------------
       //Crate proc file system for Test  //t1411021001 tao
        test_proc = create_proc_entry("test", 0664, NULL);//创建test节点
        if (test_proc == NULL)
        {
            goto out;
        }
        else
        {
            test_proc->read_proc = test_read_proc;//指定节点读取函数
            test_proc->write_proc = test_write_proc;//指定节点写入函数
        }	
        //------------------------------------------------------------------
    

    实现读取函数:

    static int test_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data)
    {
        char *ptr = page;
        ptr += sprintf(ptr, "hello"); //要将内容存入ptr地址上
        *eof = 1;返回参数,这个暂时还不知道啥意思
        return (ptr - page);
    }
    

      

  • 相关阅读:
    MySQL多表查询
    多表关联
    MySQL数据类型 约束
    初识数据库
    socker server和 event
    os 模块 和 os模块下的path模块
    sys 模块
    time 模块
    目录规范

  • 原文地址:https://www.cnblogs.com/tao560532/p/4068774.html
Copyright © 2011-2022 走看看