Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use this library to handle GPIO pins of Qualcom MSM8909 board running simple android OS?? #1

Open
MirzaAhmedBaig opened this issue Oct 4, 2018 · 0 comments

Comments

@MirzaAhmedBaig
Copy link

I am trying to read and write to GPO pins of Qualcome MSM8909 running Simple android OS not Android things. I am able to do the same with adb but when i am trying to do same with android App its giving me permission denied error. So I can only able to read these pins but cant able to write anything to it.
Please Help.
This is what I have tried
var outp = exe?.Executer("echo 0 > /sys/class/gpio/gpio942/value")
Log.d("Output", "My INPUT $outp")

        outp = exe?.Executer("cat /sys/class/gpio/gpio942/value")
        Log.d("Output", "My OUTPUT $outp")

//

public class ShellExecuter {

public ShellExecuter() {

}

public String Executer(String command) {

    StringBuffer output = new StringBuffer();

    Process p;
    try {
        p = Runtime.getRuntime().exec(command);
        p.waitFor();
        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

        String line = "";
        while ((line = reader.readLine())!= null) {
            output.append(line + "\n");
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    String response = output.toString();
    return response;

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant