From 19b4b94a0589a15fa40f7694ec79b3136e3219c6 Mon Sep 17 00:00:00 2001 From: Peter Marheine Date: Tue, 10 Jan 2023 16:40:32 +1100 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4150669 Reviewed-by: Daisuke Nojiri Code-Coverage: Zoss --- include/ec_commands.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include') 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. -- cgit v1.2.1