From 5f8b966d960ff9cb403a167768c48c2aa4d76710 Mon Sep 17 00:00:00 2001 From: "chihhao.chen" Date: Mon, 20 May 2019 16:55:55 +0800 Subject: Fix non-aio USB read issue for fastbootd non-aio USB read function was stuck in a loop waiting for more data because data length parameter is always set 64 for fastbootd commands. It should be a normal case to get less data than expected since lengths of these commands are usually less than 64. Add logic to check this and one more parameter to distinguish fastbootd from general adbd case. Bug: 133189029 Test: try various fastbootd commands Change-Id: I6690324840d78f3f1e04235040301520329976db --- fastboot/device/usb_client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fastboot') diff --git a/fastboot/device/usb_client.cpp b/fastboot/device/usb_client.cpp index fb51a900b..5921df958 100644 --- a/fastboot/device/usb_client.cpp +++ b/fastboot/device/usb_client.cpp @@ -255,7 +255,8 @@ ssize_t ClientUsbTransport::Read(void* data, size_t len) { size_t bytes_read_total = 0; while (bytes_read_total < len) { auto bytes_to_read = std::min(len - bytes_read_total, kFbFfsNumBufs * kFbFfsBufSize); - auto bytes_read_now = handle_->read(handle_.get(), char_data, bytes_to_read); + auto bytes_read_now = + handle_->read(handle_.get(), char_data, bytes_to_read, true /* allow_partial */); if (bytes_read_now < 0) { return bytes_read_total; } -- cgit v1.2.3