diff options
author | Wai-Hong Tam <waihong@google.com> | 2021-02-10 14:39:20 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-11 00:36:08 +0000 |
commit | ce27af42105d9ceb1bd8a921e2baeacced4867bc (patch) | |
tree | abecd9a69ec07568e6439614d7d48cfdef876b29 | |
parent | d50145f66040311bf3d58627e90dc5ed3281c561 (diff) | |
download | chrome-ec-ce27af42105d9ceb1bd8a921e2baeacced4867bc.tar.gz |
tablet_mode: Console command to print the current tablet mode
The console command is useful to show the current tablet mode if no
argument given.
BRANCH=None
BUG=b:158130073
TEST=Type the "tabletmode" command and check the output.
Change-Id: I9dfe08a6a42ae9104d82587ee0688c8998d48cba
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685408
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/tablet_mode.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c index 5486ffc668..68d90ae772 100644 --- a/common/tablet_mode.c +++ b/common/tablet_mode.c @@ -42,9 +42,14 @@ int tablet_get_mode(void) return tablet_mode; } -static void notify_tablet_mode_change(void) +static inline void print_tablet_mode(void) { CPRINTS("tablet mode %sabled", tablet_mode ? "en" : "dis"); +} + +static void notify_tablet_mode_change(void) +{ + print_tablet_mode(); hook_notify(HOOK_TABLET_MODE_CHANGE); /* @@ -168,6 +173,11 @@ void gmr_tablet_switch_disable(void) static int command_settabletmode(int argc, char **argv) { + if (argc == 1) { + print_tablet_mode(); + return EC_SUCCESS; + } + if (argc != 2) return EC_ERROR_PARAM_COUNT; |