summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-01-07 21:25:48 +0800
committerChromeBot <chrome-bot@google.com>2013-01-08 09:30:00 -0800
commitfd29230988fc90e9535b84c8fe65738e17ba50dd (patch)
tree76ea9b0df37122824d9d81f2e7ee7a2157b4e5c3 /util
parent92bf81948de9333764ed62d620a27f5a46b215d6 (diff)
downloadchrome-ec-fd29230988fc90e9535b84c8fe65738e17ba50dd.tar.gz
spring: Add a host command for USB mux switching
To make test and bring-up easier, adds a host command for USB mux switching. BUG=chrome-os-partner:17111 TEST=manual BRANCH=none Change-Id: I9da43fe934881ce24f326275ef312c4e6a474f11 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40586 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index b8f7d45226..34eeb3df94 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -138,6 +138,8 @@ const char help_str[] =
" Get/set TMP006 calibration\n"
" usbchargemode <port> <mode>\n"
" Set USB charging mode\n"
+ " usbmux <mux>\n"
+ " Set USB mux switch state\n"
" version\n"
" Prints EC version\n"
" wireless <mask>\n"
@@ -1431,6 +1433,34 @@ int cmd_usb_charge_set_mode(int argc, char *argv[])
}
+int cmd_usb_mux(int argc, char *argv[])
+{
+ struct ec_params_usb_mux p;
+ char *e;
+ int rv;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <mux>\n", argv[0]);
+ return -1;
+ }
+
+ p.mux = strtol(argv[1], &e, 0);
+ if (e && *e) {
+ fprintf(stderr, "Bad mux value.\n");
+ return -1;
+ }
+
+ rv = ec_command(EC_CMD_USB_MUX, 0,
+ &p, sizeof(p), NULL, 0);
+ if (rv < 0)
+ return rv;
+
+ printf("Set USB mux to 0x%x.\n", p.mux);
+
+ return 0;
+}
+
+
int cmd_kbpress(int argc, char *argv[])
{
struct ec_params_mkbp_simulate_key p;
@@ -2746,6 +2776,7 @@ const struct command commands[] = {
{"thermalset", cmd_thermal_set_threshold},
{"tmp006cal", cmd_tmp006cal},
{"usbchargemode", cmd_usb_charge_set_mode},
+ {"usbmux", cmd_usb_mux},
{"version", cmd_version},
{"wireless", cmd_wireless},
{NULL, NULL}