diff --git a/0001-Disable-libusb-SuperSpeed-support.patch b/0001-Disable-libusb-SuperSpeed-support.patch new file mode 100644 index 0000000..d785987 --- /dev/null +++ b/0001-Disable-libusb-SuperSpeed-support.patch @@ -0,0 +1,60 @@ +From 29da99a0d523708c05560c4c6ebe98a42cec50a8 Mon Sep 17 00:00:00 2001 +From: LuK1337 +Date: Sun, 23 Feb 2025 19:05:38 +0100 +Subject: [PATCH] Disable libusb SuperSpeed+ support + +Not available in any released libusb version. +--- + vendor/adb/client/usb_libusb.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/vendor/adb/client/usb_libusb.cpp b/vendor/adb/client/usb_libusb.cpp +index 46d8464..20e171b 100644 +--- a/vendor/adb/client/usb_libusb.cpp ++++ b/vendor/adb/client/usb_libusb.cpp +@@ -503,8 +503,10 @@ struct LibusbConnection : public Connection { + return 5000; + case LIBUSB_SPEED_SUPER_PLUS: + return 10000; ++#if 0 + case LIBUSB_SPEED_SUPER_PLUS_X2: + return 20000; ++#endif + case LIBUSB_SPEED_UNKNOWN: + default: + return 0; +@@ -536,6 +538,7 @@ struct LibusbConnection : public Connection { + } + } + ++#if 0 + 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. +@@ -548,6 +551,7 @@ struct LibusbConnection : public Connection { + } + return max_speed; + } ++#endif + + void RetrieveSpeeds() { + negotiated_speed_ = ToConnectionSpeed(libusb_get_device_speed(device_.get())); +@@ -570,6 +574,7 @@ struct LibusbConnection : public Connection { + libusb_free_ss_usb_device_capability_descriptor(cap); + } + } break; ++#if 0 + case LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY: { + libusb_ssplus_usb_device_capability_descriptor* cap = nullptr; + if (!libusb_get_ssplus_usb_device_capability_descriptor( +@@ -578,6 +583,7 @@ struct LibusbConnection : public Connection { + libusb_free_ssplus_usb_device_capability_descriptor(cap); + } + } break; ++#endif + default: + break; + } +-- +2.48.1 + diff --git a/0001-Fix-libusb-enumeration.patch b/0001-Fix-libusb-enumeration.patch new file mode 100644 index 0000000..e2de8f4 --- /dev/null +++ b/0001-Fix-libusb-enumeration.patch @@ -0,0 +1,38 @@ +From d349fae010f6c780d76e89c5d6b81d45119137c0 Mon Sep 17 00:00:00 2001 +From: Arnav Singh +Date: Sat, 3 Aug 2024 21:55:23 -0700 +Subject: [PATCH] Fix libusb enumeration to handle PINE64 PinePhone modem. + +The PINE64 PinePhone modem exposes itself as an adb-accessible device over USB +but its device class is LIBUSB_CLASS_MISCELLANEOUS, so allow that too. +--- + vendor/adb/client/usb_libusb.cpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/vendor/adb/client/usb_libusb.cpp b/vendor/adb/client/usb_libusb.cpp +index 6133e7c8..9af91eb7 100644 +--- a/vendor/adb/client/usb_libusb.cpp ++++ b/vendor/adb/client/usb_libusb.cpp +@@ -364,8 +364,8 @@ struct LibusbConnection : public Connection { + } + + bool FindInterface(libusb_device_descriptor* device_desc) { +- if (device_desc->bDeviceClass != LIBUSB_CLASS_PER_INTERFACE) { +- // Assume that all Android devices have the device class set to per interface. ++ if (device_desc->bDeviceClass != LIBUSB_CLASS_PER_INTERFACE && device_desc->bDeviceClass != LIBUSB_CLASS_MISCELLANEOUS) { ++ // Assume that all Android devices have the device class set to per interface or miscellaneous. + // TODO: Is this assumption valid? + VLOG(USB) << "skipping device with incorrect class at " << device_address_; + return false; +@@ -1039,7 +1039,7 @@ void usb_init() { + static_cast(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), + LIBUSB_HOTPLUG_ENUMERATE, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY, +- LIBUSB_CLASS_PER_INTERFACE, hotplug_callback, nullptr, nullptr); ++ LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, nullptr, nullptr); + + if (rc != LIBUSB_SUCCESS) { + LOG(FATAL) << "failed to register libusb hotplug callback"; +-- +2.46.0 + diff --git a/android-tools.spec b/android-tools.spec index c1de961..0b5b941 100644 --- a/android-tools.spec +++ b/android-tools.spec @@ -1,7 +1,7 @@ %global _hardened_build 1 Name: android-tools -Version: 35.0.1 +Version: 35.0.2 Release: %autorelease Epoch: 1 Summary: Android platform tools(adb, fastboot) @@ -15,9 +15,14 @@ URL: http://developer.android.com/guide/developing/tools/ Source0: https://github.com/nmeum/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz Source1: 51-android.rules Source2: adb.service +# https://github.com/nmeum/android-tools/issues/153 +Patch0: 0001-Fix-libusb-enumeration.patch +# https://github.com/libusb/libusb/pull/1428, https://github.com/libusb/libusb/pull/1477 +Patch1: 0001-Disable-libusb-SuperSpeed-support.patch BuildRequires: brotli-devel BuildRequires: cmake +BuildRequires: fmt-devel BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gtest-devel @@ -124,6 +129,7 @@ install -d -m 0775 ${RPM_BUILD_ROOT}%{_sharedstatedir}/adb %{_datadir}/android-tools/mkbootimg/mkbootimg.py %{_datadir}/bash-completion/completions/adb %{_datadir}/bash-completion/completions/fastboot +%{_mandir}/man1/adb.1.* %changelog %autochangelog diff --git a/sources b/sources index a821f25..40b919f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (android-tools-35.0.1.tar.xz) = 2dc3831f29a2c5ffc57978e4a6fa6d1469bcb0740750779b3e4f8239eaec87864f3474254a2d649ab630062be091d8b44a4e45c7e7b7e033f3b4481f81d76296 +SHA512 (android-tools-35.0.2.tar.xz) = 391ce4d638b274d7bbae24a3df8de8b5812a982570f29b2aef37d12a3ba7ed6f66b5c0b7f908759e0b0da30d152b5319af0fef16c54bdc3b9f4074fb22f80d10