oep-client-python 0.0.22__py3-none-any.whl → 0.0.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oep_client/__init__.py +1 -1
- oep_client/link.py +19 -6
- {oep_client_python-0.0.22.dist-info → oep_client_python-0.0.23.dist-info}/METADATA +1 -1
- {oep_client_python-0.0.22.dist-info → oep_client_python-0.0.23.dist-info}/RECORD +7 -7
- {oep_client_python-0.0.22.dist-info → oep_client_python-0.0.23.dist-info}/WHEEL +0 -0
- {oep_client_python-0.0.22.dist-info → oep_client_python-0.0.23.dist-info}/entry_points.txt +0 -0
- {oep_client_python-0.0.22.dist-info → oep_client_python-0.0.23.dist-info}/licenses/LICENSE +0 -0
oep_client/__init__.py
CHANGED
oep_client/link.py
CHANGED
|
@@ -122,6 +122,7 @@ class SerialLink:
|
|
|
122
122
|
self.stream = stream
|
|
123
123
|
self.framing = framing
|
|
124
124
|
self.timeout = timeout
|
|
125
|
+
self.resend = True # a lost reply: the request once more with the same corr (core §5.2)
|
|
125
126
|
self.retries = 0
|
|
126
127
|
self.corrupt = 0
|
|
127
128
|
self.stale = 0 # replies that answered another request
|
|
@@ -284,7 +285,7 @@ class SerialLink:
|
|
|
284
285
|
if isinstance(e, cobs.CorruptFrame):
|
|
285
286
|
self.corrupt += 1
|
|
286
287
|
self._recover()
|
|
287
|
-
if attempt or (message[0] & m.ROLE_SESSION and self.ended_blind):
|
|
288
|
+
if attempt or not self.resend or (message[0] & m.ROLE_SESSION and self.ended_blind):
|
|
288
289
|
raise
|
|
289
290
|
# sent once more with the same corr, state-changing ones too: the probe keeps the lock holder's recent
|
|
290
291
|
# results and answers a repeat from them instead of running it twice (v1-open-proposals §4). A result
|
|
@@ -303,7 +304,7 @@ class SerialLink:
|
|
|
303
304
|
try:
|
|
304
305
|
return self._exchange_once(messages, max_inflight, window_bytes, replies)
|
|
305
306
|
except (cobs.CorruptFrame, TimeoutError, FramingLost):
|
|
306
|
-
if self.ended_blind:
|
|
307
|
+
if self.ended_blind or not self.resend:
|
|
307
308
|
raise
|
|
308
309
|
self.retries += 1
|
|
309
310
|
rest = messages[len(replies):]
|
|
@@ -433,19 +434,29 @@ def _open_usb_stream(kind: str, vid: int, pid: int, serial: str | None):
|
|
|
433
434
|
return UsbBulkStream.open(vid, pid, serial)
|
|
434
435
|
|
|
435
436
|
|
|
436
|
-
|
|
437
|
+
TCP_TIMEOUT = 15.0 # behind a broker: outlast its own 3 s retry towards the probe, and never send again ourselves
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def open_host(target: str, timeout: float | None = None, resend: bool | None = None):
|
|
437
441
|
"""A Host on `target`, with the link's pipelining bound to the probe's limits (core confirm): Host.pipeline and
|
|
438
442
|
everything built on it (flash, capture reads) then keep several requests in flight.
|
|
439
443
|
|
|
440
444
|
target: a serial port path (COM3 on Windows); tcp://HOST:PORT for a local broker (length frames); usb[:VID:PID[:SERIAL]]
|
|
441
445
|
(hex) for the probe's USB device, vendor bulk then HID (oep-core §3.3); usb:UNIT_ID for the OEP probe whose USB
|
|
442
|
-
serial is that unit id, whatever its VID:PID.
|
|
446
|
+
serial is that unit id, whatever its VID:PID.
|
|
447
|
+
|
|
448
|
+
timeout: seconds to wait for a reply (default 3; TCP 15). resend: send a request once more with the same corr when
|
|
449
|
+
its reply was lost (default on; off for TCP, where a broker retries towards the probe itself and a second copy from
|
|
450
|
+
here would only race it - a lost reply is then raised to the caller)."""
|
|
443
451
|
from . import host
|
|
444
452
|
if target.startswith("tcp://"):
|
|
445
453
|
addr, _, port = target[len("tcp://"):].rpartition(":")
|
|
446
|
-
lk = SerialLink.on_stream(TcpStream(addr or "127.0.0.1", int(port)), "length",
|
|
454
|
+
lk = SerialLink.on_stream(TcpStream(addr or "127.0.0.1", int(port)), "length",
|
|
455
|
+
TCP_TIMEOUT if timeout is None else timeout)
|
|
456
|
+
lk.resend = False if resend is None else resend
|
|
447
457
|
lk.transport = "tcp"
|
|
448
458
|
elif target == "usb" or target.startswith("usb:"):
|
|
459
|
+
timeout = 3.0 if timeout is None else timeout
|
|
449
460
|
parts = target.split(":")[1:]
|
|
450
461
|
if len(parts) == 1: # usb:UNIT_ID (any length: a VID comes with its PID)
|
|
451
462
|
vid, pid = find_usb(parts[0])
|
|
@@ -454,8 +465,10 @@ def open_host(target: str, timeout: float = 3.0):
|
|
|
454
465
|
pid = int(parts[1], 16) if len(parts) > 1 else USB_PID
|
|
455
466
|
return open_usb_host(vid, pid, parts[2] if len(parts) > 2 else None, timeout)
|
|
456
467
|
else:
|
|
457
|
-
lk = SerialLink(target, timeout)
|
|
468
|
+
lk = SerialLink(target, 3.0 if timeout is None else timeout)
|
|
458
469
|
lk.transport = "serial"
|
|
470
|
+
if resend is not None:
|
|
471
|
+
lk.resend = resend
|
|
459
472
|
hst = host.Host(lk.send)
|
|
460
473
|
lk.attach_host(hst)
|
|
461
474
|
return hst
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: oep-client-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.23
|
|
4
4
|
Summary: Open Embedded Probe (OEP) v1 host: serial / USB / TCP transports, the session rules, the standard interfaces, and a fake probe
|
|
5
5
|
Project-URL: Homepage, https://github.com/Open-Embedded-Probe/oep-client-python
|
|
6
6
|
Project-URL: Repository, https://github.com/Open-Embedded-Probe/oep-client-python
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
oep_client/__init__.py,sha256=
|
|
1
|
+
oep_client/__init__.py,sha256=pnKaZosmvKhvHN9-ow0t_ED6s5zr6kOzmNMKGNsgJKA,164
|
|
2
2
|
oep_client/__main__.py,sha256=wN7KRc5IqmCPqDosKa9ArJAFmu281aUh1UMM2VvSLbY,17575
|
|
3
3
|
oep_client/arm.py,sha256=JGrevyxH8W-ke33rCv1_zyfekDDZrUv2kJhNRGyKFCA,12708
|
|
4
4
|
oep_client/capture.py,sha256=goD0of-bClOK88PHR0PpWZ_XJqOWhOL9UVtVU0k3NLA,31994
|
|
@@ -20,7 +20,7 @@ oep_client/frames.py,sha256=xjgjnXmXUqNJZ5m0h91r4Cy48WoVK1mEMW4gRg-mlMI,3991
|
|
|
20
20
|
oep_client/hid_stream.py,sha256=99Dsm4Io1keukuETG_UNqjBGiVYZZeb__Pv4ytaKg9k,10695
|
|
21
21
|
oep_client/host.py,sha256=3NiPV5rnruaC6PR48LOCEoMRpC6985PA8VpSnr7gB2A,20296
|
|
22
22
|
oep_client/interfaces.py,sha256=8HXr9iGJASIwBpTHBrCK_0b6NfbclEjCbBCsc62euzg,5693
|
|
23
|
-
oep_client/link.py,sha256=
|
|
23
|
+
oep_client/link.py,sha256=U50zgp1IPVaUniINpERD6y13C_eO8uWQBLiBa6ONexU,22627
|
|
24
24
|
oep_client/message.py,sha256=eQ-27lxN2Y9JadnUFpEmkEW2X7oucrKFFFs4_nnDClU,12322
|
|
25
25
|
oep_client/names.py,sha256=ztCZFWs__aR-a5G14TnJP-Q4YfLhbyrzvOVOMJuG93k,3653
|
|
26
26
|
oep_client/registry.py,sha256=W8xLB0HqKB0-YtHguwTrXLwtPRMjRNdOPfwkstp7pGo,15552
|
|
@@ -28,8 +28,8 @@ oep_client/riscv.py,sha256=vqd2aiLf2MaXcsGqh7Hsg51ng_OQi1DgI-vLZvHJ8VQ,29291
|
|
|
28
28
|
oep_client/rp2350.py,sha256=7OMyj270k3AY1e3-ljicPwOjf9jOlokbT6QNkA0b0yY,4227
|
|
29
29
|
oep_client/uiapduino.py,sha256=kDB8C9GvIPBw94PaCKMzVWNtoQDu_axrz_n_6zbYJGU,6082
|
|
30
30
|
oep_client/usb_stream.py,sha256=_KQvWq906DnQ4EjW1to7d9ufh3pnGkkkbCzti6GYVCY,11131
|
|
31
|
-
oep_client_python-0.0.
|
|
32
|
-
oep_client_python-0.0.
|
|
33
|
-
oep_client_python-0.0.
|
|
34
|
-
oep_client_python-0.0.
|
|
35
|
-
oep_client_python-0.0.
|
|
31
|
+
oep_client_python-0.0.23.dist-info/METADATA,sha256=9dH6nKQlUcX2cVOl9bPGWGQOCfFRd18SrzBCIOS9tGA,10290
|
|
32
|
+
oep_client_python-0.0.23.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
33
|
+
oep_client_python-0.0.23.dist-info/entry_points.txt,sha256=h6_8QX89Ww1ogALEGG5g4kspT3IOV6O51lwKqf5BWco,49
|
|
34
|
+
oep_client_python-0.0.23.dist-info/licenses/LICENSE,sha256=ntlalztb3L1OaNAxmQdHlubu5fVhjMc9oRZi3PeQhXg,1076
|
|
35
|
+
oep_client_python-0.0.23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|