1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 12:06:08 +00:00

Fixed multiple connects

Target was implicitly connecting on instantiation, and then explicitily
re-connected by the TargetManger.
This commit is contained in:
Sergei Trofimov 2017-03-07 15:29:49 +00:00
parent d9458c8767
commit 3885a93b60
2 changed files with 6 additions and 5 deletions

View File

@ -24,7 +24,7 @@ def get_target_descriptions(loader=pluginloader):
return targets.values()
def instantiate_target(tdesc, params):
def instantiate_target(tdesc, params, connect=None):
target_params = {p.name: p for p in tdesc.target_params}
platform_params = {p.name: p for p in tdesc.platform_params}
conn_params = {p.name: p for p in tdesc.conn_params}
@ -47,6 +47,8 @@ def instantiate_target(tdesc, params):
tp['connection_settings'] = cp
if tdesc.connection:
tp['conn_cls'] = tdesc.connection
if connect is not None:
tp['connect'] = connect
return tdesc.target(**tp)

View File

@ -62,10 +62,7 @@ class TargetManager(object):
self._init_target()
self._init_assistant()
self.runtime_configs = [cls(self.target) for cls in self.runtime_config_cls]
with signal.wrap('TARGET_CONNECT'):
self.target.connect()
def finalize(self):
# self.logger.info('Disconnecting from the device')
@ -108,7 +105,9 @@ class TargetManager(object):
if self.target_name not in target_map:
raise ValueError('Unknown Target: {}'.format(self.target_name))
tdesc = target_map[self.target_name]
self.target = instantiate_target(tdesc, self.parameters)
self.target = instantiate_target(tdesc, self.parameters, connect=False)
with signal.wrap('TARGET_CONNECT'):
self.target.connect()
self.target.setup()
def _init_assistant(self):