Merge changes I983f361d,I899c8433,Ie6f4b029,Ic3cb9c82,I27107d05
* changes:
Remove unused variable.
Remove -i vendor id matching.
Add quotes to -v INFO/OKAY/FAIL for clarity.
Remove legacy slot-suffix support.
Add fastboot_test.cpp and test --os-version/--os-patch-level parsing.
diff --git a/adb/client/usb_osx.cpp b/adb/client/usb_osx.cpp
index b15d28a..8a95a19 100644
--- a/adb/client/usb_osx.cpp
+++ b/adb/client/usb_osx.cpp
@@ -50,7 +50,7 @@
{
UInt8 bulkIn;
UInt8 bulkOut;
- IOUSBInterfaceInterface190** interface;
+ IOUSBInterfaceInterface550** interface;
unsigned int zero_mask;
size_t max_packet_size;
@@ -106,8 +106,8 @@
}
static void AndroidInterfaceAdded(io_iterator_t iterator);
-static std::unique_ptr<usb_handle> CheckInterface(IOUSBInterfaceInterface190 **iface,
- UInt16 vendor, UInt16 product);
+static std::unique_ptr<usb_handle> CheckInterface(IOUSBInterfaceInterface550** iface, UInt16 vendor,
+ UInt16 product);
static bool FindUSBDevices() {
// Create the matching dictionary to find the Android device's adb interface.
@@ -295,8 +295,8 @@
continue;
}
- std::unique_ptr<usb_handle> handle = CheckInterface((IOUSBInterfaceInterface190**)iface,
- vendor, product);
+ std::unique_ptr<usb_handle> handle =
+ CheckInterface((IOUSBInterfaceInterface550**)iface, vendor, product);
if (handle == nullptr) {
LOG(ERROR) << "Could not find device interface";
(*iface)->Release(iface);
@@ -315,7 +315,7 @@
// Used to clear both the endpoints before starting.
// When adb quits, we might clear the host endpoint but not the device.
// So we make sure both sides are clear before starting up.
-static bool ClearPipeStallBothEnds(IOUSBInterfaceInterface190** interface, UInt8 bulkEp) {
+static bool ClearPipeStallBothEnds(IOUSBInterfaceInterface550** interface, UInt8 bulkEp) {
IOReturn rc = (*interface)->ClearPipeStallBothEnds(interface, bulkEp);
if (rc != kIOReturnSuccess) {
LOG(ERROR) << "Could not clear pipe stall both ends: " << std::hex << rc;
@@ -326,9 +326,8 @@
//* TODO: simplify this further since we only register to get ADB interface
//* subclass+protocol events
-static std::unique_ptr<usb_handle>
-CheckInterface(IOUSBInterfaceInterface190 **interface, UInt16 vendor, UInt16 product)
-{
+static std::unique_ptr<usb_handle> CheckInterface(IOUSBInterfaceInterface550** interface,
+ UInt16 vendor, UInt16 product) {
std::unique_ptr<usb_handle> handle;
IOReturn kr;
UInt8 interfaceNumEndpoints, interfaceClass, interfaceSubClass, interfaceProtocol;
@@ -376,9 +375,14 @@
UInt8 interval;
UInt8 number;
UInt8 direction;
+ UInt8 maxBurst;
+ UInt8 mult;
+ UInt16 bytesPerInterval;
- kr = (*interface)->GetPipeProperties(interface, endpoint, &direction,
- &number, &transferType, &maxPacketSize, &interval);
+ kr = (*interface)
+ ->GetPipePropertiesV2(interface, endpoint, &direction, &number, &transferType,
+ &maxPacketSize, &interval, &maxBurst, &mult,
+ &bytesPerInterval);
if (kr != kIOReturnSuccess) {
LOG(ERROR) << "FindDeviceInterface - could not get pipe properties: "
<< std::hex << kr;
@@ -397,6 +401,13 @@
if (!ClearPipeStallBothEnds(interface, handle->bulkOut)) goto err_get_pipe_props;
}
+ if (maxBurst != 0)
+ // bMaxBurst is the number of additional packets in the burst.
+ maxPacketSize /= (maxBurst + 1);
+
+ // mult is only relevant for isochronous endpoints.
+ CHECK_EQ(0, mult);
+
handle->zero_mask = maxPacketSize - 1;
handle->max_packet_size = maxPacketSize;
}
diff --git a/adb/test_device.py b/adb/test_device.py
index d39eb14..b1ad043 100644
--- a/adb/test_device.py
+++ b/adb/test_device.py
@@ -1275,16 +1275,18 @@
"""
# The values that trigger things are 507 (512 - 5 bytes from shell protocol) + 1024*n
# Probe some surrounding values as well, for the hell of it.
- for length in [506, 507, 508, 1018, 1019, 1020, 1530, 1531, 1532]:
- cmd = ['dd', 'if=/dev/zero', 'bs={}'.format(length), 'count=1', '2>/dev/null;'
- 'echo', 'foo']
- rc, stdout, _ = self.device.shell_nocheck(cmd)
+ for base in [512] + range(1024, 1024 * 16, 1024):
+ for offset in [-6, -5, -4]:
+ length = base + offset
+ cmd = ['dd', 'if=/dev/zero', 'bs={}'.format(length), 'count=1', '2>/dev/null;'
+ 'echo', 'foo']
+ rc, stdout, _ = self.device.shell_nocheck(cmd)
- self.assertEqual(0, rc)
+ self.assertEqual(0, rc)
- # Output should be '\0' * length, followed by "foo\n"
- self.assertEqual(length, len(stdout) - 4)
- self.assertEqual(stdout, "\0" * length + "foo\n")
+ # Output should be '\0' * length, followed by "foo\n"
+ self.assertEqual(length, len(stdout) - 4)
+ self.assertEqual(stdout, "\0" * length + "foo\n")
def main():
diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
index a1e1677..14dabaa 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -20,6 +20,7 @@
#include <android-base/errors.h>
#include <android-base/file.h>
+#include <android-base/macros.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
diff --git a/libutils/include/utils/Errors.h b/libutils/include/utils/Errors.h
index 16e1fa2..7093a20 100644
--- a/libutils/include/utils/Errors.h
+++ b/libutils/include/utils/Errors.h
@@ -81,8 +81,8 @@
# define NO_ERROR 0L
#endif
-}; // namespace android
-
+} // namespace android
+
// ---------------------------------------------------------------------------
#endif // ANDROID_ERRORS_H
diff --git a/libutils/include/utils/LightRefBase.h b/libutils/include/utils/LightRefBase.h
index 65257ed..e488e60 100644
--- a/libutils/include/utils/LightRefBase.h
+++ b/libutils/include/utils/LightRefBase.h
@@ -69,4 +69,4 @@
virtual ~VirtualLightRefBase() = default;
};
-}; // namespace android
+} // namespace android
diff --git a/libutils/include/utils/RefBase.h b/libutils/include/utils/RefBase.h
index 223b666..e817ee4 100644
--- a/libutils/include/utils/RefBase.h
+++ b/libutils/include/utils/RefBase.h
@@ -683,7 +683,7 @@
ReferenceMover::move_references(d, s, n);
}
-}; // namespace android
+} // namespace android
// ---------------------------------------------------------------------------
diff --git a/libutils/include/utils/String16.h b/libutils/include/utils/String16.h
index 5f0ce06..afbc2ed 100644
--- a/libutils/include/utils/String16.h
+++ b/libutils/include/utils/String16.h
@@ -243,7 +243,7 @@
return mString;
}
-}; // namespace android
+} // namespace android
// ---------------------------------------------------------------------------
diff --git a/libutils/include/utils/StrongPointer.h b/libutils/include/utils/StrongPointer.h
index ae6d9c8..9cd278f1 100644
--- a/libutils/include/utils/StrongPointer.h
+++ b/libutils/include/utils/StrongPointer.h
@@ -239,7 +239,7 @@
m_ptr = ptr;
}
-}; // namespace android
+} // namespace android
// ---------------------------------------------------------------------------
diff --git a/libutils/include/utils/TypeHelpers.h b/libutils/include/utils/TypeHelpers.h
index 28fbca5..1554f52 100644
--- a/libutils/include/utils/TypeHelpers.h
+++ b/libutils/include/utils/TypeHelpers.h
@@ -329,7 +329,7 @@
return hash_type(uintptr_t(value));
}
-}; // namespace android
+} // namespace android
// ---------------------------------------------------------------------------
diff --git a/libutils/include/utils/misc.h b/libutils/include/utils/misc.h
index af5ea02..32615b3 100644
--- a/libutils/include/utils/misc.h
+++ b/libutils/include/utils/misc.h
@@ -35,6 +35,6 @@
void add_sysprop_change_callback(sysprop_change_callback cb, int priority);
void report_sysprop_change();
-}; // namespace android
+} // namespace android
#endif // _LIBS_UTILS_MISC_H