summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiyu Qin <qinsiyu@huaqin.corp-partner.google.com>2021-11-09 16:50:30 +0800
committerCommit Bot <commit-bot@chromium.org>2022-01-12 07:43:03 +0000
commit3f45fc7b4fca3a17ea7cabd07d299204564dea63 (patch)
treebdcf3de1579fab57012f649616c98e93ea4b8b75
parent7f78bbf28e9114423ed0b909df7f128014d905ec (diff)
downloadchrome-ec-3f45fc7b4fca3a17ea7cabd07d299204564dea63.tar.gz
common/tablet_modet: Fix EC command tabletmode reset status
EC console command "tabletmode on" will lock the table mode status, when the project use TABLET_TRIGGER_BASE to set table mode. Add a variable to store tablet mode to sovle this problem. BUG=b:205611452 BRANCH=trogdor TEST=1.Use detachable keyboard attach to DUT 2.Enter "tabletmode on" in EC console 3.Enter "tabletmode reset" in EC console Then the system can switch to "tablet disable" mode. Change-Id: Ifb9fbbe2c0c0fb6201af0a7fc6f2541a4ff74ff2 Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3269867 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Bob Moragues <moragues@chromium.org>
-rw-r--r--common/tablet_mode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c
index aa86a13762..529078a448 100644
--- a/common/tablet_mode.c
+++ b/common/tablet_mode.c
@@ -179,6 +179,8 @@ void gmr_tablet_switch_disable(void)
static int command_settabletmode(int argc, char **argv)
{
+ static uint32_t tablet_mode_store;
+
if (argc == 1) {
print_tablet_mode();
return EC_SUCCESS;
@@ -187,6 +189,9 @@ static int command_settabletmode(int argc, char **argv)
if (argc != 2)
return EC_ERROR_PARAM_COUNT;
+ if (tablet_mode_forced == false)
+ tablet_mode_store = tablet_mode;
+
if (argv[1][0] == 'o' && argv[1][1] == 'n') {
tablet_mode = TABLET_TRIGGER_LID;
tablet_mode_forced = true;
@@ -194,6 +199,7 @@ static int command_settabletmode(int argc, char **argv)
tablet_mode = 0;
tablet_mode_forced = true;
} else if (argv[1][0] == 'r') {
+ tablet_mode = tablet_mode_store;
tablet_mode_forced = false;
} else {
return EC_ERROR_PARAM1;