Skip to content

Commit

Permalink
Update adb_manager.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Oct 7, 2019
1 parent a658d6e commit 52c9501
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions androidtv/adb_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from adb_shell.auth.sign_pythonrsa import PythonRSASigner
from adb_messenger.client import Client

from .constants import DEFAULT_AUTH_TIMEOUT_S

_LOGGER = logging.getLogger(__name__)

#: Use a timeout for the ADB threading lock if it is supported
Expand Down Expand Up @@ -64,13 +66,15 @@ def close(self):
"""
self._adb.close()

def connect(self, always_log_errors=True):
def connect(self, always_log_errors=True, auth_timeout_s=DEFAULT_AUTH_TIMEOUT_S):
"""Connect to an Android TV / Fire TV device.
Parameters
----------
always_log_errors : bool
If True, errors will always be logged; otherwise, errors will only be logged on the first failed reconnect attempt
auth_timeout_s : float
Authentication timeout (in seconds)
Returns
-------
Expand Down Expand Up @@ -99,9 +103,9 @@ def connect(self, always_log_errors=True):
signer = PythonRSASigner(pub, priv)

# Connect to the device
self._adb.connect(rsa_keys=[signer], auth_timeout_s=0.1)
self._adb.connect(rsa_keys=[signer], auth_timeout_s=auth_timeout_s)
else:
self._adb.connect(auth_timeout_s=0.1)
self._adb.connect(auth_timeout_s=auth_timeout_s)

# ADB connection successfully established
self._available = True
Expand Down

0 comments on commit 52c9501

Please sign in to comment.