Android 如何利用proc有上层想kernel写文件(二)

2014-11-24 10:44:21 ? 作者: ? 浏览: 1
************\n");
break;
}
return count;
}


上面是proc的写函数,主要是响应java的写文件函数。
static int modem_switch_readproc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int len;
len = sprintf(page, "%d\n", sound8976_galley_select_flag==0 0:(sound8976_galley_select_flag==1 1:(sound8976_galley_select_flag==2 2:3))); //wangyulu
if (off + count >= len)
*eof = 1;
if (len < off)
return 0;
*start = page + off;
return ((count < len - off) count : len - off);
}



经过上面的操作,想看看写的是否正确 就可以在终端用 下满的指令,就知道文件里面是0 或是 1了。


/ # cat /proc/sound8976/sound8976_galley_select
0


其实这个方法还是不错的,希望对用android的朋友有帮助。


-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: