summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-08-14 13:46:57 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-21 04:10:35 -0700
commit4c553d0480a98fce27ec6f382aaea21f1463423a (patch)
treeaa1a27da24fc6f0ec38e51e1ed9b05d6bed9504e
parent44930bef405740aedcca25ef807129e5fc13776c (diff)
downloadchrome-ec-4c553d0480a98fce27ec6f382aaea21f1463423a.tar.gz
g: usb_updater: add command line option to allow updating the RO section
This just adds the new command line option and a help message for it. This option will be used to signal that the RO section update is required along with the RW section update when invoking usb_updater. The flag indicating presence of the option will be saved in the endpoint structure so it is available at different layers of the code. BRANCH=none BUG=chrome-os-partner:55789 TEST=built usb_updater and invoked it with --help option, observed the new option showing up in the output. Change-Id: Ief35a553651d29ca39c42c5af7294d3aba223b02 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/369160 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r--extra/usb_updater/usb_updater.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index 952f7db3c6..559130cc28 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -68,6 +68,7 @@ struct usb_endpoint {
};
struct transfer_endpoint {
+ int update_ro;
enum transfer_type {
usb_xfer = 0,
spi_xfer = 1
@@ -80,11 +81,12 @@ struct transfer_endpoint {
static uint32_t protocol_version;
static char *progname;
-static char *short_opts = ":d:hs";
+static char *short_opts = ":d:hrs";
static const struct option long_opts[] = {
/* name hasarg *flag val */
{"device", 1, NULL, 'd'},
{"help", 0, NULL, 'h'},
+ {"ro", 0, NULL, 'r'},
{"spi", 0, NULL, 's'},
{NULL, 0, NULL, 0},
};
@@ -179,6 +181,7 @@ static void usage(int errs)
"\n"
" -d,--device VID:PID USB device (default %04x:%04x)\n"
" -h,--help Show this message\n"
+ " -r,--ro Update RO section along with RW\n"
" -s,--spi Use /dev/tmp0 (-d is ignored)\n"
"\n", progname, VID, PID);
@@ -636,6 +639,9 @@ int main(int argc, char *argv[])
case 'h':
usage(errorcnt);
break;
+ case 'r':
+ tep.update_ro = 1;
+ break;
case 's':
tep.ep_type = spi_xfer;
break;