fs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c5d3da1a28cb534a9a730a94bc1962853c67573 Auto-Submitted: auto-generated Date: Mon, 13 Apr 2026 18:31:30 +0000 Message-Id: <69dd3682.3b2a9.712f3c91@gitrepo.freebsd.org> The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/ports/commit/?id=2c5d3da1a28cb534a9a730a94bc1962853c67573 commit 2c5d3da1a28cb534a9a730a94bc1962853c67573 Author: Baptiste Daroussin AuthorDate: 2026-04-13 18:29:55 +0000 Commit: Baptiste Daroussin CommitDate: 2026-04-13 18:31:22 +0000 devel/android-tools: fix build on FreeBSD 14 the libusb backends uses macros which only exists on FreeBSD 15.0+ switch back to literals so it builds everywhere. PR: 294487 --- .../files/patch-vendor_adb_client_usb_libusb.cpp | 44 +++++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp index 948f55ad3ae1..eb215f1e08a9 100644 --- a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp +++ b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp @@ -1,5 +1,5 @@ ---- vendor/adb/client/usb_libusb.cpp 2024-08-29 19:46:57.000000000 +0200 -+++ vendor/adb/client/usb_libusb.cpp 2026-03-21 14:00:02.239458000 +0100 +--- vendor/adb/client/usb_libusb.cpp.orig 2024-08-29 19:46:57.000000000 +0200 ++++ vendor/adb/client/usb_libusb.cpp 2026-04-13 19:58:23.616588000 +0200 @@ -38,6 +38,8 @@ #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB @@ -20,7 +20,28 @@ case LIBUSB_SPEED_UNKNOWN: default: return 0; -@@ -540,6 +544,7 @@ +@@ -526,20 +530,23 @@ + msb++; + } + +- switch (1 << msb) { +- case LIBUSB_LOW_SPEED_OPERATION: ++ // Use literal values from 'enum libusb_supported_speed' (USB spec defined bits) ++ // to remain portable across libusb implementations that may not expose the enum. ++ switch (1 << msb) { ++ case (1 << 0): // LIBUSB_LOW_SPEED_OPERATION + return 1; +- case LIBUSB_FULL_SPEED_OPERATION: ++ case (1 << 1): // LIBUSB_FULL_SPEED_OPERATION + return 12; +- case LIBUSB_HIGH_SPEED_OPERATION: ++ case (1 << 2): // LIBUSB_HIGH_SPEED_OPERATION + return 480; +- case LIBUSB_SUPER_SPEED_OPERATION: ++ case (1 << 3): // LIBUSB_SUPER_SPEED_OPERATION + return 5000; + default: + return 0; } } @@ -28,7 +49,7 @@ static uint64_t ExtractMaxSuperSpeedPlus(libusb_ssplus_usb_device_capability_descriptor* cap) { // The exponents is one of {bytes, kB, MB, or GB}. We express speed in MB so we use a 0 // multiplier for value which would result in 0MB anyway. -@@ -552,6 +557,7 @@ +@@ -552,6 +559,7 @@ } return max_speed; } @@ -36,7 +57,18 @@ void RetrieveSpeeds() { negotiated_speed_ = ToConnectionSpeed(libusb_get_device_speed(device_.get())); -@@ -574,6 +580,7 @@ +@@ -563,7 +571,9 @@ + return; + } + +- for (int i = 0; i < bos->bNumDeviceCaps; i++) { ++ // Use bNumDeviceCapabilities for portability: on FreeBSD < 15 the field has ++ // this name; on FreeBSD >= 15 and upstream libusb it is a macro alias. ++ for (int i = 0; i < bos->bNumDeviceCapabilities; i++) { + switch (bos->dev_capability[i]->bDevCapabilityType) { + case LIBUSB_BT_SS_USB_DEVICE_CAPABILITY: { + libusb_ss_usb_device_capability_descriptor* cap = nullptr; +@@ -574,6 +584,7 @@ libusb_free_ss_usb_device_capability_descriptor(cap); } } break; @@ -44,7 +76,7 @@ case LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY: { libusb_ssplus_usb_device_capability_descriptor* cap = nullptr; if (!libusb_get_ssplus_usb_device_capability_descriptor( -@@ -582,6 +589,7 @@ +@@ -582,6 +593,7 @@ libusb_free_ssplus_usb_device_capability_descriptor(cap); } } break;