pureboot.py: bound the activation drain against a flooding target
The post-prompt settle loop in _handshake had no deadline, so a target that never falls quiet — a board stuck in a reset loop, whose UART-reset garbage carries a stray prompt byte — spun the tool forever. Bound it by the handshake deadline; a real loader still settles on its first quiet read. Regression: test/test_handshake.py (flood terminates, valid loader still connects). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -484,8 +484,13 @@ class Loader:
|
||||
self.port.write(knock)
|
||||
knocks += 1
|
||||
if PROMPT in self.port.read_available(0.4):
|
||||
# Settle: absorb a real loader's trailing bytes before asking
|
||||
# for the identity. Bounded by the deadline so a target that
|
||||
# never falls quiet — a board stuck in a reset loop, whose
|
||||
# garbage carries a stray prompt — cannot spin here forever.
|
||||
while self.port.read_available(0.3):
|
||||
pass
|
||||
if time.monotonic() > deadline:
|
||||
break
|
||||
self.port.write(b"b")
|
||||
try:
|
||||
# A version the tool cannot speak is the loader's own
|
||||
|
||||
Reference in New Issue
Block a user