Page MenuHomeFreeBSD

libusb: implement IAD parser
AcceptedPublic

Authored by aokblast on Jun 20 2025, 6:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 21, 2:00 AM
F159816813: CleanShot 2026-06-18 at 09.03.05@2x.png
Thu, Jun 18, 1:03 PM
Unknown Object (File)
Mon, Jun 15, 1:31 PM
Unknown Object (File)
Mon, Jun 15, 6:10 AM
Unknown Object (File)
Mon, Jun 15, 4:02 AM
Unknown Object (File)
Fri, Jun 5, 1:14 PM
Unknown Object (File)
Fri, Jun 5, 3:50 AM
Unknown Object (File)
Thu, Jun 4, 10:19 PM

Details

Reviewers
bapt
kevans
adrian
Group Reviewers
USB
Summary

libusb provide functions to parse interface association descriptor. This descriptor indicates that a function is composed by multiple interface and which interfaces is associate to the target function. This descriptor is not a separate USB require, instead, it comes with the config descriptor.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73389
Build 70272: arc lint + arc unit

Event Timeline

Reorder libusb20_config to prevent ABI break

@kevans Do you think we should show IADs inside usbconfig? If so, what is your opinion about the format? IAD is a structure that cover multiple interfaces into 1 usb function. In that case, all interface should have a new indent and put the IAD on the top of It.

aokblast retitled this revision from libusb: add parser for parser for parser for parser for interface association descriptor to libusb: add parser for interface association descriptor.Jun 20 2025, 7:35 PM

Implement libusb_get_active_iad

lwhsu added inline comments.
lib/libusb/libusb.3
550
562
lib/libusb/libusb.h
80

Let's have this sorting enum member change in another commit, also, it seems that LIBUSB_DT_BOS should be placed after LIBUSB_DT_INTERFACE_ASSOCIATION ?

lib/libusb/libusb10_desc.c
786

This config will not be free()'d in the following early return:

  • if (iads == NULL)
  • if (niad == 0)
  • if (iad == NULL)
839

Maybe calling the parameter iad_arr to match the definition of libusb_get_active_interface_association_descriptors?

Or, even align more with libusb_get_interface_association_descriptors to be called iad_array?

841

Do we need to check desc is not null first?

lib/libusb/libusb20_desc.h
260

From the spec, iFunction seems using UINT8_T?

in man page and code, there are iad_array and iad_arr, would be nice if this naming can be consistent.

lib/libusb/libusb.3
572
573
lib/libusb/libusb10_desc.c
792

Does this also mean success? If so, should we set iad_arr = NULL to prevent that caller still pass the returned iad_arr to free() ?

lib/libusb/libusb20_desc.h
259

is this bInterfaceProtocol only in LIBUSB20_INTERFACE_DESC but not in LIBUSB20_INTERFACE_ASSOCIATION_DESC?

lib/libusb/libusb.h
300

It seems that we already have this in line 316?

This needs a proposed commit message.

aokblast retitled this revision from libusb: add parser for interface association descriptor to libusb: implement IAD parser.Wed, Jun 17, 3:17 PM
aokblast edited the summary of this revision. (Show Details)

hi! this doesn't have a commit message in the description; would you please update that? thanks!

please address lwhsu's comments!

hi! this doesn't have a commit message in the description; would you please update that? thanks!

Emm, I see the msg in my side. Could you please reload the page?

CleanShot 2026-06-18 at 09.03.05@2x.png (954×2 px, 172 KB)

please address lwhsu's comments!

It is all addressed. It would be great if you could point out some mising as I might accidentally lose something.

Ah, you haven't gone through and marked them as "done".

This revision is now accepted and ready to land.Thu, Jun 18, 2:25 PM