JNI中使用open打开文件是返回-1问题
fd = open("/dev/test", O_RDWR|O_NOCTTY/*|O_NDELAY*/);
一,检查dev/节点权限是否开放使用给予权限
chmod 777 /dev/test
代码中可在
ueventd.m7332.rc中添加权限
/dev/test 0666 system system
二 检查是否有其他程序占用导致失败
三 查看是否系统模式问题 getenforce
console:/ # getenforce
Permissive
如果不是Permissive模式而是Enforcing那么修改Enforcing为Permissive
console:/ # setenforce 0
代码中修改文件set_config中添加
setenv bootargs androidboot.selinux=permissive
四 如果系统是Enforcing模式而不想修改可以查看系统中的.te 文件添加对应的权限