mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-11 22:08:20 +08:00
Opt: Write serial if auto device detection found only one
instead of searching again next time
This commit is contained in:
@@ -811,7 +811,7 @@ class Connection(ConnectionAttr):
|
||||
raise RequestHumanTakeover
|
||||
elif available.count == 1:
|
||||
logger.info(f'Auto device detection found only one device, using it')
|
||||
self.serial = available[0].serial
|
||||
self.config.Emulator_Serial = self.serial = available[0].serial
|
||||
del_cached_property(self, 'adb')
|
||||
elif available.count == 2 \
|
||||
and available.select(serial='127.0.0.1:7555') \
|
||||
@@ -820,7 +820,7 @@ class Connection(ConnectionAttr):
|
||||
# For MuMu12 serials like 127.0.0.1:7555 and 127.0.0.1:16384
|
||||
# ignore 7555 use 16384
|
||||
remain = available.select(may_mumu12_family=True).first_or_none()
|
||||
self.serial = remain.serial
|
||||
self.config.Emulator_Serial = self.serial = remain.serial
|
||||
del_cached_property(self, 'adb')
|
||||
else:
|
||||
logger.critical('Multiple devices found, auto device detection cannot decide which to choose, '
|
||||
@@ -862,8 +862,7 @@ class Connection(ConnectionAttr):
|
||||
if mumu12.count == 1:
|
||||
emu_serial = mumu12.first_or_none().serial
|
||||
logger.warning(f'Redirect MuMu12 {self.serial} to {emu_serial}')
|
||||
self.serial = emu_serial
|
||||
self.config.Emulator_Serial = emu_serial
|
||||
self.config.Emulator_Serial = self.serial = emu_serial
|
||||
break
|
||||
elif mumu12.count >= 2:
|
||||
logger.warning(f'Multiple MuMu12 serial found, cannot redirect')
|
||||
@@ -871,6 +870,8 @@ class Connection(ConnectionAttr):
|
||||
else:
|
||||
# Only 127.0.0.1:7555
|
||||
if self.is_mumu_over_version_356:
|
||||
# is_mumu_over_version_356 and nemud_app_keep_alive was cached
|
||||
# Acceptable since it's the same device
|
||||
logger.warning(f'Device {self.serial} is MuMu12 but corresponding port not found')
|
||||
brute_force_connect()
|
||||
devices = self.list_device()
|
||||
|
||||
Reference in New Issue
Block a user