Page MenuHomeFreeBSD

libusb: implement zlp flag in libusb transfer
ClosedPublic

Authored by aokblast on Aug 6 2025, 12:58 PM.
Tags
Referenced Files
Unknown Object (File)
Mon, Jun 29, 9:41 AM
Unknown Object (File)
Wed, Jun 24, 11:48 PM
Unknown Object (File)
Wed, Jun 24, 3:07 AM
Unknown Object (File)
Wed, Jun 24, 1:20 AM
Unknown Object (File)
Tue, Jun 23, 3:55 PM
Unknown Object (File)
Mon, Jun 22, 4:11 AM
Unknown Object (File)
Mon, Jun 22, 3:52 AM
Unknown Object (File)
May 30 2026, 12:58 PM
Subscribers

Details

Summary

The USB protocol defines a Zero-Length Packet (ZLP) to signal the end of
a transfer when the data size is an exact multiple of the Maximum Packet
Size (MPS). Without a ZLP in such cases, the device may not be able to
determine that the transfer has completed.

This flag is added to libusb to allow the user send a ZLP in the end
of libusb_xfer.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Send packet only the multiple of packet

defer zlp check until we can find the xfer

lwhsu added inline comments.
lib/libusb/libusb10.c
1778

should we use libusb20_tr_get_max_packet_length() or libusb20_tr_get_max_total_length()?

This implemented is problematic since the correct way is to append a zero size TRB in TD instead of creating new TD. However, I think I am unable to make it work before 15.0 release. Therefore, I will modify it to at least we won't break any ABI for 15 if we want to merge later.

adrian added a reviewer: USB.
adrian added a project: USB.
This revision is now accepted and ready to land.Thu, Jun 18, 5:11 AM