Allow safety sleep to take effect before the su request in Android.

This commit is contained in:
hedgecrw85 2018-01-03 15:01:05 -06:00
parent e1e4441484
commit 5d96988de3
1 changed files with 4 additions and 4 deletions

View File

@ -351,6 +351,10 @@ public final class SerialPort
if (isOpened)
return true;
// Force a sleep to ensure that the port does not become unusable due to rapid closing/opening on the part of the user
if (safetySleepTime > 0)
try { Thread.sleep(safetySleepTime); } catch (Exception e) { e.printStackTrace(); }
// If this is an Android root application, we must explicitly allow serial port access to the library
if (isAndroid)
{
@ -382,10 +386,6 @@ public final class SerialPort
}
}
// Force a sleep to ensure that the port does not become unusable due to rapid closing/opening on the part of the user
if (safetySleepTime > 0)
try { Thread.sleep(safetySleepTime); } catch (Exception e) { e.printStackTrace(); }
if ((portHandle = openPortNative()) > 0)
{
inputStream = new SerialPortInputStream();