diff options
Diffstat (limited to 'common/base_state.c')
-rw-r--r-- | common/base_state.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/base_state.c b/common/base_state.c index b0f352231d..053b6d4b23 100644 --- a/common/base_state.c +++ b/common/base_state.c @@ -10,6 +10,7 @@ #define CPRINTS(format, args...) cprints(CC_MOTION_LID, format, ## args) +#ifdef CONFIG_BASE_ATTACHED_SWITCH /* 1: base attached, 0: otherwise */ static int base_state; @@ -30,3 +31,24 @@ void base_set_state(int state) /* Notify host of mode change. This likely will wake it up. */ host_set_single_event(EC_HOST_EVENT_MODE_CHANGE); } +#endif + +static int command_setbasestate(int argc, char **argv) +{ + if (argc != 2) + return EC_ERROR_PARAM_COUNT; + if (argv[1][0] == 'a') + base_force_state(1); + else if (argv[1][0] == 'd') + base_force_state(0); + else if (argv[1][0] == 'r') + base_force_state(2); + else + return EC_ERROR_PARAM1; + + return EC_SUCCESS; + +} +DECLARE_CONSOLE_COMMAND(basestate, command_setbasestate, + "[attach | detach | reset]", + "Manually force base state to attached, detached or reset."); |