android 打开("/dev/input/event1", O_RDWR);权限被拒绝?
android open("/dev/input/event1", O_RDWR); with permission denied?
我想将触摸屏事件写入“/dev/input/event1”,但它运行 'open("/dev/input/event1", O_RDWR);' 需要 denied.My phone 权限 phone 已经 root,我用代码获取了 root :
String apkRoot="chmod 777 "+getPackageCodePath();
RootCommand(apkRoot);
public static boolean RootCommand(String command)
{
Process process = null;
DataOutputStream os = null;
try
{
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e)
{
Log.d("*** DEBUG ***", "ROOT REE" + e.getMessage());
return false;
} finally
{
try
{
if (os != null)
{
os.close();
}
process.destroy();
} catch (Exception e)
{
}
}
Log.d("*** DEBUG ***", "Root SUC ");
return true;
}
显示我的应用确实获得了root权限,但我对'permission denied'感到困惑。
我添加代码
apkRoot="chmod 777 /dev/input/event1";
RootCommand(apkRoot);"
而且效果很好。
我想将触摸屏事件写入“/dev/input/event1”,但它运行 'open("/dev/input/event1", O_RDWR);' 需要 denied.My phone 权限 phone 已经 root,我用代码获取了 root :
String apkRoot="chmod 777 "+getPackageCodePath();
RootCommand(apkRoot);
public static boolean RootCommand(String command)
{
Process process = null;
DataOutputStream os = null;
try
{
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e)
{
Log.d("*** DEBUG ***", "ROOT REE" + e.getMessage());
return false;
} finally
{
try
{
if (os != null)
{
os.close();
}
process.destroy();
} catch (Exception e)
{
}
}
Log.d("*** DEBUG ***", "Root SUC ");
return true;
}
显示我的应用确实获得了root权限,但我对'permission denied'感到困惑。
我添加代码
apkRoot="chmod 777 /dev/input/event1";
RootCommand(apkRoot);"
而且效果很好。