About serialmanager access serial port issue.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

About serialmanager access serial port issue.

跳至解决方案
1,738 次查看
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.

标签 (1)
0 项奖励
回复
1 解答
1,524 次查看
chris4
Contributor II

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

在原帖中查看解决方案

3 回复数
1,071 次查看
Tomas555
Contributor I

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

0 项奖励
回复
1,525 次查看
chris4
Contributor II

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

657 次查看
Pritamsrisahoo_ss
Contributor II

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 项奖励
回复