Merge "fuzzy_fastboot: use 'tcp:' prefix to identify fastboot protocol." into android10-tests-dev
This commit is contained in:
commit
da84e29fdf
1 changed files with 10 additions and 15 deletions
|
|
@ -45,6 +45,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
|
#include <android-base/strings.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "fastboot_driver.h"
|
#include "fastboot_driver.h"
|
||||||
|
|
@ -76,8 +77,7 @@ int FastBootTest::MatchFastboot(usb_ifc_info* info, const std::string& local_ser
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FastBootTest::IsFastbootOverTcp() {
|
bool FastBootTest::IsFastbootOverTcp() {
|
||||||
// serial contains ":" is treated as host ip and port number
|
return android::base::StartsWith(device_serial, "tcp:");
|
||||||
return (device_serial.find(":") != std::string::npos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FastBootTest::UsbStillAvailible() {
|
bool FastBootTest::UsbStillAvailible() {
|
||||||
|
|
@ -182,19 +182,14 @@ void FastBootTest::TearDownSerial() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastBootTest::ConnectTcpFastbootDevice() {
|
void FastBootTest::ConnectTcpFastbootDevice() {
|
||||||
std::size_t found = device_serial.find(":");
|
for (int i = 0; i < MAX_TCP_TRIES && !transport; i++) {
|
||||||
if (found != std::string::npos) {
|
std::string error;
|
||||||
for (int i = 0; i < MAX_TCP_TRIES && !transport; i++) {
|
std::unique_ptr<Transport> tcp(
|
||||||
std::string error;
|
tcp::Connect(device_serial.substr(4), tcp::kDefaultPort, &error).release());
|
||||||
std::unique_ptr<Transport> tcp(
|
if (tcp)
|
||||||
tcp::Connect(device_serial.substr(0, found), tcp::kDefaultPort, &error)
|
transport = std::unique_ptr<TransportSniffer>(new TransportSniffer(std::move(tcp), 0));
|
||||||
.release());
|
if (transport != nullptr) break;
|
||||||
if (tcp)
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
transport =
|
|
||||||
std::unique_ptr<TransportSniffer>(new TransportSniffer(std::move(tcp), 0));
|
|
||||||
if (transport != nullptr) break;
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue