summaryrefslogtreecommitdiff
path: root/common/console.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-05-18 16:59:26 -0700
committerRandall Spangler <rspangler@chromium.org>2012-05-21 09:17:51 -0700
commit01e94792e7436e89e55f043982e9446e0759bf25 (patch)
tree8e8dc705a825391449041b81ec061d767231fb91 /common/console.c
parentb1bb8314bd852dea40bc7514486ce4e781e14f88 (diff)
downloadchrome-ec-01e94792e7436e89e55f043982e9446e0759bf25.tar.gz
Clean up debug commands to use less space
BUG=none TEST=(run the commands) Change-Id: I6ed4aee169311825190bcc386b86cdc32ba0866a Signed-off-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/common/console.c b/common/console.c
index cebfd573c9..8f21418f43 100644
--- a/common/console.c
+++ b/common/console.c
@@ -163,7 +163,7 @@ static int handle_command(char *input)
if (cmd)
return cmd->handler(argc, argv);
- ccprintf("Command '%s' either not found or ambiguous.\n", argv[0]);
+ ccprintf("Command '%s' not found or ambiguous.\n", argv[0]);
return EC_ERROR_UNKNOWN;
}
@@ -253,30 +253,15 @@ DECLARE_CONSOLE_COMMAND(help, command_help);
/* Set active channels */
static int command_ch(int argc, char **argv)
{
- int m;
+ int i;
char *e;
- /* If no args, print the list of channels */
- if (argc == 1) {
- int i;
- ccputs(" # Mask Enabled Channel\n");
- for (i = 0; i < CC_CHANNEL_COUNT; i++) {
- ccprintf("%2d %08x %c %s\n",
- i, CC_MASK(i),
- (channel_mask & CC_MASK(i)) ? '*' : ' ',
- channel_names[i]);
- cflush();
- }
- return EC_SUCCESS;
- }
-
/* If one arg, set the mask */
if (argc == 2) {
- m = strtoi(argv[1], &e, 0);
- if (e && *e) {
- ccputs("Invalid mask\n");
+ int m = strtoi(argv[1], &e, 0);
+ if (*e)
return EC_ERROR_INVAL;
- }
+
/* No disabling the command output channel */
channel_mask = m | CC_MASK(CC_COMMAND);
@@ -285,8 +270,15 @@ static int command_ch(int argc, char **argv)
return EC_SUCCESS;
}
- /* Otherwise, print help */
- ccputs("Usage: chan [newmask]\n");
- return EC_ERROR_INVAL;
+ /* Print the list of channels */
+ ccputs(" # Mask E Channel\n");
+ for (i = 0; i < CC_CHANNEL_COUNT; i++) {
+ ccprintf("%2d %08x %c %s\n",
+ i, CC_MASK(i),
+ (channel_mask & CC_MASK(i)) ? '*' : ' ',
+ channel_names[i]);
+ cflush();
+ }
+ return EC_SUCCESS;
};
DECLARE_CONSOLE_COMMAND(chan, command_ch);