Page MenuHomeFreeBSD

libusb: fix incorrect member name in bos_descriptor
ClosedPublic

Authored by aokblast on Jun 7 2025, 7:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 16, 6:47 AM
Unknown Object (File)
Wed, Oct 8, 5:38 AM
Unknown Object (File)
Mon, Sep 29, 2:23 AM
Unknown Object (File)
Fri, Sep 19, 1:12 AM
Unknown Object (File)
Sep 15 2025, 9:07 AM
Unknown Object (File)
Sep 3 2025, 9:42 AM
Unknown Object (File)
Aug 31 2025, 2:54 AM
Unknown Object (File)
Aug 26 2025, 5:15 AM
Subscribers

Details

Summary

The bNumDeviceCapabilities is bNumDeviceCaps when it is imported to
libusb.

For a better compatibility, we should rename the member

See: https://github.com/libusb/libusb/commit/02ebafc85d3f219842cbabaf78abc8100b6656e5

Diff Detail

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

Event Timeline

This is likely to bite a few ports (see, for instance, https://grep.app/search?q=bNumDeviceCapabilities) -- that's not at all a large number of candidates, but I think it's worth a note in ^/UPDATING or something (macro to alias bNumDeviceCapabilities -> bNumDeviceCaps?)

Is it worth to use something like:

#define bNumDeviceCapabilities bNumDeviceCaps

I have recommend the libusb upstream to do so on https://github.com/libusb/libusb/pull/1652

Is it worth to use something like:

#define bNumDeviceCapabilities bNumDeviceCaps

I have recommend the libusb upstream to do so on https://github.com/libusb/libusb/pull/1652

Yeah, I think that's reasonable.

Rebase to main and use macro to provide backward compatibility

This revision is now accepted and ready to land.Jun 23 2025, 7:10 PM

In libusb20_desc.h I see a macro LIBUSB20_BOS_DESCRIPTOR which references the old field name. I'm not really sure what that macro is doing--should that be updated as well?

In libusb20_desc.h I see a macro LIBUSB20_BOS_DESCRIPTOR which references the old field name. I'm not really sure what that macro is doing--should that be updated as well?

The BOS_DESCRIPTOR in libusb20 is a dedicated structure for decode in libusb20 and the definition resides inside the libusb20_desc.c. Thus there is no reference from libusb10 structure.

For libusb10, we require a xfer and copy it into buffer directly. It will not be parsed by libusb20.

In libusb20_desc.h I see a macro LIBUSB20_BOS_DESCRIPTOR which references the old field name. I'm not really sure what that macro is doing--should that be updated as well?

The BOS_DESCRIPTOR in libusb20 is a dedicated structure for decode in libusb20 and the definition resides inside the libusb20_desc.c. Thus there is no reference from libusb10 structure.

For libusb10, we require a xfer and copy it into buffer directly. It will not be parsed by libusb20.

Ok! Approved.

Use define also in bos_descriptor

This revision now requires review to proceed.Jul 8 2025, 10:30 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 8 2025, 3:13 PM
This revision was automatically updated to reflect the committed changes.