mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
sb_firmware: Enable Updates for Simplo Battery Only.
If can get battery info, enable updates if it is Simplo Battery. If can not get battery info, assume a Simplo Battery is a bad state. BUG=chrome-os-partner:36310 BRANCH=none TEST=Verified on Glimmer. crosh> battery_firmware check crosh> battery_firmware update Change-Id: I0db6b50b5a382b72fd9682621990d0a6dd9e6a2b Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/266044 Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
58382b98f2
commit
be99fa290e
@@ -18,6 +18,9 @@
|
||||
#include "misc_util.h"
|
||||
#include "powerd_lock.h"
|
||||
|
||||
#define SIMPLO_MAKER_ID 0x5
|
||||
#define SIMPLO_HWID 0x74
|
||||
|
||||
/* Subcommands: [check|update] */
|
||||
enum {
|
||||
OP_UNKNOWN = 0,
|
||||
@@ -313,9 +316,10 @@ static int get_info(struct sb_fw_update_info *info)
|
||||
} while ((rv < 0) && (cnt++ < SB_FW_UPDATE_DEFAULT_RETRY_CNT));
|
||||
|
||||
if (rv < 0) {
|
||||
printf("Firmware Update Get Info Error\n");
|
||||
memset(info, 0, SB_FW_UPDATE_CMD_INFO_SIZE);
|
||||
return -EC_RES_ERROR;
|
||||
}
|
||||
|
||||
memcpy(info, resp->info.data, SB_FW_UPDATE_CMD_INFO_SIZE);
|
||||
return EC_RES_SUCCESS;
|
||||
}
|
||||
@@ -421,6 +425,12 @@ static enum fw_update_state s1_read_battery_info(
|
||||
}
|
||||
print_info(&fw_update->info);
|
||||
|
||||
if ((fw_update->info.maker_id != SIMPLO_MAKER_ID) ||
|
||||
(fw_update->info.hardware_id != SIMPLO_HWID)) {
|
||||
log_msg(fw_update, S1_READ_INFO, "No Updates.");
|
||||
return S10_TERMINAL;
|
||||
}
|
||||
|
||||
sprintf(fw_update->image_name,
|
||||
"/lib/firmware/battery/maker.%04x.hwid.%04x.bin",
|
||||
fw_update->info.maker_id,
|
||||
|
||||
Reference in New Issue
Block a user