Joterito
Joterito

Reputation: 151

Android App using C++ for serial USB access

I'm developing an Android application that needs to access a third-party library written in C that accesses the serial port through the command (*pSerialHandle) = open(deviceName, O_RDWR | O_NOCTTY | O_NDELAY); I make the connection through JNI.

I grant the appropriate permissions from the Android application, and everything seems to be correct until the moment I try to open the connection, which gives me the following pernmissions error:

avc: denied { search } for name="usb" dev="tmpfs" ino=18382 scontext=u:r:untrusted_app_30:s0:c173,c256,c512,c768 tcontext=u:object_r:usb_device:s0 tclass=dir permissive=0

Device API level: 13

Is it necessary to have the device "rooted" in order to establish the connection through the serial port? Any idea about the solution?

Upvotes: -1

Views: 190

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76809

This won't work out, because android.permission.MOUNT_UNMOUNT_FILESYSTEMS (for tmpfs) reads:

Not for use by third-party applications.

Rooting won't make any difference, unless adding the relevant SE Linux policy module while rooted, then one can unroot again. It's about the policy module, which forbids the mounting.

Upvotes: 0

Related Questions