mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-11 17:42:05 +00:00
feat: add handle AdbError: unknown host service
This commit is contained in:
@@ -10,7 +10,7 @@ from lxml import etree
|
||||
from module.base.utils import *
|
||||
from module.device.connection import Connection
|
||||
from module.device.method.utils import (ImageTruncated, PackageNotInstalled, RETRY_TRIES, handle_adb_error,
|
||||
possible_reasons, retry_sleep)
|
||||
handle_unknown_host_service, possible_reasons, retry_sleep)
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
|
||||
@@ -50,6 +50,10 @@ def retry(func):
|
||||
if handle_adb_error(e):
|
||||
def init():
|
||||
self.adb_reconnect()
|
||||
elif handle_unknown_host_service(e):
|
||||
def init():
|
||||
self.adb_start_server()
|
||||
self.adb_reconnect()
|
||||
else:
|
||||
break
|
||||
# RuntimeError: USB device 127.0.0.1:5555 is offline
|
||||
@@ -121,7 +125,7 @@ class Uiautomator2(Connection):
|
||||
if image is None:
|
||||
raise ImageTruncated('Empty image after cv2.imdecode')
|
||||
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB, dst=image)
|
||||
cv2.cvtColor(image, cv2.COLOR_BGR2RGB, dst=image)
|
||||
if image is None:
|
||||
raise ImageTruncated('Empty image after cv2.cvtColor')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user