File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,12 @@ def get_connection(self, timeout=None):
313
313
raise ValueError ('Connection class not specified on Target creation.' )
314
314
return self .conn_cls (timeout = timeout , ** self .connection_settings ) # pylint: disable=not-callable
315
315
316
+ def set_connection (self , conn ):
317
+ tid = id (threading .current_thread ())
318
+ old_conn = self ._connections .get (tid )
319
+ self ._connections [tid ] = conn
320
+ return old_conn
321
+
316
322
def wait_boot_complete (self , timeout = 10 ):
317
323
raise NotImplementedError ()
318
324
Original file line number Diff line number Diff line change @@ -184,6 +184,13 @@ Target
184
184
blocking operation (e.g. using ``background() ``) while at the same
185
185
time doing something else in the same host-side thread.
186
186
187
+ .. method :: Target.set_connection(conn)
188
+
189
+ Set the Target's connection for the current thread to the one specified
190
+ (typically, one that has previously been returned by the call to
191
+ ``get_connection ``). Returns the old connection to the current thread -- it
192
+ is up to the caller to keep track of it and restore it if they wish.
193
+
187
194
.. method :: Target.setup([executables])
188
195
189
196
This will perform an initial one-time set up of a device for devlib
You can’t perform that action at this time.
0 commit comments