Power & Source of Big Ideas

Read data from serial port in android 7.1.2 on NanoPC-3

Moderators: chensy, FATechsupport

Hi ,i wrote the app in android studio 4.2, in that app i want to read data from serial port 'UART 3' but i got a security exception that say selinux setenforce enforced, i use this command in adb to set ecnforced to permitive " adb shell su 0 setenforce 0" and then i can read data, but after restart the device, setenforce restore to ecforced, so how can set it permanently to permitive ? i try to root it but can not found any way to do that. have you any solution can help me ?
The best way to do this is to build your own Android OS and set the SELINUX command line in the build.

You also need to set the tty ports in the init.rc to be accessible from the user space. Setting them to 0666 works for me. I also do this with the I2C and SPI etc.
v8dave wrote:
The best way to do this is to build your own Android OS and set the SELINUX command line in the build.

You also need to set the tty ports in the init.rc to be accessible from the user space. Setting them to 0666 works for me. I also do this with the I2C and SPI etc.


Thank you v8dave,

I know the best solution is, custom the Android OS, my app finally must be a launcher in android and must be custom in there, if you know any way to disable SELINUX that no depended to custom the OS, i ready thank you.
Mirshahbazi wrote:
v8dave wrote:
The best way to do this is to build your own Android OS and set the SELINUX command line in the build.

You also need to set the tty ports in the init.rc to be accessible from the user space. Setting them to 0666 works for me. I also do this with the I2C and SPI etc.


Thank you v8dave,

I know the best solution is, custom the Android OS, my app finally must be a launcher in android and must be custom in there, if you know any way to disable SELINUX that no depended to custom the OS, i ready thank you.

Hi,
I don't this right to tell you that but if you want to disable SELINUX to custom the OS then to disable SELinux on a CentOS 7 / RHEL 7 / Fedora Linux

The procedure to remove and disable SELinux security features is as follows:

Log in to your server
Check the current SELinux status, run: sestatus
To disable SELinux on CentOS 7 temporarily, run: sudo setenforce 0
Edit the /etc/selinux/config file and set the SELINUX to disabled
Reboot the Linux server
Verify it by running the sestatus and getenforce again

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 4 guests