Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Wi-Fi Combo Forum Discussions

Anonymous
Not applicable

In the OTA2 service, the wiced_ota2_service_get_the_update_file() erroneously returns success anytime the second call to wiced_ota2_service_wget_update() returns a non-zero error code. In the code below, if this second call fails, the return code is not saved in the result variable and when *update_result is assigned to result it gets the previous result which can only be success. See libraries/daemons/ota2_service/wiced_ota2_service.c.

wiced_result_t wiced_ota2_service_get_the_update_file(wiced_ota2_service_session_t* session, wiced_result_t* update_result)

{

    wiced_result_t  result;

    /* assume error */

    *update_result = WICED_ERROR;

    result = ota2_service_connect(session);

    if (result != WICED_SUCCESS)

    {...}

    /* get the header */

...

   /* swap the data to be correct for the platform */

...

   /* disconnect and re-connect to reset the file pointer */

    ota2_service_disconnect(session);

    result = ota2_service_connect(session);

    if ( result != WICED_SUCCESS)

    {...goto _get_file_fail;}

    /* get the OTA2 file */

/*if ( wiced_ota2_service_wget_update(session, NULL, 0) != WICED_SUCCESS) Replaced with the following 2 lines*/

    result = wiced_ota2_service_wget_update(session, NULL, 0);

    if ( result != WICED_SUCCESS)

    {

        OTA2_LIB_PRINT(session, OTA2_LOG_ERROR, ("wiced_ota2_service_get_the_update() wiced_ota2_service_wget_update(file) failed!\r\n"));

        wiced_ota2_service_make_error_callback(session, OTA2_SERVICE_UPDATE_ERROR );

        session->download_failures++;

        *update_result = result;

        goto _get_file_connected_fail;

    }

...

   /* we succeeded in getting the file here */

    *update_result = WICED_SUCCESS;

_get_file_connected_fail:

    ota2_service_disconnect(session);

_get_file_fail:

    return result;

}

1 Solution
PriyaM_16
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Hello,

Thanks for pointing out the error. The change is incorporated in WICED SDK.

View solution in original post

0 Likes
1 Reply
PriyaM_16
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Hello,

Thanks for pointing out the error. The change is incorporated in WICED SDK.

0 Likes