diff --git a/CLAUDE.md b/CLAUDE.md index 655f607..8099621 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -368,9 +368,11 @@ can catch a regression here — the guard is `tools/uci/boot_check.py`. ### Firmware quirk — FPGA register timing (delay-loop fence) -The UCI FPGA needs a minimum gap between register accesses regardless of -CPU clock. `uci_fence` (`uci_regs.inc`, OUTER=5, INNER=217, ~85 us at -64 MHz) follows every access to `$DF1C-$DF1F`. INNER=217 covers both the +The UCI FPGA needs a minimum gap after register WRITES regardless of CPU +clock. `uci_fence` (`uci_regs.inc`, OUTER=5, INNER=217, ~85 us at 64 MHz) +follows every write to `$DF1C`/`$DF1D`; reads are unfenced on both UCI +backends (`uci_read_fence`; `UCI_READ_FENCE=1` / `M3_READ_FENCE=1` restore +the old images byte for byte; the trust store's `uci_dos.s` still fences). INNER=217 covers both the U64E (~38 us floor) and the C64 Ultimate (floor bracketed 51.6 FAIL / 62.9 PASS us at 64 MHz; the symptom below the floor is a silently lost TCP_CONNECT push → `NO_SOCKET`). 48 MHz (U64E) and 64 MHz (C64U) verified. diff --git a/Makefile b/Makefile index 1c29d30..01703e6 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,19 @@ else $(foreach k,M3_READ_FENCE M3_TRACE,$(if $(filter-out 0,$($(k))),$(error $(k)=$($(k)) applies only to BACKEND=uci-m3))) endif +# UCI_READ_FENCE=1 (BACKEND=uci): a uci_fence after every UCI register READ +# in src/net/uci too, as before (src/net/uci/uci_regs.inc, uci_read_fence): +# the A/B arm and the fallback. Refused on the other backends; uci-m3 has +# its own M3_READ_FENCE. +ifneq ($(filter-out 0 1,$(UCI_READ_FENCE)),) +$(error UCI_READ_FENCE must be 1 or 0/unset) +endif +ifneq ($(BACKEND),uci) +ifeq ($(UCI_READ_FENCE),1) +$(error UCI_READ_FENCE=1 applies only to BACKEND=uci) +endif +endif + # X25519 is always the libs/x25519 sibling (issue #245 retired the in-tree # src/crypto/{x25519,fe25519}.s). The old opt-in knob is refused rather than # ignored, so a stale command line cannot believe it selected something. @@ -120,6 +133,9 @@ CA65FLAGS += -D BACKEND_UCI=1 # patience), so the check has the least to do exactly where it does not fit. # Documented in README and tracked on #135 rather than left to be discovered. CA65FLAGS += -D X509_VERIFY_NAME=1 +ifeq ($(UCI_READ_FENCE),1) +CA65FLAGS += -D UCI_READ_FENCE=1 +endif else ifeq ($(BACKEND),uci-m3) # A UCI build (the typed-target prompt, the REU body sink and the viewer # come with BACKEND_UCI) plus the M3 switch. -I src/net/uci after the diff --git a/src/net/uci/net.s b/src/net/uci/net.s index aee3082..47c93ae 100644 --- a/src/net/uci/net.s +++ b/src/net/uci/net.s @@ -116,7 +116,7 @@ net_init: php lda UCI_ID - uci_fence ; settle before comparing ID + uci_read_fence ; settle before comparing ID cmp #UCI_ID_VALUE beq @present @@ -273,17 +273,18 @@ net_poll: ; SMC dst. Loop style matches uci_read_resp_bytes — tight-poll ; DATA_AV and read UCI_RESP_DATA; the firmware FIFO auto-advances ; on read (Phase 2 finding), so NO per-byte DATA_ACC. +uci_poll_stage_fence: ; kept: the one fence after a read that is uci_fence ; give firmware time to stage response ldy #$00 @hdr_loop: lda UCI_STATUS - uci_fence ; settle before testing DATA_AV + uci_read_fence ; settle before testing DATA_AV and #UCI_STAT_DATA_AV bne @hdr_got ; branch past trampoline jmp @hdr_done_short ; long branch: fence too wide for BEQ @hdr_got: lda UCI_RESP_DATA - uci_fence ; settle before storing header byte + uci_read_fence ; settle before storing header byte sta uci_read_hdr,y iny cpy #2 @@ -415,7 +416,7 @@ net_poll: ; FIFO drained mid-record we bail (shouldn't happen if firmware ; honored actual_len but we defend anyway). lda UCI_STATUS - uci_fence ; settle before testing DATA_AV + uci_read_fence ; settle before testing DATA_AV and #UCI_STAT_DATA_AV bne @have_byte jmp @done_data @@ -431,7 +432,7 @@ net_poll: sta @rb_store+2 lda UCI_RESP_DATA - uci_fence ; settle before storing data byte + uci_read_fence ; settle before storing data byte @rb_store: sta $ffff ; SMC: patched each byte diff --git a/src/net/uci/uci_cmd.s b/src/net/uci/uci_cmd.s index d83e9b1..70e262f 100644 --- a/src/net/uci/uci_cmd.s +++ b/src/net/uci/uci_cmd.s @@ -219,7 +219,7 @@ uci_wait_idle: sta @wi_elapsed @wi_loop: lda UCI_STATUS - uci_fence ; settle read before testing bits + uci_read_fence ; settle read before testing bits and #(UCI_STAT_STATE | UCI_STAT_ABORT_PENDING | UCI_STAT_CMD_BUSY) ; $35 beq @idle_done @@ -269,7 +269,7 @@ uci_wait_not_busy: sta @wnb_elapsed @wnb_loop: lda UCI_STATUS - uci_fence ; settle read before testing bits + uci_read_fence ; settle read before testing bits and #UCI_STAT_CMD_BUSY beq @wnb_done @@ -393,7 +393,7 @@ uci_wait_reply: sta @wr_elapsed @wr_loop: lda UCI_STATUS - uci_fence ; settle read before testing bits + uci_read_fence ; settle read before testing bits and #(UCI_STAT_REPLY_VALID | UCI_STAT_ERROR) ; $28 bne @wr_done @@ -425,7 +425,9 @@ uci_wait_reply: ; ============================================================================= uci_check_err: lda UCI_STATUS +.ifdef UCI_READ_FENCE jsr uci_settle ; settle before testing error bit +.endif and #UCI_STAT_ERROR bne @has_err clc @@ -537,11 +539,11 @@ uci_read_resp_bytes: cpy uci_resp_max bcs @rd_done lda UCI_STATUS - uci_fence ; settle before testing DATA_AV + uci_read_fence ; settle before testing DATA_AV and #UCI_STAT_DATA_AV beq @rd_done ; reply shorter than max: it is final lda UCI_RESP_DATA - uci_fence ; settle before storing/looping + uci_read_fence ; settle before storing/looping @rd_store: sta $FFFF,y ; SMC: dst low/high patched above iny @@ -589,14 +591,18 @@ uci_drain_resp: sta @drn_elapsed @drn_loop: lda UCI_STATUS +.ifdef UCI_READ_FENCE jsr uci_settle ; settle before testing DATA_AV +.endif and #UCI_STAT_DATA_AV bne @drn_have clc rts @drn_have: lda UCI_RESP_DATA +.ifdef UCI_READ_FENCE jsr uci_settle +.endif ; NO PER-BYTE ACK — see the header. The read advanced the FIFO. ; Check TOD for elapsed tenths. Latch (HOUR) then read TENTHS. @@ -671,7 +677,9 @@ uci_drain_status: sta @dst_elapsed @dst_loop: lda UCI_STATUS +.ifdef UCI_READ_FENCE jsr uci_settle ; settle before testing STAT_AV +.endif and #UCI_STAT_STAT_AV bne @dst_have jsr @dst_commit @@ -679,7 +687,9 @@ uci_drain_status: rts @dst_have: lda UCI_STATUS_DATA +.ifdef UCI_READ_FENCE jsr uci_settle +.endif ; Last two bytes seen, non-sticky: net_poll reads the errno of a ; "02,NO DATA: n" line off them (#253). ldx uci_status_tail+1 diff --git a/src/net/uci/uci_dos.s b/src/net/uci/uci_dos.s index b693184..359b40d 100644 --- a/src/net/uci/uci_dos.s +++ b/src/net/uci/uci_dos.s @@ -113,7 +113,8 @@ dos_finish: jsr uci_check_err bcs dos_reject ; push rejected (interface not idle) dos_part: - lda UCI_STATUS +uci_dos_rd_part: ; uci_dos.s's own reads keep their fence on + lda UCI_STATUS ; every image (check_uci_read_pacing.py) jsr uci_settle bpl dos_status ; DATA_AV clear lda dos_cap ; not a read (dos_hdr zeroed the cap): @@ -126,6 +127,7 @@ dos_part: cmp dos_cap+1 beq dos_reject ; one byte more than asked for @store: +uci_dos_rd_data: lda UCI_RESP_DATA jsr uci_settle dos_store: @@ -140,6 +142,7 @@ dos_store: dos_status: jsr uci_drain_status bcs dos_rts +uci_dos_rd_state: lda UCI_STATUS jsr uci_settle and #UCI_STAT_STATE diff --git a/src/net/uci/uci_regs.inc b/src/net/uci/uci_regs.inc index 3c9128e..0615612 100644 --- a/src/net/uci/uci_regs.inc +++ b/src/net/uci/uci_regs.inc @@ -114,6 +114,19 @@ UCI_FENCE_INNER = 217 ; inner loop iterations pla ; restore A .endmacro +; uci_read_fence — the fence after a READ of $DF1C-$DF1F in src/net/uci. +; The FPGA's gap is needed after a WRITE (above); reads are unfenced: the +; queues advance on the read itself and DATA_AV / STAT_AV are polled before +; every byte. `make BACKEND=uci UCI_READ_FENCE=1` puts the fence back and +; assembles the previous products byte for byte (the A/B arm and the +; fallback). Sites that fence through `jsr uci_settle` use .ifdef directly. +; uci-m3 has its own knob (M3_READ_FENCE, src/net/uci-m3/m3.inc). +.macro uci_read_fence +.ifdef UCI_READ_FENCE + uci_fence +.endif +.endmacro + ; ============================================================================= ; Command IDs (issued as the first command byte after selecting the target) ; Phase 2+ will use these; Phase 1b keeps them here purely as equates. diff --git a/tools/check_uci_read_pacing.py b/tools/check_uci_read_pacing.py new file mode 100644 index 0000000..ecbb970 --- /dev/null +++ b/tools/check_uci_read_pacing.py @@ -0,0 +1,252 @@ +#!/usr/bin/env python3 +"""BACKEND=uci read pacing: a uci_fence after every UCI register WRITE, +none after a READ (src/net/uci/uci_regs.inc, uci_read_fence). + +Runs the SHIPPED machine code (build/c64-https.prg at build/labels.txt's +addresses) on test_uci_abort_recovery.py's interpreter and Command +Interface model, through net_init, a connect, data / idle / EOF / reset +polls, a send and a close, and logs every access to $DF1C-$DF1F with the +uci_fence executions that follow it before the next access. A fence is +recognised by its bytes as assembled (that module's FENCE), whether it is +inline or inside uci_settle. + +On a TRUST_STORE=1 image it also runs the trust store's DOS traffic +(trust_store_load on an empty medium, a stage + save, a reload) on +test_trust_store_6502.py's DOS model: the path every 'G' takes in the +shipped products (trust_pre). uci_dos.s keeps the fences after its own +three reads, but it goes through the same primitives as the network path +(uci_wait_idle, uci_wait_reply, uci_check_err, uci_drain_resp, +uci_drain_status), so on the default image those reads are unfenced too, +and they are held to the same rule; uci_dos.s's own three reads are +labelled (uci_dos_rd_part / _data / _state, in DOS_OWN) and must stay +fenced on every image. + + every image each WRITE to $DF1C/$DF1D is followed by a fence before + the next UCI access. + default no READ is followed by a fence, except the one kept before + net_poll's header read (label uci_poll_stage_fence). + UCI_READ_FENCE=1 (flags.stamp) + every READ is followed by a fence (the previous products). + +What it does not see: a delay that is not a uci_fence (a NOP sled, a +loop), and anything about the FPGA's real timing -- the hardware runs in +the PR are that evidence. + + make BACKEND=uci ... && python3 tools/check_uci_read_pacing.py [--expect default|fenced] + +--expect overrides what flags.stamp says, to show the check red on the +other image. Standalone, like tools/check_m3_client.py. Exit 0 pass, +1 fail, 2 cannot run. +""" +from __future__ import annotations + +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import test_uci_abort_recovery as A # noqa: E402 +import test_uci_data_acc as base # noqa: E402 + +UCI_REGS = range(0xDF1C, 0xDF20) + + +class Log: + def __init__(self): + self.events = [] # [kind, addr, [fence pcs after it], insn pc] + self.cpu = None # set once the machine exists + + def access(self, kind, addr): + if addr in UCI_REGS: + # every UCI access is an absolute LDA/STA: 3 bytes, and the + # operand has been fetched when the data cycle runs + pc = (self.cpu.pc - 3) & 0xFFFF if self.cpu else None + self.events.append([kind, addr, [], pc]) + + def fence(self, pc): + if self.events: + self.events[-1][2].append(pc) + + +def _traced(model, log): + read, write = model.read, model.write + + def r(addr): + log.access("r", addr) + return read(addr) + + def w(addr, value): + log.access("w", addr) + return write(addr, value) + model.read, model.write = r, w + return model + + +class PacingCPU(A.FastCPU): + log = None + + def step(self): + pc = self.pc + ram = self.mem.ram + if ram[pc] == 0x48 and ram[pc:pc + len(A.FENCE)] == A.FENCE: + self.log.fence(pc) + super().step() + + +def _machine(replies, log): + model = _traced(A.AbortModel(replies), log) + cpu, mem, labels = A._require(model) + pcpu = PacingCPU(mem) + pcpu.log = log + log.cpu = pcpu + return pcpu, mem, labels, model + + +def flows(): + """(name, Log) for each traced session.""" + out = [] + log = Log() + cpu, mem, labels, uci = _machine([A.CONNECT_OK], log) + cpu.call(labels["net_init"]) + A._assert_connected(cpu, mem, uci, labels, "pacing: connect") + out.append(("init+connect", log)) + for name, reply in (("poll data", (b"\x40\x00" + bytes(range(64)), A.OK)), + ("poll idle", (b"\xff\xff", b"02,NO DATA: 11")), + ("poll EOF", (b"\x00\x00", b"01,CONNECTION CLOSED BY HOST")), + ("poll reset", (b"\xff\xff", b"02,NO DATA: 104")), + # header 600 over a 512 B request: the copy stops at + # the request and uci_drain_resp reads the other 88 + # (its @drn_have data read; no other flow reaches it) + ("poll overclaim", (b"\x58\x02" + bytes(600), A.OK))): + log = Log() + cpu, mem, labels, uci = _machine([reply], log) + mem.write(labels["uci_socket_id"], 1) + mem.write(labels["net_tcp_state"], A.NET_TCP_CONNECTED) + cpu.call(labels["net_poll"], budget=8_000_000) + out.append((name, log)) + log = Log() + cpu, mem, labels, uci = _machine([(b"\x3a\x00", A.OK), (b"", A.OK)], log) + mem.write(labels["uci_socket_id"], 1) + mem.write(labels["net_tcp_state"], A.NET_TCP_CONNECTED) + mem.write(labels["net_send_len"], 58) + mem.write(labels["net_send_len"] + 1, 0) + cpu.a, cpu.x = 0x00, 0x04 + cpu.call(labels["net_tcp_send"], budget=4_000_000) + cpu.call(labels["net_tcp_close"], budget=4_000_000) + out.append(("send+close", log)) + return out, labels + + +def trust_flows(): + """[(name, Log)] for the trust store's DOS traffic, or None when the + image has no trust store.""" + import test_trust_store_6502 as TS + env = TS.Env() + if "trust_store_load" not in env.labels: + return None + out = [] + for name in ("trust load+save", "trust reload"): + log = Log() + dos = TS.Dos() if name == "trust load+save" else out_dos + m = env.machine(dos) + mem, cpu = m.mem, m.cpu + log.cpu = cpu + r0, w0 = mem.read, mem.write + + def r(addr, r0=r0, log=log): + if (addr & 0xFFFF) in UCI_REGS: + log.access("r", addr & 0xFFFF) + return r0(addr) + + def w(addr, value, w0=w0, log=log): + if (addr & 0xFFFF) in UCI_REGS: + log.access("w", addr & 0xFFFF) + return w0(addr, value) + mem.read, mem.write = r, w + step0 = cpu.step + + def step(cpu=cpu, step0=step0, log=log): + pc = cpu.pc + if cpu.mem.ram[pc] == 0xE9 and cpu.mem.ram[pc:pc + 4] == TS.FENCE: + log.fence(pc) + step0() + cpu.step = step + if name == "trust load+save": + m.load("github.com") + m.stage(TS.rec("anything", TS.SPKI_1).pack()) + if m.save(): + raise A.Unavailable("trust flow: the save failed in the model") + out_dos = dos + else: + c, a = m.load("github.com") + if c: + raise A.Unavailable("trust flow: the reload failed in the model") + out.append((name, log)) + return out + + +#: uci_dos.s's own reads (labels in src/net/uci/uci_dos.s): they keep +#: their `jsr uci_settle` on every image, and must. +DOS_OWN = ("uci_dos_rd_part", "uci_dos_rd_data", "uci_dos_rd_state") + + +def _fenced_image(): + stamp = base.LABELS.parent / "flags.stamp" + for line in stamp.read_text().splitlines(): + if line.startswith("CA65FLAGS="): + return "-D UCI_READ_FENCE" in line + raise A.Unavailable("%s has no CA65FLAGS line" % stamp) + + +def main(argv) -> int: + expect = None + if len(argv) == 3 and argv[1] == "--expect" and argv[2] in ("default", "fenced"): + expect = argv[2] == "fenced" + elif len(argv) != 1: + print(__doc__) + return 2 + try: + fenced = _fenced_image() if expect is None else expect + traces, labels = flows() + trust = trust_flows() + except (A.Unavailable, FileNotFoundError) as exc: + print("COULD NOT RUN: %s" % exc) + return 2 + if trust is None: + print("(no trust store in this image: trust flows not applicable)") + else: + traces += trust + keep = labels.get("uci_poll_stage_fence") + if keep is None: + print("COULD NOT RUN: uci_poll_stage_fence is not in labels.txt") + return 2 + own = {labels[n] for n in DOS_OWN if n in labels} + fails = 0 + for name, log in traces: + ev = log.events + writes = [e for e in ev[:-1] if e[0] == "w"] + reads = [e for e in ev[:-1] if e[0] == "r"] + bare = [e for e in writes if not e[2]] + if fenced: + bad = [e for e in reads if not e[2]] + what = "unfenced read(s) in an UCI_READ_FENCE=1 image" + else: + bad = [e for e in reads if e[3] not in own + and any(pc != keep for pc in e[2])] + what = "fenced read(s) in the default image" + own_bare = [e for e in reads if e[3] in own and not e[2]] + dos_missing = name.startswith("trust") and not any(e[3] in own for e in reads) + ok = len(writes) > 3 and not bare and not bad and not own_bare and not dos_missing + fails += not ok + print("%s %-13s %3d writes, %4d reads; %s%s" % ( + "PASS" if ok else "FAIL", name, len(writes), len(reads), + "%d write(s) with no fence after" % len(bare) if bare else "writes fenced", + "; %d %s, first $%04X" % (len(bad), what, bad[0][1]) if bad else "") + + ("; %d of uci_dos.s's own read(s) unfenced" % len(own_bare) if own_bare else "") + + ("; the DOS path never ran" if dos_missing else "")) + print("\n%d/%d flows pass (%s image)" % (len(traces) - fails, len(traces), + "fenced" if fenced else "default")) + return 1 if fails else 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/tools/mutate_uci_read_pacing.sh b/tools/mutate_uci_read_pacing.sh new file mode 100755 index 0000000..c958c88 --- /dev/null +++ b/tools/mutate_uci_read_pacing.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# tools/mutate_uci_read_pacing.sh -- break the BACKEND=uci read-pacing rule +# in the source, one mutant at a time; rebuild (make BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1, so the +# trust store's DOS flows run too; in build/: +# it OVERWRITES the current build) and require tools/check_uci_read_pacing.py +# to go red (exit 1) on each. The source is restored after every mutant. +# Exit 0 only if every mutant is killed and the control passes. +cd "$(dirname "$0")/.." || exit 1 +fails=0 +PROFILE="BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1" +mut() { # name file old new + python3 - "$2" "$3" "$4" <<'PY' || { echo "BROKEN $1"; fails=1; return; } +import sys +f, old, new = sys.argv[1], sys.argv[2].encode().decode("unicode_escape"), sys.argv[3].encode().decode("unicode_escape") +s = open(f).read(); assert s.count(old) == 1, (f, old, s.count(old)); open(f + ".orig", "w").write(s); open(f, "w").write(s.replace(old, new)) +PY + rm -rf build; make $PROFILE >build-mutant.log 2>&1 || { echo "BROKEN $1 (build)"; fails=1; mv "$2.orig" "$2"; return; } + rm -f build-mutant.log + out=$(python3 tools/check_uci_read_pacing.py 2>&1); rc=$? + mv "$2.orig" "$2" + if [ $rc -eq 1 ]; then echo "KILLED $1: $(echo "$out" | grep -m1 FAIL | cut -c1-120)"; else echo "SURVIVED $1 (rc=$rc)"; fails=1; fi +} +mut put-unfenced src/net/uci/uci_cmd.s "uci_put_byte:\n sta UCI_CMD_DATA\n uci_fence\n" "uci_put_byte:\n sta UCI_CMD_DATA\n" +mut begin-unfenced src/net/uci/uci_cmd.s "uci_begin_cmd:\n sta UCI_CMD_DATA\n uci_fence\n" "uci_begin_cmd:\n sta UCI_CMD_DATA\n" +mut copy-read-fenced src/net/uci/net.s " lda UCI_RESP_DATA\n uci_read_fence ; settle before storing data byte" " lda UCI_RESP_DATA\n uci_fence" +mut status-wait-fenced src/net/uci/uci_cmd.s "@wr_loop:\n lda UCI_STATUS\n uci_read_fence" "@wr_loop:\n lda UCI_STATUS\n uci_fence" +mut statline-fenced src/net/uci/uci_cmd.s " lda UCI_STATUS_DATA\n.ifdef UCI_READ_FENCE\n jsr uci_settle\n.endif" " lda UCI_STATUS_DATA\n jsr uci_settle" +mut dos-own-unfenced src/net/uci/uci_dos.s "uci_dos_rd_data:\n lda UCI_RESP_DATA\n jsr uci_settle\n" "uci_dos_rd_data:\n lda UCI_RESP_DATA\n" +mut check-err-fenced src/net/uci/uci_cmd.s "uci_check_err:\n lda UCI_STATUS\n.ifdef UCI_READ_FENCE\n jsr uci_settle ; settle before testing error bit\n.endif" "uci_check_err:\n lda UCI_STATUS\n jsr uci_settle" +mut drain-resp-fenced src/net/uci/uci_cmd.s "@drn_have:\n lda UCI_RESP_DATA\n.ifdef UCI_READ_FENCE\n jsr uci_settle\n.endif" "@drn_have:\n lda UCI_RESP_DATA\n jsr uci_settle" +rm -rf build; make $PROFILE >/dev/null 2>&1 +python3 tools/check_uci_read_pacing.py >/dev/null || fails=1 +echo "control $(shasum -a 256 build/c64-https.prg | cut -c1-8): $(python3 tools/check_uci_read_pacing.py | tail -1)" +exit $fails diff --git a/tools/uci/rig_https_local.py b/tools/uci/rig_https_local.py index 12f0354..85770de 100644 --- a/tools/uci/rig_https_local.py +++ b/tools/uci/rig_https_local.py @@ -76,6 +76,7 @@ from __future__ import annotations import base64 +import hashlib import datetime import json import os @@ -1453,6 +1454,9 @@ def main() -> int: return 2 prg = PRG_PATH.read_bytes() + # The provenance of THIS run: the bytes it loads, hashed once here, so a + # later rebuild of build/ cannot be mistaken for what ran. + print(f"PRG sha256 : {hashlib.sha256(prg).hexdigest()} ({PRG_PATH})") lock = DeviceLock(HOST) try: