Android 控制gpio输出I/O高低电平信号

安卓板 orangepi one plus

介绍:http://www.orangepi.cn/OrangePiOneplus/index_cn.html

报错信息:

avc: denied { write } for name="data" dev="sysfs" ino=7762 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1

在网上找解决本法都是permissive=0的时候,不知道为什么我这里等于1 ,


还有以下代码执行的时候,”echo 0 > **“, 在命令行里面可以实现,但是在代码中就没有反应,(执行结果没有变,也没有报错),求助啊

private boolean set_gpio0_high() {

        return RootCommand("echo 1 > /sys/class/gpio_sw/normal_led/data");
    }

    public boolean set_gpio0_low() {    //拉低
        return RootCommand("echo 0 > /sys/class/gpio_sw/normal_led/data");
    }

    private boolean RootCommand(String command) {
        Process process = null;
        DataOutputStream os = null;
        try {
            process = Runtime.getRuntime().exec(command);
            os = new DataOutputStream(process.getOutputStream());
            os.writeBytes(command + "\n");
            os.writeBytes("exit\n");
            os.flush();
            process.waitFor();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                if (os != null) {
                    os.close();
                }
                process.destroy();
            } catch (Exception e) {
                e.printStackTrace();
            }
                        }

https://blog.csdn.net/qq_16810885/article/details/102922717