fix: allow Hermit on VMOS only

This commit is contained in:
2026-07-06 22:40:36 +08:00
parent 67bd1d9a1c
commit c9edcd0a40
2 changed files with 13 additions and 1 deletions
+9 -1
View File
@@ -7,6 +7,7 @@ from adbutils import AdbClient, AdbDevice
from module.base.decorator import cached_property from module.base.decorator import cached_property
from module.config.config import AzurLaneConfig from module.config.config import AzurLaneConfig
from module.device.method.utils import get_serial_pair
from module.exception import RequestHumanTakeover from module.exception import RequestHumanTakeover
from module.logger import logger from module.logger import logger
@@ -128,8 +129,11 @@ class ConnectionAttr:
@cached_property @cached_property
def port(self) -> int: def port(self) -> int:
port_serial, _ = get_serial_pair(self.serial)
if port_serial is None:
port_serial = self.serial
try: try:
return int(self.serial.split(':')[1]) return int(port_serial.split(':')[1])
except (IndexError, ValueError): except (IndexError, ValueError):
return 0 return 0
@@ -148,6 +152,10 @@ class ConnectionAttr:
def is_nox_family(self): def is_nox_family(self):
return 62001 <= self.port <= 63025 return 62001 <= self.port <= 63025
@cached_property
def is_vmos(self):
return 5667 <= self.port <= 5699
@cached_property @cached_property
def is_emulator(self): def is_emulator(self):
return self.serial.startswith('emulator-') or self.serial.startswith('127.0.0.1:') return self.serial.startswith('emulator-') or self.serial.startswith('127.0.0.1:')
+4
View File
@@ -137,6 +137,10 @@ class Device(Screenshot, Control, AppControl):
# if self.config.Emulator_ScreenshotMethod != 'nemu_ipc' and self.config.Emulator_ControlMethod == 'nemu_ipc': # if self.config.Emulator_ScreenshotMethod != 'nemu_ipc' and self.config.Emulator_ControlMethod == 'nemu_ipc':
# logger.warning('When not using nemu_ipc, both screenshot and control should not use nemu_ipc') # logger.warning('When not using nemu_ipc, both screenshot and control should not use nemu_ipc')
# self.config.Emulator_ControlMethod = 'minitouch' # self.config.Emulator_ControlMethod = 'minitouch'
# Allow Hermit on VMOS only
if self.config.Emulator_ControlMethod == 'Hermit' and not self.is_vmos:
logger.warning('ControlMethod is allowed on VMOS only')
self.config.Emulator_ControlMethod = 'minitouch'
pass pass
def screenshot(self): def screenshot(self):