mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Fix Android TV ADB authorization (#38471)
This commit is contained in:
parent
72b0f95719
commit
071b8ed8a5
@ -5,7 +5,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from adb_shell.auth.keygen import keygen
|
from adb_shell.auth.keygen import keygen
|
||||||
from adb_shell.auth.sign_pythonrsa import PythonRSASigner
|
|
||||||
from adb_shell.exceptions import (
|
from adb_shell.exceptions import (
|
||||||
AdbTimeoutError,
|
AdbTimeoutError,
|
||||||
InvalidChecksumError,
|
InvalidChecksumError,
|
||||||
@ -14,6 +13,7 @@ from adb_shell.exceptions import (
|
|||||||
TcpTimeoutException,
|
TcpTimeoutException,
|
||||||
)
|
)
|
||||||
from androidtv import ha_state_detection_rules_validator
|
from androidtv import ha_state_detection_rules_validator
|
||||||
|
from androidtv.adb_manager.adb_manager_sync import ADBPythonSync
|
||||||
from androidtv.constants import APPS, KEYS
|
from androidtv.constants import APPS, KEYS
|
||||||
from androidtv.exceptions import LockNotAcquiredException
|
from androidtv.exceptions import LockNotAcquiredException
|
||||||
from androidtv.setup_async import setup
|
from androidtv.setup_async import setup
|
||||||
@ -176,9 +176,7 @@ def setup_androidtv(hass, config):
|
|||||||
keygen(adbkey)
|
keygen(adbkey)
|
||||||
|
|
||||||
# Load the ADB key
|
# Load the ADB key
|
||||||
with open(adbkey) as priv_key:
|
signer = ADBPythonSync.load_adbkey(adbkey)
|
||||||
priv = priv_key.read()
|
|
||||||
signer = PythonRSASigner("", priv)
|
|
||||||
adb_log = f"using Python ADB implementation with adbkey='{adbkey}'"
|
adb_log = f"using Python ADB implementation with adbkey='{adbkey}'"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -141,7 +141,7 @@ PATCH_ANDROIDTV_OPEN = patch(
|
|||||||
)
|
)
|
||||||
PATCH_KEYGEN = patch("homeassistant.components.androidtv.media_player.keygen")
|
PATCH_KEYGEN = patch("homeassistant.components.androidtv.media_player.keygen")
|
||||||
PATCH_SIGNER = patch(
|
PATCH_SIGNER = patch(
|
||||||
"homeassistant.components.androidtv.media_player.PythonRSASigner",
|
"homeassistant.components.androidtv.media_player.ADBPythonSync.load_adbkey",
|
||||||
return_value="signer for testing",
|
return_value="signer for testing",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user