fix(checkm8): treat a DNLOAD timeout in stage 1 as delivered, not failed

usbipd drops the STATUS ACK of a DNLOAD, so the transfer reports TIMEOUT although the device consumed every byte; send_dfu_finalize() and send_payload_chunks() already rely on that. The new exact-length check treated TIMEOUT as a hard error, which would have failed stage 1 on usbipd -- the transport the stage was rewritten for.
This commit is contained in:
debian 2026-11-29 12:50:20 -03:00
parent e3ecb9e14c
commit 5a2494d63e

View file

@ -333,6 +333,18 @@ static int stage1_dnload_exact(libusb_device_handle *usb, uint16_t len)
free(buf);
if (ret < 0) {
/*
* On usbipd the STATUS ACK of a DNLOAD is dropped and surfaces as
* TIMEOUT even though the device consumed every byte;
* send_dfu_finalize() and send_payload_chunks() rely on the same
* property, so a TIMEOUT is not a failed transfer. Failing here
* would break stage 1 on the one transport that needs it most.
*/
if (ret == LIBUSB_ERROR_TIMEOUT) {
log_warn("stage1_dnload_exact: DNLOAD(%u) timed out after "
"sending the block -- continuing", len);
return 0;
}
log_error("stage1_dnload_exact: DNLOAD(%u) failed: %s",
len, libusb_strerror(ret));
return -1;