fastboot: Add support to send INFO messages through fastboot.
Change-Id: I5eecb68688a4a7ec95d8af6ba4d6c017dd67ebd6
diff --git a/app/aboot/fastboot.c b/app/aboot/fastboot.c
index d247918..f096a49 100644
--- a/app/aboot/fastboot.c
+++ b/app/aboot/fastboot.c
@@ -33,6 +33,8 @@
#include <kernel/event.h>
#include <dev/udc.h>
+#define MAX_RSP_SIZE 64
+
void boot_linux(void *bootimg, unsigned sz);
/* todo: give lk strtoul and nuke this */
@@ -203,7 +205,7 @@
void fastboot_ack(const char *code, const char *reason)
{
- char response[64];
+ char response[MAX_RSP_SIZE];
if (fastboot_state != STATE_COMMAND)
return;
@@ -211,13 +213,28 @@
if (reason == 0)
reason = "";
- snprintf(response, 64, "%s%s", code, reason);
+ snprintf(response, MAX_RSP_SIZE, "%s%s", code, reason);
fastboot_state = STATE_COMPLETE;
usb_write(response, strlen(response));
}
+void fastboot_info(const char *reason)
+{
+ char response[MAX_RSP_SIZE];
+
+ if (fastboot_state != STATE_COMMAND)
+ return;
+
+ if (reason == 0)
+ return;
+
+ snprintf(response, MAX_RSP_SIZE, "INFO%s", reason);
+
+ usb_write(response, strlen(response));
+}
+
void fastboot_fail(const char *reason)
{
fastboot_ack("FAIL", reason);
@@ -243,7 +260,7 @@
static void cmd_download(const char *arg, void *data, unsigned sz)
{
- char response[64];
+ char response[MAX_RSP_SIZE];
unsigned len = hex2unsigned(arg);
int r;
@@ -274,7 +291,7 @@
again:
while (fastboot_state != STATE_ERROR) {
- r = usb_read(buffer, 64);
+ r = usb_read(buffer, MAX_RSP_SIZE);
if (r < 0) break;
buffer[r] = 0;
dprintf(INFO,"fastboot: %s\n", buffer);