平台:MT6735 Android版本:7.0
u-blox.conf中定义串口为:
SERIAL_DEVICE /dev/ttyMT3
没有给串口加上权限前,出现以下log:
[212:logd.auditd]type=1400 audit(1420070619.170:645332): avc: denied { read write } for pid=1822 comm=67707320746872656164 name="ttyMT3" dev="tmpfs" ino=6437 scontext=u:r:system_server:s0 tcontext=u:object_r:ttyMT_device:s0 tclass=chr_file permissive=0
解决方法:
./system/sepolicy/file_contexts:146:/dev/ttyMT3 u:object_r:ublox_serial_device:s0
./system/sepolicy/device.te:105:type ublox_serial_device, dev_type;
./system/sepolicy/domain.te:147:allow domain ublox_serial_device:chr_file rw_file_perms;
./system/sepolicy/system_server.te:541:allow system_app ublox_serial_device:chr_file rw_file_perms;