在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);
}