Merge "adb: remove SendConnectOnHost."
This commit is contained in:
commit
5eaa5bc081
6 changed files with 9 additions and 35 deletions
15
adb/adb.cpp
15
adb/adb.cpp
|
@ -257,19 +257,6 @@ void send_connect(atransport* t) {
|
|||
send_packet(cp, t);
|
||||
}
|
||||
|
||||
#if ADB_HOST
|
||||
|
||||
void SendConnectOnHost(atransport* t) {
|
||||
// Send an empty message before A_CNXN message. This is because the data toggle of the ep_out on
|
||||
// host and ep_in on device may not be the same.
|
||||
apacket* p = get_apacket();
|
||||
CHECK(p);
|
||||
send_packet(p, t);
|
||||
send_connect(t);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// qual_overwrite is used to overwrite a qualifier string. dst is a
|
||||
// pointer to a char pointer. It is assumed that if *dst is non-NULL, it
|
||||
// was malloc'ed and needs to freed. *dst will be set to a dup of src.
|
||||
|
@ -370,7 +357,7 @@ void handle_packet(apacket *p, atransport *t)
|
|||
if (p->msg.arg0){
|
||||
send_packet(p, t);
|
||||
#if ADB_HOST
|
||||
SendConnectOnHost(t);
|
||||
send_connect(t);
|
||||
#endif
|
||||
} else {
|
||||
t->SetConnectionState(kCsOffline);
|
||||
|
|
|
@ -224,9 +224,6 @@ void handle_online(atransport *t);
|
|||
void handle_offline(atransport *t);
|
||||
|
||||
void send_connect(atransport *t);
|
||||
#if ADB_HOST
|
||||
void SendConnectOnHost(atransport* t);
|
||||
#endif
|
||||
|
||||
void parse_banner(const std::string&, atransport* t);
|
||||
|
||||
|
|
|
@ -333,6 +333,13 @@ static void process_device(libusb_device* device) {
|
|||
return;
|
||||
}
|
||||
|
||||
rc = libusb_set_interface_alt_setting(handle.get(), interface_num, 0);
|
||||
if (rc != 0) {
|
||||
LOG(WARNING) << "failed to set interface alt setting for device '" << device_serial
|
||||
<< "'" << libusb_error_name(rc);
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8_t endpoint : {bulk_in, bulk_out}) {
|
||||
rc = libusb_clear_halt(handle.get(), endpoint);
|
||||
if (rc != 0) {
|
||||
|
|
|
@ -1101,11 +1101,4 @@ std::shared_ptr<RSA> atransport::NextKey() {
|
|||
keys_.pop_front();
|
||||
return result;
|
||||
}
|
||||
bool atransport::SetSendConnectOnError() {
|
||||
if (has_send_connect_on_error_) {
|
||||
return false;
|
||||
}
|
||||
has_send_connect_on_error_ = true;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -122,7 +122,6 @@ class atransport {
|
|||
|
||||
#if ADB_HOST
|
||||
std::shared_ptr<RSA> NextKey();
|
||||
bool SetSendConnectOnError();
|
||||
#endif
|
||||
|
||||
char token[TOKEN_SIZE] = {};
|
||||
|
@ -181,7 +180,6 @@ private:
|
|||
std::atomic<ConnectionState> connection_state_;
|
||||
#if ADB_HOST
|
||||
std::deque<std::shared_ptr<RSA>> keys_;
|
||||
bool has_send_connect_on_error_ = false;
|
||||
#endif
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(atransport);
|
||||
|
|
|
@ -103,13 +103,6 @@ static int remote_read(apacket* p, atransport* t) {
|
|||
|
||||
err_msg:
|
||||
p->msg.command = 0;
|
||||
if (t->GetConnectionState() == kCsOffline) {
|
||||
// If the data toggle of ep_out on device and ep_in on host are not the same, we may receive
|
||||
// an error message. In this case, resend one A_CNXN message to connect the device.
|
||||
if (t->SetSendConnectOnError()) {
|
||||
SendConnectOnHost(t);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -162,8 +155,7 @@ static int remote_write(apacket *p, atransport *t)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void remote_close(atransport *t)
|
||||
{
|
||||
static void remote_close(atransport* t) {
|
||||
usb_close(t->usb);
|
||||
t->usb = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue