Skip to content Skip to sidebar Skip to footer

How To Open /dev/diag With Super User Permissions?

I am developing an application for One Plus 6. This applications is using a shared library(lib.so) to perform some task. For the task it needs to open dev/diag first and then send

Solution 1:

I was able to send commands to the the /dev/diag device and activate the QCDM messages on a Pixel 3a phone. I did this in the open source Android app Network Survey+.

Specifically, take a look at this line of code, which is something like this:

newString[]{"su", "-c", "exec <path_to_shared_library>"};

That line of code builds the shared command that is then executed by the ProcessBuilder.

The source code for the shared library can be found here. Note that I did not write the diag_revealer code, instead that was taken from the Mobile Insight app.

I think maybe the problem you ran into is executing from /system. Instead, make sure the shared library is in your app's private directory. The actual code I used pointed to the app's files directory:

returnnewString[]{"su", "-c", "exec " + diagRevealer + " " + context.getFilesDir() + "/" + context.getResources().getResourceEntryName(R.raw.rrc_filter_diag_edit) + " " + fifoPipeName};

Post a Comment for "How To Open /dev/diag With Super User Permissions?"