mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 16:40:28 +00:00
Fix: [ALAS] Enhance auto device detection, ignore 127.0.0.1:7555 from MuMu 12
This commit is contained in:
parent
f2ada19c16
commit
cd06f0b3e2
@ -84,6 +84,11 @@ class AdbDeviceWithStatus(AdbDevice):
|
|||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def may_mumu12_family(self):
|
||||||
|
# 127.0.0.1:16XXX
|
||||||
|
return len(self.serial) == 15 and self.serial.startswith('127.0.0.1:16')
|
||||||
|
|
||||||
|
|
||||||
class Connection(ConnectionAttr):
|
class Connection(ConnectionAttr):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
@ -780,7 +785,16 @@ class Connection(ConnectionAttr):
|
|||||||
raise RequestHumanTakeover
|
raise RequestHumanTakeover
|
||||||
elif available.count == 1:
|
elif available.count == 1:
|
||||||
logger.info(f'Auto device detection found only one device, using it')
|
logger.info(f'Auto device detection found only one device, using it')
|
||||||
self.serial = devices[0].serial
|
self.serial = available[0].serial
|
||||||
|
del_cached_property(self, 'adb')
|
||||||
|
elif available.count == 2 \
|
||||||
|
and available.select(serial='127.0.0.1:7555') \
|
||||||
|
and available.select(may_mumu12_family=True):
|
||||||
|
logger.info(f'Auto device detection found MuMu12 device, using it')
|
||||||
|
# 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
|
||||||
del_cached_property(self, 'adb')
|
del_cached_property(self, 'adb')
|
||||||
else:
|
else:
|
||||||
logger.critical('Multiple devices found, auto device detection cannot decide which to choose, '
|
logger.critical('Multiple devices found, auto device detection cannot decide which to choose, '
|
||||||
|
Loading…
Reference in New Issue
Block a user