diff options
author | Sheng-Liang Song <ssl@chromium.org> | 2015-05-12 09:37:53 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-14 15:42:35 +0000 |
commit | 6cd67659dbca2cad37a1afcc3234856fffd4d47f (patch) | |
tree | 5d720f6d995c36fe9c45d43c31a30217209be535 | |
parent | 764c3fa79032fca1ae5f615d78f30210c36c5d38 (diff) | |
download | chrome-ec-6cd67659dbca2cad37a1afcc3234856fffd4d47f.tar.gz |
sb_firmware: Fixed firmware version check
Added firmware version check to handle the following cases:
- when the data table version is the same and fw version is newer
or
- when the fw version is the same and data table version is newer.
BUG=chrome-os-partner:36310
BRANCH=none
TEST=Verified on Glimmer.
crosh> battery_firmware check
crosh> battery_firmware update
Change-Id: If3d28f6ae7a89fc7c41fd60214ab3616f1abfe5a
Signed-off-by: Sheng-Liang Song <ssl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270387
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | util/ec_sb_firmware_update.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/util/ec_sb_firmware_update.c b/util/ec_sb_firmware_update.c index 423da7d0eb..e97ac15e7d 100644 --- a/util/ec_sb_firmware_update.c +++ b/util/ec_sb_firmware_update.c @@ -193,10 +193,12 @@ static int check_battery_firmware_image_version( struct sb_fw_header *hdr, struct sb_fw_update_info *p) { - return (((hdr->fw_version == 0xFFFF) - || (hdr->fw_version > p->fw_version)) && - ((hdr->data_table_version == 0xFFFF) - || (hdr->data_table_version > p->data_version))); + /* + * If the battery firmware has a newer fw version + * or a newer data table version, then it is ok to update. + */ + return (hdr->fw_version > p->fw_version) + || (hdr->data_table_version > p->data_version); } |