We currently report v1.0.13 which was from 2012. The external project is currently up to v1.0.27. For OpenOCD this requires us to lie about the version to get USB support to work (see bug #256491 and bug #277688)
It looks like OpenOCD wants at least 1.0.16 so we can start with that. Comparing headers from 1.0.13 and 1.0.16 some highlights I see (additions unless otherwise noted): - enum libusb_descriptor_type - LIBUSB_DT_BOS, LIBUSB_DT_DEVICE_CAPABILITY, LIBUSB_DT_SS_ENDPOINT_COMPANION - some LIBUSB_DT_* #defines - structs libusb_ss_endpoint_companion_descriptor, libusb_bos_dev_capability_descriptor, libusb_bos_descriptor, libusb_usb_2_0_extension_descriptor, libusb_ss_usb_device_capability_descriptor, libusb_container_id_descriptor - enums libusb_supported_speed, libusb_usb_2_0_extension_attributes, libusb_ss_usb_device_capability_attributes, libusb_bos_type - enum libusb_capability - LIBUSB_CAP_HAS_HOTPLUG, LIBUSB_CAP_HAS_HID_ACCESS, LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER functions libusb_setlocale, libusb_strerror, libusb_get_ss_endpoint_companion_descriptor, libusb_free_ss_endpoint_companion_descriptor, libusb_get_bos_descriptor, libusb_free_bos_descriptor, libusb_get_usb_2_0_extension_descriptor, libusb_free_usb_2_0_extension_descriptor, libusb_get_ss_usb_device_capability_descriptor, libusb_free_ss_usb_device_capability_descriptor, libusb_get_container_id_descriptor, libusb_free_container_id_descriptor, libusb_get_port_numbers, libusb_set_auto_detach_kernel_driver libusb_hotplug_* typedefs, enums, functions
libusb_hotplug_register_callback was added in: commit 7bdc064b0b644d15bd9614d9e7db5c4279736d75 Author: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Wed Jun 22 10:38:41 2016 +0000 Implement libusb_hotplug_register_callback() and libusb_hotplug_deregister_callback() for the LibUSB v1.0 API and update the libusb(3) manual page. Approved by: re (kib) Requested by: swills MFC after: 1 week This was introduced in Linux libusb between 1.0.15 and 1.0.16.
AFAICT OpenOCD's 1.0.16 requirement comes from libjaylink and was introduced in: https://gitlab.zapb.de/libjaylink/libjaylink/-/commit/4959f4e18a2bb0de21abe66bbfe403b56f599856 which introduced use of libusb_get_port_numbers libusb_get_bus_number The second one has existed forever, and it is apparently the addition of libusb_get_port_numbers that added the 1.0.16 dependency. libusb_get_port_numbers was introduced in libusb in commit 4d7789be7e317fb2e89557f959c1a1a69cc01b26 Author: Hans de Goede <hdegoede@redhat.com> Date: Fri May 17 10:36:32 2013 +0200 core: Add a new public libusb_get_port_numbers function This new function replaces the now deprecated libusb_get_port_path function, as that is the only function operating on a libusb_device which also takes a libusb_context, which is rather inconsistent. Note we will keep libusb_get_port_path around in the 1.0.x for the forseeable future for ABI compatibility reasons, but it should not be used in any new code. Signed-off-by: Hans de Goede <hdegoede@redhat.com> and in FreeBSD in commit a9205626a7e2f89486e637d6187ff99c17efeb10 Author: Ed Maste <emaste@FreeBSD.org> Date: Fri Jun 7 13:45:58 2013 +0000 Add libusb_get_port_numbers libusbx deprecated libusb_get_port_path and replaced it with libusb_get_port_numbers. The latter omits an extra parameter which was unused in the FreeBSD implementation anyway. (Huh, I don't remember this.) That said, bumping what we report to 1.0.16 seems reasonable enough; we can fault in any missing but required functionality. Change added to Phabricator review and exp-run requested in see-also PR.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5654b42142e1f689b26d405c90379b85f22349a0 commit 5654b42142e1f689b26d405c90379b85f22349a0 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-06-06 13:33:44 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-06-28 16:18:34 +0000 libusb: claim to be version 1.0.16 We are not 100% compatible with 1.0.16, but implement some functionality from that version that is required by certain ports. PR: 277799 PR: 279555 (exp-run) Event: Kitchener-Waterloo Hackathon 202406 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45514 lib/libusb/libusb-1.0.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5bd6e6c1ddff7f10e8b86703536d81af8ce0532b commit 5bd6e6c1ddff7f10e8b86703536d81af8ce0532b Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-06-06 13:33:44 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-08-06 21:25:21 +0000 libusb: claim to be version 1.0.16 We are not 100% compatible with 1.0.16, but implement some functionality from that version that is required by certain ports. PR: 277799 PR: 279555 (exp-run) Event: Kitchener-Waterloo Hackathon 202406 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45514 (cherry picked from commit 5654b42142e1f689b26d405c90379b85f22349a0) lib/libusb/libusb-1.0.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=02ef8e4061abc0a0fc148a8e41efde46fde0d5b0 commit 02ef8e4061abc0a0fc148a8e41efde46fde0d5b0 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-06-06 13:33:44 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-08-06 21:52:37 +0000 libusb: claim to be version 1.0.16 We are not 100% compatible with 1.0.16, but implement some functionality from that version that is required by certain ports. PR: 277799 PR: 279555 (exp-run) Event: Kitchener-Waterloo Hackathon 202406 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45514 (cherry picked from commit 5654b42142e1f689b26d405c90379b85f22349a0) (cherry picked from commit 5bd6e6c1ddff7f10e8b86703536d81af8ce0532b) lib/libusb/libusb-1.0.pc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
^Triage: committed and MFCed.
Some other points are missing in libusb, or different vs upstream, e.g.: - LIBUSB_SPEED_* have been renamed and imply #define LIBUSB_LOW_SPEED_OPERATION LIBUSB_SPEED_LOW #define LIBUSB_FULL_SPEED_OPERATION LIBUSB_SPEED_FULL #define LIBUSB_HIGH_SPEED_OPERATION LIBUSB_SPEED_HIGH #define LIBUSB_SUPER_SPEED_OPERATION LIBUSB_SPEED_SUPER #define bNumDeviceCaps bNumDeviceCapabilities - LIBUSB_SPEED_SUPER_PLUS / LIBUSB_SPEED_SUPER_PLUS_X2 are not supported. These would be useful at least to upgrade the port devel/android-tools. Maybe the PR could be re-opened, or another one should be opened?