Avoid using su on Android if not required

on some devices the com ports already have the required file flags, so check them first to avoid unnecessary work
This commit is contained in:
Redirion 2018-10-09 12:15:09 +02:00 committed by GitHub
parent 6ec32c65cf
commit 0578b3813b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -378,7 +378,8 @@ public final class SerialPort
try { Thread.sleep(safetySleepTime); } catch (Exception e) {} try { Thread.sleep(safetySleepTime); } catch (Exception e) {}
// If this is an Android root application, we must explicitly allow serial port access to the library // If this is an Android root application, we must explicitly allow serial port access to the library
if (isAndroid) File portFile = isAndroid ? new File(comPort) : null;
if (portFile != null && (!portFile.canRead() || !portFile.canWrite()))
{ {
Process process = null; Process process = null;
try try