diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-08-25 14:25:33 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2016-08-31 17:12:58 +0000 |
commit | 70341959e677328dc5d62a94a7df4e79523e5e24 (patch) | |
tree | 9bbc9d631a74ec28dff1e05f7cf759884121d561 /common/thermal.c | |
parent | 6d805476ba032b33e440330469a873e6a444fddb (diff) | |
download | chrome-ec-70341959e677328dc5d62a94a7df4e79523e5e24.tar.gz |
Add console support for restricted commands
This adds support for CONFIG_RESTRICTED_CONSOLE_COMMANDS. If the
appropriate options are configured, restricted commands can be
prevented from running.
Nothing in this CL actually uses that, but it works if you turn
it on.
BUG=chrome-os-partner:55322
BRANCH=none
TEST=make buildall, test on Cr50 hardware
I also tested it manually. If you add this to board.h:
#define CONFIG_CONSOLE_COMMAND_FLAGS
#define CONFIG_RESTRICTED_CONSOLE_COMMANDS
#define CONFIG_CONSOLE_COMMAND_FLAGS_DEFAULT CMD_FLAG_RESTRICTED
and this to board.c:
static int restricted_state;
int console_is_restricted(void)
{
return restricted_state;
}
static int command_lock(int argc, char **argv)
{
int enabled;
if (argc > 1) {
if (!parse_bool(argv[1], &enabled))
return EC_ERROR_PARAM1;
restricted_state = enabled;
}
ccprintf("The restricted console lock is %s\n",
restricted_state ? "enabled" : "disabled");
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND_FLAGS(lock, command_lock,
"[<BOOLEAN>]",
"Get/Set the restricted console lock",
0); /* no restrictions */
then you can use the "lock" command to enable and disable every
other console command except for it and "help".
Change-Id: Ic9517f9ea7a9867f15e5d14b302246070163d558
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/376186
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/thermal.c')
0 files changed, 0 insertions, 0 deletions