Skip to content

android 10以上的串口访问权限问题 #49

@Domlaa

Description

@Domlaa

在android 10以上的设备运行,扫描端口驱动的时候,无法访问 /proc/tty/drivers

提示信息:
17:07:39.340 System.err W java.io.FileNotFoundException: /proc/tty/drivers: open failed: EACCES (Permission denied)
17:07:39.340 System.err W at libcore.io.IoBridge.open(IoBridge.java:575)
17:07:39.340 System.err W at java.io.FileInputStream.(FileInputStream.java:160)
17:07:39.336 rialport.sample W type=1400 audit(0.0:100530): avc: denied { read } for name="drivers" dev="proc" ino=4026531852 scontext=u:r:untrusted_app_29:s0:c191,c258,c512,c768 tcontext=u:object_r:proc_tty_drivers:s0 tclass=file permissive=0 app=android.serialport.sample
17:07:39.340 System.err W at java.io.FileReader.(FileReader.java:58)
17:07:39.340 System.err W at android.serialport.SerialPortFinder.getDrivers(SerialPortFinder.java:71)
17:07:39.340 System.err W at android.serialport.SerialPortFinder.getAllDevices(SerialPortFinder.java:93)
17:07:39.340 System.err W at android.serialport.sample.SerialPortPreferences.onCreate(SerialPortPreferences.java:42)

可否有解决方法

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions