From 30acb338db94ea2039442bfca9fa31fd0eb2add6 Mon Sep 17 00:00:00 2001 From: Jenny TC Date: Wed, 17 May 2017 14:27:57 +0530 Subject: [PATCH] poppy: add detachbase and attachbase uart console commands This patch adds two commands to simulate detachbase and attachbase uart console commands to test & debug automation. BRANCH=none BUG=b:37223093 TEST=attach or detach base and check if event is generated Change-Id: Ie4a487ebd8929f0584da0b59c094f9d9aff13fb7 Signed-off-by: Subramony Sesha Signed-off-by: Archana Patni Signed-off-by: Jenny TC Reviewed-on: https://chromium-review.googlesource.com/486521 Commit-Ready: Jenny Tc Tested-by: Jenny Tc Reviewed-by: Furquan Shaikh Reviewed-by: Nicolas Boichat --- board/poppy/board.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/board/poppy/board.c b/board/poppy/board.c index bb548dafd5..85c24610a3 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -181,6 +181,25 @@ static void base_detect_change(enum base_status status) static uint64_t pulse_start; static uint32_t pulse_width; +static int command_attach_base(int argc, char **argv) +{ + host_set_single_event(EC_HOST_EVENT_MODE_CHANGE); + tablet_set_mode(0); + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(attachbase, command_attach_base, + NULL, "Simulate attach base"); + +static int command_detach_base(int argc, char **argv) +{ + host_set_single_event(EC_HOST_EVENT_MODE_CHANGE); + tablet_set_mode(1); + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(detachbase, command_detach_base, + NULL, "Simulate detach base"); + + static void base_detect_deferred(void) { uint64_t time_now = get_time().val;