mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 01:21:49 +00:00
g: usb_updater: fix option description and add post_reset
The new option allows the operator to explicitly request the post
reset reboot instead of immediate reboot (which is now ignored by
production cr50 images).
Also sort option descriptions and move the colons where they belong
(after command line arguments requiring additional parameters),
BRANCH=none
BUG=none
TEST=running usb_updater with -b or -d without extra parameter causes
the return error code and the help message printed.
running
$ ./extra/usb_updater/usb_updater -p build/cr50/ec.bin
results in a proper image transfer, with the following reboot of
the chromeos device triggering cr50 reset and the new downloaded
image running.
Change-Id: I64328973a2dfac1b78262f1ffacd677e52956d27
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/446939
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
6ba124a81b
commit
31cfc63b80
@@ -204,7 +204,7 @@ struct transfer_descriptor {
|
||||
*/
|
||||
uint32_t ro_offset;
|
||||
uint32_t rw_offset;
|
||||
|
||||
uint32_t post_reset;
|
||||
enum transfer_type {
|
||||
usb_xfer = 0,
|
||||
spi_xfer = 1
|
||||
@@ -217,17 +217,18 @@ struct transfer_descriptor {
|
||||
|
||||
static uint32_t protocol_version;
|
||||
static char *progname;
|
||||
static char *short_opts = ":bcfd:hsu";
|
||||
static char *short_opts = "b:cd:fhpsu";
|
||||
static const struct option long_opts[] = {
|
||||
/* name hasarg *flag val */
|
||||
{"binvers", 0, NULL, 'b'},
|
||||
{"corrupt", 0, NULL, 'c'},
|
||||
{"device", 1, NULL, 'd'},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"spi", 0, NULL, 's'},
|
||||
{"upstart", 0, NULL, 'u'},
|
||||
{"fwver", 0, NULL, 'f'},
|
||||
{NULL, 0, NULL, 0},
|
||||
{"binvers", 1, NULL, 'b'},
|
||||
{"corrupt", 0, NULL, 'c'},
|
||||
{"device", 1, NULL, 'd'},
|
||||
{"fwver", 0, NULL, 'f'},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"post_reset", 0, NULL, 'p'},
|
||||
{"spi", 0, NULL, 's'},
|
||||
{"upstart", 0, NULL, 'u'},
|
||||
{},
|
||||
};
|
||||
|
||||
/* Prepare and transfer a block to /dev/tpm0, get a reply. */
|
||||
@@ -1099,10 +1100,13 @@ static int transfer_and_reboot(struct transfer_descriptor *td,
|
||||
printf("-------\nupdate complete\n");
|
||||
|
||||
/*
|
||||
* In upstart mode or in case target is running older protocol version
|
||||
* - post reset is requested.
|
||||
* In upstart mode, or in case target is running older protocol
|
||||
* version, or in case the user explicitly wants it, request post
|
||||
* reset instead of immediate reset. In this case the h1 will reset
|
||||
* next time the target reboots, and will consider running the
|
||||
* uploaded code.
|
||||
*/
|
||||
if (td->upstart_mode || (protocol_version <= 5))
|
||||
if (td->upstart_mode || (protocol_version <= 5) || td->post_reset)
|
||||
subcommand = EXTENSION_POST_RESET;
|
||||
|
||||
if (td->ep_type == usb_xfer) {
|
||||
@@ -1234,6 +1238,9 @@ int main(int argc, char *argv[])
|
||||
case 's':
|
||||
td.ep_type = spi_xfer;
|
||||
break;
|
||||
case 'p':
|
||||
td.post_reset = 1;
|
||||
break;
|
||||
case 'u':
|
||||
td.upstart_mode = 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user