Page MenuHomeFreeBSD

libusb: improve compatibility
ClosedPublic

Authored by kevans on Jun 9 2020, 2:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 6:36 PM
Unknown Object (File)
Nov 11 2024, 4:50 PM
Unknown Object (File)
Nov 11 2024, 4:49 PM
Unknown Object (File)
Nov 11 2024, 4:48 PM
Unknown Object (File)
Nov 11 2024, 4:46 PM
Unknown Object (File)
Oct 21 2024, 8:36 PM
Unknown Object (File)
Oct 8 2024, 10:12 PM
Unknown Object (File)
Oct 3 2024, 6:29 AM
Subscribers

Details

Summary

Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API. Descriptions and functionality for these derived from the documentation at [0].

[0] http://libusb.sourceforge.net/api-1.0/group__libusb__misc.html

As far as I can tell, all of these capabilities are unconditionally OK with our libusb. LIBUSB_CAP_HAS_CAPABILITY has been noted as 'silly' by others because you can't realistically call libusb_has_capability(LIBUSB_CAP_HAS_CAPABILITY) -> you'll get a failure if it's provided, and... a crash, almost certainly, if it's not and something hinky has happened.

The #define for LIBUSB_CLASS_PHYSICAL has been added as a temporary compat shim so that the port that needed it (FreeRDP) can continue to build on -CURRENT in the interim. I will remove it within a couple days, just before MFC and getting __FreeBSD_version values set in stone to be added to the port in lieu of the current #ifdef LIBUSB_CLASS_PHYSICAL.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kevans requested review of this revision.Jun 9 2020, 2:16 AM
lib/libusb/libusb.h
79 ↗(On Diff #72845)

I think you don't need this.

lib/libusb/libusb10.c
1725 ↗(On Diff #72845)

Style, switch and case keyword on same line.

lib/libusb/libusb.h
79 ↗(On Diff #72845)

There is no harm if ports re-define this value.

lib/libusb/libusb.h
79 ↗(On Diff #72845)

Whoops, true enough- it'll resolve to the literal 5 and no worries.

lib/libusb/libusb10.c
1725 ↗(On Diff #72845)

is same "s/line/column"

Fix style and remove useless non-compat shim

MFC after: 1 week

If you need help MFC-ing (9 through 12), just ship it to me!

This revision is now accepted and ready to land.Jun 9 2020, 12:30 PM

You might also want to update the manual page for libusb 1.0 and add an MLINK for the new function.

Fixed a typo in a comment and added the relevant manpage bits.

I might enlist your help on MFC'ing, if you want stable/{9,10}.

This revision now requires review to proceed.Jun 9 2020, 12:46 PM
This revision is now accepted and ready to land.Jun 9 2020, 12:56 PM

Thanks! I added, with appropriate line-breaks, locally: This function will return non-zero if the given capability is supported, 0 if it is not supported. after "This function checks the runtime capabilities of .Nm" to clarify the return value. I'll plan on committing this later today.

This revision was automatically updated to reflect the committed changes.