Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subdev logging fix #110

Merged
merged 6 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
JanneKiiskila marked this conversation as resolved.
Show resolved Hide resolved
* 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
Loading