From 695289cfe6724ad349a96d1f36ddf036b3df5daa Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 12 Feb 2013 16:48:00 -0800 Subject: Add console command to fake battery state of charge The new 'battfake' command is really handy for testing low-battery shutdown logic. BUG=chrome-os-partner:17124 BRANCH=link TEST=from EC console: reboot battfake -> using real battery level power on system -> lightbar should be blue battfake 5 lightbar turns red after a few seconds UI shows battery is very low (shows <5% due to different kernel math) 'ectool battery' from root shell shows present capacity ~5% of design capacity remove AC power battfake 4 UI shows low-battery screen and shuts down (may take a minute) battfake 50 power on system UI shows battery at 45-55% battfake 2 -> system shuts down immediately battfake -1 power on system UI shows actual battery level Change-Id: I3180e321241c0f586f3baad2150fb6a2b2d2e242 Signed-off-by: Randall Spangler Reviewed-on: https://gerrit.chromium.org/gerrit/43151 Reviewed-by: Bill Richardson --- include/charge_state.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/charge_state.h') diff --git a/include/charge_state.h b/include/charge_state.h index 0a4cd869da..182a99f703 100644 --- a/include/charge_state.h +++ b/include/charge_state.h @@ -128,5 +128,10 @@ enum power_state charge_get_state(void); */ int charge_get_percent(void); +/** + * Return non-zero if discharging and battery so low we should shut down. + */ +int charge_want_shutdown(void); + #endif /* __CROS_EC_CHARGE_STATE_H */ -- cgit v1.2.1