int start_delta_modemupdate(const char *path)
{
    int ret = 0;

    if (radio_diff == NULL)
    {
        LOGE("No modem package available.\n");
        LOGE("No modem update needed. returning O.K\n");
        return DELTA_UPDATE_SUCCESS_200;
    }

    // If the package contains an delta update binary for modem update, extract it
    ret = extract_deltaupdate_binary(path);
    if(ret != 0)
    {
       LOGE("idev_extractDua returned error(%d)\n", ret);
       return ret;
    }

    // Check and mount AMSS partition
    if (target_is_emmc()) {
        ret = get_amss_location(RADIO_IMAGE_LOCATION);
        if (ret != 0) {
            LOGE("get_amss_location returned error(%d)\n", ret);
            return ret;
        }
        /* Backup radio image before proceeding with the update */
        ret = get_amss_backup(RADIO_IMAGE_LOCATION, RADIO_IMAGE_LOCAL);
        if (ret != 0) {
            LOGI("Failed to get amss backup\n");
            return ret;
         }
    }

    // Execute modem update using delta update binary
    ret = run_modem_deltaupdate();
    LOGE("modem update result(%d)\n", ret);

    if(ret == 0) {
        if (target_is_emmc()) {
            if (remove(RADIO_IMAGE_LOCATION)) {
                LOGE("Failed to remove amss binary: %s\n",strerror(errno));
                return ret;
            }
            if (rename(RADIO_IMAGE_LOCAL, RADIO_IMAGE_LOCATION)) {
                LOGI("Failed to restore amss binary: %s\n",strerror(errno));
                return ret;
            }
        }
	return DELTA_UPDATE_SUCCESS_200;
    }
    else
       return ret;
}
示例#2
0
int start_delta_modemupdate(const char *path)
{
    int ret = 0;

    if (radio_diff == NULL)
    {
        LOGE("No modem package available.\n");
        LOGE("No modem update needed. returning O.K\n");
        return DELTA_UPDATE_SUCCESS_200;
    }

    // If the package contains an delta update binary for modem update, extract it
    ret = extract_deltaupdate_binary(path);
    if(ret != 0)
    {
       LOGE("idev_extractDua returned error(%d)\n", ret);
       return ret;
    }

    // Check and mount AMSS partition
    ret = get_amss_location(RADIO_IMAGE_LOCATION);
    if(ret != 0)
    {
       LOGE("get_amss_location returned error(%d)\n", ret);
       return ret;
    }
	
    // Execute modem update using delta update binary
    ret = run_modem_deltaupdate();
    LOGE("modem update result(%d)\n", ret);

    if(ret == 0)
	return DELTA_UPDATE_SUCCESS_200;
    else
	return ret;
}