adb: disable checksum on new versions
The checksum is unnecessary. Improves adb performance by 40% on USB2.
Test: new adb works with new + old adbd, old adb works with new adbd
bug 67327728
Change-Id: I761d8a5a62deaea9bbb092ea9926b2d6d312f00d
diff --git a/adb/transport.cpp b/adb/transport.cpp
index 089a1ec..5cf2450 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -163,7 +163,12 @@
void send_packet(apacket* p, atransport* t) {
p->msg.magic = p->msg.command ^ 0xffffffff;
- p->msg.data_check = calculate_apacket_checksum(p);
+ // 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);
@@ -1089,10 +1094,6 @@
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();