About serialmanager access serial port issue.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About serialmanager access serial port issue.

Jump to solution
1,138 Views
chris4
Contributor II

I using serialmanager to access serial port in android.  below step:

1. add  /dev/ttymxc1              0660   system     system in fsl/wibo_8mq/ueventd.freescale.rc

2. add /dev/ttymxc1                   u:object_r:serial_device:s0 in fsl/wibo_8mq/sepolicy/file_contexts

3. add allow system_app serial_device:chr_file { getattr open read write ioctl};  in fsl/wibo_8mq/sepolicy/system_app.te

4. move serialchat to package/apps dicectory.

5. add LOCAL_CERTIFICATE := platform in Android.mk of serialchat dicectory.

6. add android:sharedUserId="android.uid.system" in AndroidManifest.xml of serialchat directory.

But when i run serialchat than console show serialxxxjni can't not open /dev/ttymxc1. I guess not get permission. So i setenforce 0 in console than close and run the apk. The serialchat can access serialport. Have any one can suggestion ?

I guess the apk not get permission from selinux.

Labels (1)
0 Kudos
1 Solution
924 Views
chris4
Contributor II

The problem already fixed. Just add permission in selinux and right way.

View solution in original post

3 Replies
471 Views
Tomas555
Contributor I

Hello, can I ask you how did you solve it? We are having the exact same problem...

0 Kudos
925 Views
chris4
Contributor II

The problem already fixed. Just add permission in selinux and right way.

57 Views
Pritamsrisahoo_ss
Contributor I

Hii @chris4 ,

I am using the ttymxc3 for the serial port access but i found error like:

[ 442.754424] type=1400 audit(1708171167.858:60): avc: denied { write } for comm="m.example.ltswc" name="ttymxc3" dev="tmpfs" ino=10520 scontext=u:r:untrusted_app:s0:c129,c256,c512,cc

then i followed the steps like:
sudo chmod 777 /dev/ttymxc3

setenforce 0

But i want to give the selinux permission for the ttymxc3 so that no need to give the above commands every time.

so please help me how i can give the serial port permission in the android source code.

Thankyou in advance.

0 Kudos