diff options
author | Bill Richardson <wfrichar@chromium.org> | 2015-07-10 14:50:53 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-13 18:43:44 +0000 |
commit | 4c708232ac82e2c0bfe075027fbe88afd9456535 (patch) | |
tree | 1daa24a88db9d23f8e4aed519b59964fde5033a7 /chip | |
parent | 10dc22867f8a81c2bf72d2a009b560064d5e1170 (diff) | |
download | chrome-ec-4c708232ac82e2c0bfe075027fbe88afd9456535.tar.gz |
Cr50: cleanup: Rename the "sps" console command "spshc"
The "sps" console command declared in sps_hc.c is misleading. It
shouldn't be "sps", when it's actually part of the host command
protocol stuff.
This CL changes the command name to "spshc" instead. The command
just enables or disables SPS host commands. Note that because
there's no notification if something else calls
sps_unregister_rx_handler(), there's no way for the sps_hc.c
module to know whether it's still registered.
BUG=none
BRANCH=none
TEST=make buildall
Using a test program, such as extra/ftdi_hostcmd/, I can send
host commands to an EC attached via an FTDI USB-to-SPI adapter.
On the EC console, this:
spshc off
causes the test program to fail, and this:
spshc
causes it to work again.
Change-Id: Ie0edbde179b570f170ff9464313e5e33ab985f21
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/284942
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/sps_hc.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/chip/g/sps_hc.c b/chip/g/sps_hc.c index d0c16ba2fe..e3eb043018 100644 --- a/chip/g/sps_hc.c +++ b/chip/g/sps_hc.c @@ -290,22 +290,20 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_PROTOCOL_INFO, static int command_sps(int argc, char **argv) { if (argc > 1) { - if (!strcasecmp(argv[1], "reset") || - !strcasecmp(argv[1], "on")) - sps_hc_enable(); - else if (!strcasecmp(argv[1], "off")) - sps_hc_disable(); - else + if (0 != strcasecmp(argv[1], "off")) return EC_ERROR_PARAM1; - } - ccprintf("state=%d rxbuf_count=%d rxbuf_needed=%d, discard=%d\n", - state, rxbuf_count, rxbuf_needed, discard_response); + sps_hc_disable(); + ccprintf("SPS host commands disabled\n"); + return EC_SUCCESS; + } + sps_hc_enable(); + ccprintf("SPS host commands enabled\n"); return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(sps, command_sps, - "[reset|off|on]", - "With no args, print some info", +DECLARE_CONSOLE_COMMAND(spshc, command_sps, + "[off]", + "Enable (default) or disable SPS host commands", NULL); |