diff options
Diffstat (limited to 'common/tablet_mode.c')
-rw-r--r-- | common/tablet_mode.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c index edda95085f..5f137d3d94 100644 --- a/common/tablet_mode.c +++ b/common/tablet_mode.c @@ -9,6 +9,7 @@ #include "lid_angle.h" #include "tablet_mode.h" #include "timer.h" +#include "tablet_mode.h" #define CPRINTS(format, args...) cprints(CC_MOTION_LID, format, ## args) #define CPRINTF(format, args...) cprintf(CC_MOTION_LID, format, ## args) @@ -16,6 +17,12 @@ /* 1: in tablet mode. 0: otherwise */ static int tablet_mode = 1; +/* + * 1: all calls to tablet_set_mode are ignored and tablet_mode if forced to 0 + * 0: all calls to tablet_set_mode are honored + */ +static int disabled; + int tablet_get_mode(void) { return tablet_mode; @@ -26,6 +33,11 @@ void tablet_set_mode(int mode) if (tablet_mode == mode) return; + if (disabled) { + CPRINTS("Tablet mode set while disabled (ignoring)!"); + return; + } + tablet_mode = mode; CPRINTS("tablet mode %sabled", mode ? "en" : "dis"); hook_notify(HOOK_TABLET_MODE_CHANGE); @@ -69,3 +81,9 @@ static void tablet_mode_init(void) } DECLARE_HOOK(HOOK_INIT, tablet_mode_init, HOOK_PRIO_DEFAULT); #endif + +void tablet_disable(void) +{ + tablet_mode = 0; + disabled = 1; +} |