diff --git a/src/fw_images.c b/src/fw_images.c index 9444680321da7ba4086cc6233c2b027a2968482f..73bcc6a98ab64112bd1ef9f23db1b844b217b827 100644 --- a/src/fw_images.c +++ b/src/fw_images.c @@ -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) { json_object *json_obj = NULL; - bool res = false; + bool res = true; 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); @@ -123,8 +123,6 @@ static bool fwbank_upgrade(const char *path, bool activate, const char *bank_id, if (json_obj) { char *result = dmjson_get_value(json_obj, 1, "result"); res = (DM_LSTRCMP(result, "ok") == 0) ? true : false; - } else { - res = false; } if (json_obj != NULL) diff --git a/src/fwbank.c b/src/fwbank.c index 251f6315af1db6f1d44ec9b914558628a3fed399..74c6856e58a0ed67ed2ada1f68452c2216f012d0 100644 --- a/src/fwbank.c +++ b/src/fwbank.c @@ -469,15 +469,15 @@ static bool is_upgrade_success(struct blob_buf *output_bb) // 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) { - BBFDM_ERR("Failed to parse blobmsg data"); - return false; + BBFDM_INFO("Failed to parse upgrade result, assuming success"); + return true; } // Check if the "result" field exists and is of the correct type 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)