Skip to content
Snippets Groups Projects
Verified Commit 4adbdbb8 authored by Vivek Dutta's avatar Vivek Dutta Committed by IOPSYS Dev
Browse files

fwbank: invert upgrade result check

parent ed249626
Branches
No related tags found
1 merge request!35fwbank: invert upgrade result check
Pipeline #210141 passed
...@@ -112,7 +112,7 @@ static bool fwbank_set_bootbank(const char *bank_id) ...@@ -112,7 +112,7 @@ static bool fwbank_set_bootbank(const char *bank_id)
static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id, const char *keep_settings) static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id, const char *keep_settings)
{ {
json_object *json_obj = NULL; json_object *json_obj = NULL;
bool res = false; bool res = true;
if (activate == false) { if (activate == false) {
dmubus_call_blocking("fwbank", "upgrade", UBUS_ARGS{{"path", path, String}, {"auto_activate", "0", Boolean}, {"bank", bank_id, Integer}, {"keep_settings", "0", Boolean}}, 4, &json_obj); dmubus_call_blocking("fwbank", "upgrade", UBUS_ARGS{{"path", path, String}, {"auto_activate", "0", Boolean}, {"bank", bank_id, Integer}, {"keep_settings", "0", Boolean}}, 4, &json_obj);
...@@ -123,8 +123,6 @@ static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id, ...@@ -123,8 +123,6 @@ static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id,
if (json_obj) { if (json_obj) {
char *result = dmjson_get_value(json_obj, 1, "result"); char *result = dmjson_get_value(json_obj, 1, "result");
res = (DM_LSTRCMP(result, "ok") == 0) ? true : false; res = (DM_LSTRCMP(result, "ok") == 0) ? true : false;
} else {
res = false;
} }
if (json_obj != NULL) if (json_obj != NULL)
......
...@@ -469,15 +469,15 @@ static bool is_upgrade_success(struct blob_buf *output_bb) ...@@ -469,15 +469,15 @@ static bool is_upgrade_success(struct blob_buf *output_bb)
// Parse the blob buffer for the "result" field // Parse the blob buffer for the "result" field
if (blobmsg_parse(&policy, 1, &tb, blobmsg_data(output_bb->head), blobmsg_len(output_bb->head)) != 0) { if (blobmsg_parse(&policy, 1, &tb, blobmsg_data(output_bb->head), blobmsg_len(output_bb->head)) != 0) {
BBFDM_ERR("Failed to parse blobmsg data"); BBFDM_INFO("Failed to parse upgrade result, assuming success");
return false; return true;
} }
// Check if the "result" field exists and is of the correct type // Check if the "result" field exists and is of the correct type
if (tb && blobmsg_type(tb) == BLOBMSG_TYPE_STRING) if (tb && blobmsg_type(tb) == BLOBMSG_TYPE_STRING)
return (strcmp(blobmsg_get_string(tb), "ok") == 0) ? true : false; return (strcmp(blobmsg_get_string(tb), "failure") == 0) ? false : true;
return false; return true;
} }
struct blob_buf *sysmngr_fwbank_dump(void) struct blob_buf *sysmngr_fwbank_dump(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment