diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2023-04-24 10:51:35 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-24 22:45:31 +0000 |
commit | 375ed4452465e6858e62b77b3927be4c7b678477 (patch) | |
tree | ec71bc7af5cb113903b68dbe9416e503d073200c | |
parent | 5d1615375dd7ab2f81a1198140596fd9628b302b (diff) | |
download | chrome-ec-375ed4452465e6858e62b77b3927be4c7b678477.tar.gz |
common/tablet: Fix printing the tablet mode
table_mode is not just a boolean, it stores the cause(s) for getting in
tablet mode.
Fixes: c1f6b2a249250 ("common/tablet: Allow getting out of tablet mode when sensors are broken")
BUG=b:279135356
TEST=Compile
Change-Id: I4a50118004285da2f7ba4229e537d6cd8d7b07d1
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4468727
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | common/tablet_mode.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c index 696d7aa523..5b95127c72 100644 --- a/common/tablet_mode.c +++ b/common/tablet_mode.c @@ -21,7 +21,11 @@ /* * Other code modules assume that notebook mode (i.e. tablet_mode = 0) at - * startup + * startup. + * tablet_mode is mask, one bit for each source that can trigger a change to + * tablet mode: + * - TABLET_TRIGGER_LID: the lid angle is over the threshold. + * - TABLET_TRIGGER_BASE: the detachable keyboard is disconnected. */ static uint32_t tablet_mode; @@ -53,6 +57,7 @@ static const char *const tablet_mode_names[] = { "clamshell", "tablet", }; +BUILD_ASSERT(ARRAY_SIZE(tablet_mode_names) == 2); int tablet_get_mode(void) { @@ -61,7 +66,7 @@ int tablet_get_mode(void) static inline void print_tablet_mode(void) { - CPRINTS("%s mode", tablet_mode_names[tablet_mode]); + CPRINTS("%s mode", tablet_mode_names[tablet_get_mode()]); } static void notify_tablet_mode_change(void) |