fastboot driver: add RunAndReadBuffer helper

Refactor UploadInner and add a new RunAndReadBuffer helper function
that handles the generic procedure of:

1. Sending a command
2. Receiving a DATA response with N bytes
3. Receiving another response

Test: pass
Bug: 173654501

Change-Id: I568bea127315e42d8a111c23602fc582e7bc935b
diff --git a/fastboot/fastboot_driver.h b/fastboot/fastboot_driver.h
index 7265632..4d7f3c7 100644
--- a/fastboot/fastboot_driver.h
+++ b/fastboot/fastboot_driver.h
@@ -149,11 +149,13 @@
     RetCode SendBuffer(const std::vector<char>& buf);
     RetCode SendBuffer(const void* buf, size_t size);
 
-    RetCode ReadBuffer(std::vector<char>& buf);
     RetCode ReadBuffer(void* buf, size_t size);
 
     RetCode UploadInner(const std::string& outfile, std::string* response = nullptr,
                         std::vector<std::string>* info = nullptr);
+    RetCode RunAndReadBuffer(const std::string& cmd, std::string* response,
+                             std::vector<std::string>* info,
+                             const std::function<RetCode(const char*, uint64_t)>& write_fn);
 
     int SparseWriteCallback(std::vector<char>& tpbuf, const char* data, size_t len);