Loading adb/adb.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,10 @@ void send_connect(atransport* t) { D("Calling send_connect"); apacket* cp = get_apacket(); cp->msg.command = A_CNXN; cp->msg.arg0 = t->get_protocol_version(); // Send the max supported version, but because the transport is // initialized to A_VERSION_MIN, this will be compatible with every // device. cp->msg.arg0 = A_VERSION; cp->msg.arg1 = t->get_max_payload(); std::string connection_str = get_connection_string(); Loading adb/adb.h +7 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,12 @@ constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304; #define A_AUTH 0x48545541 // ADB protocol version. #define A_VERSION 0x01000000 // Version revision: // 0x01000000: original // 0x01000001: skip checksum (Dec 2017) #define A_VERSION_MIN 0x01000000 #define A_VERSION_SKIP_CHECKSUM 0x01000001 #define A_VERSION 0x01000001 // Used for help/version information. #define ADB_VERSION_MAJOR 1 Loading @@ -53,7 +58,7 @@ constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304; std::string adb_version(); // Increment this when we want to force users to start a new adb server. #define ADB_SERVER_VERSION 39 #define ADB_SERVER_VERSION 40 using TransportId = uint64_t; class atransport; Loading adb/transport.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -163,7 +163,12 @@ static void transport_socket_events(int fd, unsigned events, void* _t) { void send_packet(apacket* p, atransport* t) { p->msg.magic = p->msg.command ^ 0xffffffff; // compute a checksum for connection/auth packets for compatibility reasons if (t->get_protocol_version() >= A_VERSION_SKIP_CHECKSUM) { p->msg.data_check = 0; } else { p->msg.data_check = calculate_apacket_checksum(p); } print_packet("send", p); Loading Loading @@ -1089,10 +1094,6 @@ bool check_header(apacket* p, atransport* t) { return true; } bool check_data(apacket* p) { return calculate_apacket_checksum(p) == p->msg.data_check; } #if ADB_HOST std::shared_ptr<RSA> atransport::NextKey() { if (keys_.empty()) keys_ = adb_auth_get_private_keys(); Loading adb/transport.h +3 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,9 @@ class atransport { atransport(ConnectionState state = kCsOffline) : id(NextTransportId()), connection_state_(state) { transport_fde = {}; protocol_version = A_VERSION; // Initialize protocol to min version for compatibility with older versions. // Version will be updated post-connect. protocol_version = A_VERSION_MIN; max_payload = MAX_PAYLOAD; } virtual ~atransport() {} Loading Loading @@ -223,7 +225,6 @@ int register_socket_transport(int s, const char* serial, int port, int local); void unregister_usb_transport(usb_handle* usb); bool check_header(apacket* p, atransport* t); bool check_data(apacket* p); void close_usb_devices(); void close_usb_devices(std::function<bool(const atransport*)> predicate); Loading adb/transport_local.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -77,11 +77,6 @@ static int remote_read(apacket *p, atransport *t) return -1; } if (!check_data(p)) { D("bad data: terminated (data)"); return -1; } return 0; } Loading Loading
adb/adb.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,10 @@ void send_connect(atransport* t) { D("Calling send_connect"); apacket* cp = get_apacket(); cp->msg.command = A_CNXN; cp->msg.arg0 = t->get_protocol_version(); // Send the max supported version, but because the transport is // initialized to A_VERSION_MIN, this will be compatible with every // device. cp->msg.arg0 = A_VERSION; cp->msg.arg1 = t->get_max_payload(); std::string connection_str = get_connection_string(); Loading
adb/adb.h +7 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,12 @@ constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304; #define A_AUTH 0x48545541 // ADB protocol version. #define A_VERSION 0x01000000 // Version revision: // 0x01000000: original // 0x01000001: skip checksum (Dec 2017) #define A_VERSION_MIN 0x01000000 #define A_VERSION_SKIP_CHECKSUM 0x01000001 #define A_VERSION 0x01000001 // Used for help/version information. #define ADB_VERSION_MAJOR 1 Loading @@ -53,7 +58,7 @@ constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304; std::string adb_version(); // Increment this when we want to force users to start a new adb server. #define ADB_SERVER_VERSION 39 #define ADB_SERVER_VERSION 40 using TransportId = uint64_t; class atransport; Loading
adb/transport.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -163,7 +163,12 @@ static void transport_socket_events(int fd, unsigned events, void* _t) { void send_packet(apacket* p, atransport* t) { p->msg.magic = p->msg.command ^ 0xffffffff; // compute a checksum for connection/auth packets for compatibility reasons if (t->get_protocol_version() >= A_VERSION_SKIP_CHECKSUM) { p->msg.data_check = 0; } else { p->msg.data_check = calculate_apacket_checksum(p); } print_packet("send", p); Loading Loading @@ -1089,10 +1094,6 @@ bool check_header(apacket* p, atransport* t) { return true; } bool check_data(apacket* p) { return calculate_apacket_checksum(p) == p->msg.data_check; } #if ADB_HOST std::shared_ptr<RSA> atransport::NextKey() { if (keys_.empty()) keys_ = adb_auth_get_private_keys(); Loading
adb/transport.h +3 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,9 @@ class atransport { atransport(ConnectionState state = kCsOffline) : id(NextTransportId()), connection_state_(state) { transport_fde = {}; protocol_version = A_VERSION; // Initialize protocol to min version for compatibility with older versions. // Version will be updated post-connect. protocol_version = A_VERSION_MIN; max_payload = MAX_PAYLOAD; } virtual ~atransport() {} Loading Loading @@ -223,7 +225,6 @@ int register_socket_transport(int s, const char* serial, int port, int local); void unregister_usb_transport(usb_handle* usb); bool check_header(apacket* p, atransport* t); bool check_data(apacket* p); void close_usb_devices(); void close_usb_devices(std::function<bool(const atransport*)> predicate); Loading
adb/transport_local.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -77,11 +77,6 @@ static int remote_read(apacket *p, atransport *t) return -1; } if (!check_data(p)) { D("bad data: terminated (data)"); return -1; } return 0; } Loading