From e34c16f9157c0438e2ff42cd3b139397d3a7be24 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Fri, 9 Dec 2016 18:09:12 -0600 Subject: [PATCH] ec/chromeec: Correct ACPI battery data fed into ToString() ToString() requires the input buffer data to be null-terminated, but the data returned by the EC is not, leading Windows to fail to report any battery data at all. Correct this by concatenating a null terminator (0x00) to the end of the buffer data before inputting to ToString(). Change-Id: I4fdbf97e9b75030374dffc99a954dd9faa6a5209 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/17782 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Paul Menzel --- src/ec/google/chromeec/acpi/battery.asl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ec/google/chromeec/acpi/battery.asl b/src/ec/google/chromeec/acpi/battery.asl index f61e8822cb..2ed4468999 100644 --- a/src/ec/google/chromeec/acpi/battery.asl +++ b/src/ec/google/chromeec/acpi/battery.asl @@ -114,9 +114,9 @@ Device (BAT0) Store (Local2, Index (PBIF, 6)) // Get battery info from mainboard - Store (ToString(BMOD), Index (PBIF, 9)) - Store (ToString(BSER), Index (PBIF, 10)) - Store (ToString(BMFG), Index (PBIF, 12)) + Store (ToString(Concatenate(BMOD, 0x00)), Index (PBIF, 9)) + Store (ToString(Concatenate(BSER, 0x00)), Index (PBIF, 10)) + Store (ToString(Concatenate(BMFG, 0x00)), Index (PBIF, 12)) Return (PBIF) } @@ -145,9 +145,9 @@ Device (BAT0) Store (BTCC, Index (PBIX, 8)) // Get battery info from mainboard - Store (ToString(BMOD), Index (PBIX, 16)) - Store (ToString(BSER), Index (PBIX, 17)) - Store (ToString(BMFG), Index (PBIX, 19)) + Store (ToString(Concatenate(BMOD, 0x00)), Index (PBIX, 16)) + Store (ToString(Concatenate(BSER, 0x00)), Index (PBIX, 17)) + Store (ToString(Concatenate(BMFG, 0x00)), Index (PBIX, 19)) Return (PBIX) }