diff options
Diffstat (limited to 'drivers/usb/gadget/f_fastboot.c')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 9f322c9550..09e740cc96 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -497,6 +497,25 @@ static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req) do_exit_on_complete(ep, req); } +static int multiresponse_cmd = -1; +static void multiresponse_on_complete(struct usb_ep *ep, struct usb_request *req) +{ + char response[FASTBOOT_RESPONSE_LEN] = {0}; + + if (multiresponse_cmd == -1) + return; + + /* Call handler to obtain next response */ + fastboot_multiresponse(multiresponse_cmd, response); + fastboot_tx_write_str(response); + + /* If response is final OKAY/FAIL response disconnect this handler and unset cmd */ + if (!strncmp("OKAY", response, 4) || !strncmp("FAIL", response, 4)) { + multiresponse_cmd = -1; + fastboot_func->in_req->complete = fastboot_complete; + } +} + static void do_acmd_complete(struct usb_ep *ep, struct usb_request *req) { /* When usb dequeue complete will be called @@ -524,6 +543,16 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req) fastboot_fail("buffer overflow", response); } + if (!strncmp(FASTBOOT_MULTIRESPONSE_START, response, 4)) { + multiresponse_cmd = cmd; + fastboot_multiresponse(multiresponse_cmd, response); + + /* Only add complete callback if first is not a final OKAY/FAIL response */ + if (strncmp("OKAY", response, 4) && strncmp("FAIL", response, 4)) { + fastboot_func->in_req->complete = multiresponse_on_complete; + } + } + if (!strncmp("DATA", response, 4)) { req->complete = rx_handler_dl_image; req->length = rx_bytes_expected(ep); |