diff options
author | Andrew Scull <ascull@google.com> | 2018-06-06 15:22:31 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-06-06 15:22:31 +0000 |
commit | 8c302482a137a4501b65d403131087246530fb17 (patch) | |
tree | bb84e41c87d278f8423e645471190627e885dbe0 | |
parent | e5c0d59d5020024b60f0f929f5a8290b878214bd (diff) | |
parent | 9e3ce2ec21ff72794e1738dffded338969a9b30a (diff) | |
download | generic-8c302482a137a4501b65d403131087246530fb17.tar.gz |
Merge "NUGGET_PARAM_ENABLE_UPDATE tells us whether it worked or not"
-rw-r--r-- | citadel/updater/updater.cpp | 7 | ||||
-rw-r--r-- | nugget/include/app_nugget.h | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/citadel/updater/updater.cpp b/citadel/updater/updater.cpp index ecc8c35..3d7fd8c 100644 --- a/citadel/updater/updater.cpp +++ b/citadel/updater/updater.cpp @@ -675,6 +675,7 @@ static uint32_t do_enable(AppClient &app, const char *pw) std::vector<uint8_t> data(sizeof(struct nugget_app_enable_update)); struct nugget_app_enable_update *s = (struct nugget_app_enable_update*)data.data(); + std::vector<uint8_t> reply; memset(&s->password, 0xff, sizeof(s->password)); if (pw && *pw) { @@ -687,10 +688,12 @@ static uint32_t do_enable(AppClient &app, const char *pw) s->which_headers = options.enable_ro ? NUGGET_ENABLE_HEADER_RO : 0; s->which_headers |= options.enable_rw ? NUGGET_ENABLE_HEADER_RW : 0; - uint32_t rv = app.Call(NUGGET_PARAM_ENABLE_UPDATE, data, nullptr); + reply.reserve(1); + uint32_t rv = app.Call(NUGGET_PARAM_ENABLE_UPDATE, data, &reply); if (is_app_success(rv)) - printf("Update enabled\n"); + /* Reply byte is true only if header was CHANGED to valid */ + printf("Update %s enabled\n", reply[0] ? "changed to" : "is already"); return rv; } diff --git a/nugget/include/app_nugget.h b/nugget/include/app_nugget.h index f8e8fda..72572b9 100644 --- a/nugget/include/app_nugget.h +++ b/nugget/include/app_nugget.h @@ -110,12 +110,13 @@ struct nugget_app_enable_update { #define NUGGET_PARAM_ENABLE_UPDATE 0x0003 /* * Mark the specified image header(s) as valid, if the provided password - * matches. + * matches. Returns true if either header was CHANGED to valid, which is an + * indication that the AP should request a reboot so that it can take effect. * * @param args struct nugget_app_enable_update * @param arg_len sizeof(struct nugget_app_enable_update) - * @param reply <none> - * @param reply_len 0 + * @param reply 0 or 1 + * @param reply_len 1 byte * * @errors APP_ERROR_BOGUS_ARGS */ |