Skip to content

Commit 4716ffa

Browse files
committed
fix(flash): Add support for querying hardware version on USB 3.0 ports
As noted in the linked commit (coming from pybricks/pybricksdev#98), the hardware version can still be read even when the brick is plugged into a USB 3.0 port. Unforunately, the CRC packets likely cannot be salvaged this way - the CRC request is longer than the CRC response and so the CRC value is overwritten inside the brick.
1 parent 5ceca38 commit 4716ffa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bl_info.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ int bootloader_info(void)
5252
return ERR_COMM;
5353
}
5454

55-
// forbid looped-back packets (usb 3.0 bug; reply *is* required here)
56-
if (reply->type == VM_SYS_RQ)
57-
return ERR_USBLOOP;
55+
// Looped-back packets (e.g. reply->type == VM_SYS_RQ) are acceptable.
56+
// According to https://github.com/pybricks/pybricksdev/commit/81f310da54ff40092bb4166226f8d52f943404c5
57+
// the issue is less severe than originally anticipated. Only a part
58+
// of the response buffer is overwritten by the PC's request and
59+
// in this case the version is preserved.
5860

59-
if (reply->type != VM_OK)
61+
if (reply->type != VM_OK && reply->type != VM_SYS_RQ)
6062
{
6163
errno = reply->ret;
6264
fputs("Operation failed.\nlast_reply=", stderr);

0 commit comments

Comments
 (0)