Skip to content

pb-service: say at once that firmware 4.0 cannot take a paste - #15

Merged
dlech merged 1 commit into
mainfrom
fix-repl-paste
Nov 24, 2026
Merged

dlech merged 1 commit into
mainfrom
fix-repl-paste

Conversation

@dlech

@dlech dlech commented Nov 24, 2026

Copy link
Copy Markdown
Member

Pasting into the REPL of a hub on Pybricks 4.0 waited 10 s and then said
the hub was not reading its input. 4.0 sized its stdin buffer at 21
bytes, or 64 on hubs with USB, while reporting a write size of up to
512, so a write bigger than the buffer was refused for good. It is a
firmware bug, fixed in 4.1.0b3 (pybricks-micropython a363d48f5f,
discussions/2788).

It is not worked around: Pybricks Code writes at the reported size too.
Instead, on 4.0 a refused write bigger than the hub's buffer is reported
at once as HUB_BUSY, saying to update the firmware first, since pb repl
shows it in a status line cut to the terminal's width. A smaller write
refused on 4.0 still means nothing is reading. The betas between 4.0 and
the fix are not told apart.

Measured on a Prime hub on 4.0.1: 63 bytes are taken at the prompt and
64 refused for good. A paste now fails in 0.2 s with the remedy, where
it took 10 s to fail with the wrong one.

The fake hub now reports firmware 4.1.3, as it has no small buffer.
The hardware paste test skips on 4.0, and the hardware tests say when
they skip because several hubs are on rather than none.

Pasting into the REPL of a hub on Pybricks 4.0 waited 10 s and then said
the hub was not reading its input. 4.0 sized its stdin buffer at 21
bytes, or 64 on hubs with USB, while reporting a write size of up to
512, so a write bigger than the buffer was refused for good. It is a
firmware bug, fixed in 4.1.0b3 (pybricks-micropython a363d48f5f,
discussions/2788).

It is not worked around: Pybricks Code writes at the reported size too.
Instead, on 4.0 a refused write bigger than the hub's buffer is reported
at once as HUB_BUSY, saying to update the firmware first, since pb repl
shows it in a status line cut to the terminal's width. A smaller write
refused on 4.0 still means nothing is reading. The betas between 4.0 and
the fix are not told apart.

Measured on a Prime hub on 4.0.1: 63 bytes are taken at the prompt and
64 refused for good. A paste now fails in 0.2 s with the remedy, where
it took 10 s to fail with the wrong one.

The fake hub now reports firmware 4.1.3, as it has no small buffer.
The hardware paste test skips on 4.0, and the hardware tests say when
they skip because several hubs are on rather than none.
@dlech
dlech merged commit 442ffe8 into main Nov 24, 2026
23 checks passed
@dlech
dlech deleted the fix-repl-paste branch November 24, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant