NanoPi2 Android Root Permission

Cruise_Thai
Hi all,

I am recently playing with NanoPi2 running Android (default image provided
by manufacturer).
I used the matrix lib (https://github.com/friendlyarm/matrix/tree/nanopi2)
to do some small projects.

But every time using JNI C to write to the device driver file (for example:
/dev/i2c-0) I need change the permission (chmod 777 /dev/i2c-0) manually.

I have thought about using /system/xbin/su to change the permission of the
driver file programmatically, but the program hang. Below is the Java
function i used to "su" (I have successfully used it to get "su" on SABRE
Lite i.MX6 - android 4.4.2):

public boolean getSuUser(){
 int i = 0;
 try {
   /* Missing read/write permission, trying to chmod the file */
    
 su = Runtime.getRuntime().exec("/system/xbin/su");
 // Reader Port
 String cmd = "chmod 777 i2c-1\n"; 
 su.getOutputStream().write(cmd.getBytes());
 } catch (Exception e) {
  e.printStackTrace();
  Log.i("Main", e.toString());
  throw new SecurityException();
}

In the line : su.getOutputStream().write(cmd.getBytes()); // I have
"Brocken Pipe" error

Please give me some advices and solutions to get root permission in my
program !
Thank you in advance !

jjm
hello,

   You can use software call 'KingRoot' to get root access of
android system , I just know that software , hope can help you .

Tank
i agree with  jjm, Kingroot works perfectly.
Just tested  it

csimmonds
The command should be
"chmod 777 /dev/i2c-1\n";

Peter Scargill
Slightly off topic - I have a T3 (not T2) here - with Android 5.1.1 and I
can say that Kingroot categorically does NOT work.  Why are we getting
un-rooted Android - for boards which people will be buying to experiment
with.....