summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2023-01-10 16:40:32 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-12 04:24:15 +0000
commit19b4b94a0589a15fa40f7694ec79b3136e3219c6 (patch)
tree48883eb1860190b4ec97ac722081c058204809f9 /include
parent7e850444a0bc4cbdd1373ad712f8506f46f39f93 (diff)
downloadchrome-ec-19b4b94a0589a15fa40f7694ec79b3136e3219c6.tar.gz
battery: extend BATTERY_GET_STATIC hostcmd for 32-byte strings
The Smart Battery Specification defines a string as up to 31 characters, and nissa project has encountered some batteries where the existing 11-character strings for v1 of BATTERY_GET_STATIC are insufficient to differentiate some batteries that can be used on a given device. This change adds a new version of this host command that extends the strings fields to each accommodate up to 31 characters of data, which should be enough to support all smart batteries compliant with the latest version of the specification. BUG=b:263920422 TEST=`ectool battery` with updated ectool works on Nereid and uses the new hostcmd version. If EC support for v2 or v1 is disabled, older command versions are used. BRANCH=nissa Change-Id: Ia6a3a917051d5e641e7d38ef6936ec7174cb8aab Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4150669 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'include')
-rw-r--r--include/ec_commands.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 1c2e8a89a2..63a962d791 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -7735,6 +7735,32 @@ struct ec_response_battery_static_info_v1 {
char type_ext[12];
} __ec_align4;
+/**
+ * struct ec_response_battery_static_info_v2 - hostcmd v2 battery static info
+ *
+ * Equivalent to struct ec_response_battery_static_info, but with strings
+ * further lengthened (relative to v1) to accommodate the maximum string length
+ * permitted by the Smart Battery Data Specification revision 1.1 and fields
+ * renamed to better match that specification.
+ *
+ * @design_capacity: battery design capacity (in mAh)
+ * @design_voltage: battery design voltage (in mV)
+ * @cycle_count: battery cycle count
+ * @manufacturer: battery manufacturer string
+ * @device_name: battery model string
+ * @serial: battery serial number string
+ * @chemistry: battery type string
+ */
+struct ec_response_battery_static_info_v2 {
+ uint16_t design_capacity;
+ uint16_t design_voltage;
+ uint32_t cycle_count;
+ char manufacturer[32];
+ char device_name[32];
+ char serial[32];
+ char chemistry[32];
+} __ec_align4;
+
/*
* Get battery dynamic information, i.e. information that is likely to change
* every time it is read.