From e21858d4dcb9e6a7b436e3a83553ea81b917b524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Fri, 27 Sep 2024 01:44:42 +0300 Subject: [PATCH 1/6] subdevice FOTA - improve error logging State explicitly to which filename we are trying to write. --- edge-client/subdevice_fota.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edge-client/subdevice_fota.cpp b/edge-client/subdevice_fota.cpp index 510dd4a..6eea1a3 100644 --- a/edge-client/subdevice_fota.cpp +++ b/edge-client/subdevice_fota.cpp @@ -1,6 +1,7 @@ /* * ---------------------------------------------------------------------------- * Copyright 2021 Pelion Ltd. + * Copyright 2022-2024 Izuma Networks * * SPDX-License-Identifier: Apache-2.0 * @@ -236,6 +237,7 @@ int start_download(char* downloaded_path) { char filename[FILENAME_MAX] = ""; sprintf(filename,"%s/%s-%" PRIu64 ".bin",SUBDEVICE_FIRMWARE_DOWNLOAD_LOCATION,fota_ctx->fw_info->component_name, fota_ctx->fw_info->version); tr_info("File location: %s", filename); + tr_info("File URL : %s", fota_ctx->fw_info->uri); fota_ctx->state = FOTA_STATE_DOWNLOADING; CURL *curl_handle; FILE *fwfile; @@ -261,7 +263,7 @@ int start_download(char* downloaded_path) { } } else { - tr_error("can not open file, aborting"); + tr_error("can not open file %s, aborting", filename); subdevice_abort_update(FOTA_STATUS_STORAGE_WRITE_FAILED,"Can not open file, aborting the update!"); curl_easy_cleanup(curl_handle); curl_global_cleanup(); From 2c901b89703d252bf71ff435a4f8d17b16b1a7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Fri, 27 Sep 2024 01:45:27 +0300 Subject: [PATCH 2/6] subdevice FOTA - change default download folder to /tmp/ Rather than ., because with LmP releases the filesystem is immutable in most places and thus you can't download anything there. --- edge-client/edge-client/subdevice_fota.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edge-client/edge-client/subdevice_fota.h b/edge-client/edge-client/subdevice_fota.h index 9148ec1..1d27fd0 100644 --- a/edge-client/edge-client/subdevice_fota.h +++ b/edge-client/edge-client/subdevice_fota.h @@ -49,7 +49,7 @@ #define ENDPOINT_SIZE 256 #define MANIFEST_URI_SIZE 256 #if !defined(SUBDEVICE_FIRMWARE_DOWNLOAD_LOCATION) -#define SUBDEVICE_FIRMWARE_DOWNLOAD_LOCATION "." +#define SUBDEVICE_FIRMWARE_DOWNLOAD_LOCATION "/tmp" #endif int fota_is_ready(uint8_t *data, size_t size, fota_state_e *fota_state); int fota_manifest_parse(const uint8_t *input_data, size_t input_size, manifest_firmware_info_t *fw_info); From 99dddc885fe2618df78943011a2f49693e57d661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Fri, 27 Sep 2024 11:05:13 +0300 Subject: [PATCH 3/6] subdevice FOTA - print download URL in failure The existing error log is not detailed enough, we should print out the offending URL so that it can be checked. --- edge-client/subdevice_fota.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/edge-client/subdevice_fota.cpp b/edge-client/subdevice_fota.cpp index 6eea1a3..e880cc3 100644 --- a/edge-client/subdevice_fota.cpp +++ b/edge-client/subdevice_fota.cpp @@ -254,6 +254,7 @@ int start_download(char* downloaded_path) { curl_easy_cleanup(curl_handle); curl_global_cleanup(); fclose(fwfile); + tr_error("can not download firmware %s, aborting", fota_ctx->fw_info->uri); subdevice_abort_update(FOTA_STATUS_DOWNLOAD_AUTH_NOT_GRANTED, "can not download firmware"); return FOTA_STATUS_DOWNLOAD_AUTH_NOT_GRANTED; } From 874f749a284dc92f6bd26b82bb0dd980eaabd29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Fri, 27 Sep 2024 11:06:36 +0300 Subject: [PATCH 4/6] Update CHANGELOG.md w subdevice FOTA info Need to update the CHANGELOG as well. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c161c36..4fd113a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Update `cURL` to version 8.5.0 (from 7.87.0). * Update `Dockerfile` base image to Ubuntu 22.04 (from Ubuntu 20.04). * Fixed numerous small spelling mistakes pointed by `misspell`. +* Improve error logging in subdevice FOTA download case. ## Release 0.21.0 From 3df2526bbcb5776a9073ab14beb67e84e01c6b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Fri, 27 Sep 2024 13:58:45 +0300 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd113a..7636743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Update `Dockerfile` base image to Ubuntu 22.04 (from Ubuntu 20.04). * Fixed numerous small spelling mistakes pointed by `misspell`. * Improve error logging in subdevice FOTA download case. +* Change subdevice FOTA download folder default from `.` to `/tmp`. ## Release 0.21.0 From f48530e9deca118ffb0af54d59971bac17c32c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20Kiiskil=C3=A4?= Date: Fri, 27 Sep 2024 14:00:54 +0300 Subject: [PATCH 6/6] subdevice_fota.h - add Izuma copyright Forgot to add it. --- edge-client/edge-client/subdevice_fota.h | 1 + 1 file changed, 1 insertion(+) diff --git a/edge-client/edge-client/subdevice_fota.h b/edge-client/edge-client/subdevice_fota.h index 1d27fd0..5ee6002 100644 --- a/edge-client/edge-client/subdevice_fota.h +++ b/edge-client/edge-client/subdevice_fota.h @@ -1,6 +1,7 @@ /* * ---------------------------------------------------------------------------- * Copyright 2021 Pelion Ltd. + * Copyright 2022-2024 Izuma Networks * * SPDX-License-Identifier: Apache-2.0 *