Skip to content

Commit

Permalink
Add check for filetype id before doing version check (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyawaha committed Feb 22, 2021
1 parent 78b53c6 commit e60dda9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions source/include/ota_config_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@
#define otaconfigAllowDowngrade 0U
#endif

/**
* @brief The file type id received in the job document.
*
* @note The file type id received in the job document that allows devices
* to identify the type of file received from the cloud. This configuration
* defines the file type id used for firmware updates. If this is changed
* then the updated value must be used while creating firmware update jobs.
*
*/
#ifndef configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID
#define configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID 0U
#endif

/**
* @brief The protocol selected for OTA control operations.
*
Expand Down
2 changes: 1 addition & 1 deletion source/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ static OtaErr_t validateUpdateVersion( const OtaFileContext_t * pFileContext )
( void ) newVersion; /* For suppressing compiler-warning: unused variable. */

/* Only check for versions if the target is self */
if( otaAgent.serverFileID == 0U )
if( ( otaAgent.serverFileID == 0U ) && ( otaAgent.fileContext.fileType == configOTA_FIRMWARE_UPDATE_FILE_TYPE_ID ) )
{
/* Check if version reported is the same as the running version. */
if( pFileContext->updaterVersion == appFirmwareVersion.u.unsignedVersion32 )
Expand Down

0 comments on commit e60dda9

Please sign in to comment.