Skip to content

Commit

Permalink
Merge pull request #110 from PelionIoT/subdev-logging-fix
Browse files Browse the repository at this point in the history
Subdev logging fix
  • Loading branch information
JanneKiiskila authored Sep 27, 2024
2 parents 4dcefb9 + f48530e commit f493a7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* 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.
* Change subdevice FOTA download folder default from `.` to `/tmp`.

## Release 0.21.0

Expand Down
3 changes: 2 additions & 1 deletion edge-client/edge-client/subdevice_fota.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* ----------------------------------------------------------------------------
* Copyright 2021 Pelion Ltd.
* Copyright 2022-2024 Izuma Networks
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -49,7 +50,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);
Expand Down
5 changes: 4 additions & 1 deletion edge-client/subdevice_fota.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* ----------------------------------------------------------------------------
* Copyright 2021 Pelion Ltd.
* Copyright 2022-2024 Izuma Networks
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -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;
Expand All @@ -252,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;
}
Expand All @@ -261,7 +264,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();
Expand Down

0 comments on commit f493a7a

Please sign in to comment.