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 <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/17782
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Matt DeVillier 2016-12-09 18:09:12 -06:00 committed by Nico Huber
parent 31be2c969e
commit e34c16f915
1 changed files with 6 additions and 6 deletions

View File

@ -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)
}