summaryrefslogtreecommitdiff
path: root/fastboot/engine.cpp
diff options
context:
space:
mode:
authorJocelyn Bohr <bohr@google.com>2017-01-27 14:17:56 -0800
committerJocelyn Bohr <bohr@google.com>2017-04-27 16:47:51 -0700
commit91fefadc2e99ffd7e6fb12637dcf94df547cdb89 (patch)
tree0a9809599e1f7d1ae7384ca13ffb09a13f0499ba /fastboot/engine.cpp
parent98cc28316866e554f6fcb2c2e4f96ca09d98130f (diff)
fastboot: Add 'get_staged' command
(cherry-picked from internal nyc-iot-dev to AOSP) New user-level command usage: * fastboot get_staged <outfile> Reads staged data from the last command handled by the device. If the last command did not result in staged data, this command will fail. This enables data staged by OEM commands to be transferred from device to host. get_staged wraps new device command "upload". Fastboot clients are not required to support "upload", so get_staged won't work on all devices. Bug: 36002804 Test: Implemented "upload" in fastboot on imx6ul. Verified that uploading ~100K data from the device works. Change-Id: I5b1a1ce023f362062505ee62746ea8ab6f36bfbf (cherry-picked from commit 83a875de994bf48f0faa2a8a23ceb0b8f52b6b04)
Diffstat (limited to 'fastboot/engine.cpp')
-rw-r--r--fastboot/engine.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/fastboot/engine.cpp b/fastboot/engine.cpp
index 4cf89ca85..56ee81637 100644
--- a/fastboot/engine.cpp
+++ b/fastboot/engine.cpp
@@ -45,6 +45,7 @@
#define OP_DOWNLOAD_SPARSE 5
#define OP_WAIT_FOR_DISCONNECT 6
#define OP_DOWNLOAD_FD 7
+#define OP_UPLOAD 8
typedef struct Action Action;
@@ -341,6 +342,13 @@ void fb_queue_download_fd(const char *name, int fd, uint32_t sz)
a->msg = mkmsg("sending '%s' (%d KB)", name, sz / 1024);
}
+void fb_queue_upload(char *outfile)
+{
+ Action *a = queue_action(OP_UPLOAD, "");
+ a->data = outfile;
+ a->msg = mkmsg("uploading '%s'", outfile);
+}
+
void fb_queue_notice(const char *notice)
{
Action *a = queue_action(OP_NOTICE, "");
@@ -395,6 +403,9 @@ int64_t fb_execute_queue(Transport* transport)
if (status) break;
} else if (a->op == OP_WAIT_FOR_DISCONNECT) {
transport->WaitForDisconnect();
+ } else if (a->op == OP_UPLOAD) {
+ status = fb_upload_data(transport, reinterpret_cast<char*>(a->data));
+ status = a->func(a, status, status ? fb_get_error().c_str() : "");
} else {
die("bogus action");
}