File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 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):
313313 raise ValueError ('Connection class not specified on Target creation.' )
314314 return self .conn_cls (timeout = timeout , ** self .connection_settings ) # pylint: disable=not-callable
315315
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+
316322 def wait_boot_complete (self , timeout = 10 ):
317323 raise NotImplementedError ()
318324
Original file line number Diff line number Diff line change @@ -184,6 +184,13 @@ Target
184184 blocking operation (e.g. using ``background() ``) while at the same
185185 time doing something else in the same host-side thread.
186186
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+
187194.. method :: Target.setup([executables])
188195
189196 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