summaryrefslogtreecommitdiff
path: root/util/ectool.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-09-25 14:45:14 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-05 18:11:43 +0000
commit1efa0109d3a12ac00ef958744ba17bfebdceee9a (patch)
treeaf47fd909fa9c62431348cb4ccca38608d57dc1c /util/ectool.c
parenta44234c5f3741e4849809e1b57b0b2f007549769 (diff)
downloadchrome-ec-1efa0109d3a12ac00ef958744ba17bfebdceee9a.tar.gz
TCPMv2: Add event clear to TYPEC_CONTROL
When the AP has finished processing events, it can use TYPEC_CONTROL to clear the specific events it has completed. This also fixes an issue with the control command structure byte alignment. BRANCH=None BUG=b:148816435 TEST=on waddledoo, plug in Apple dongle and clear SOP discovery event with "ectool typecontrol" Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I38d522f346bfd500b72109db46f78a9c135ce96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432457 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'util/ectool.c')
-rw-r--r--util/ectool.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 770c94e2e0..04e630051c 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -9475,10 +9475,11 @@ int cmd_typec_control(int argc, char *argv[])
if (argc < 3) {
fprintf(stderr,
- "Usage: %s <port> <command>\n"
+ "Usage: %s <port> <command> [args]\n"
" <port> is the type-c port to query\n"
" <type> is one of:\n"
- " 0: Exit modes\n", argv[0]);
+ " 0: Exit modes\n"
+ " 1: Clear events\n", argv[0]);
return -1;
}
@@ -9494,6 +9495,19 @@ int cmd_typec_control(int argc, char *argv[])
return -1;
}
+ if (p.command == TYPEC_CONTROL_COMMAND_CLEAR_EVENTS) {
+ if (argc < 4) {
+ fprintf(stderr, "Missing event mask\n");
+ return -1;
+ }
+
+ p.clear_events_mask = strtol(argv[3], &endptr, 0);
+ if (endptr && *endptr) {
+ fprintf(stderr, "Bad event mask\n");
+ return -1;
+ }
+ }
+
rv = ec_command(EC_CMD_TYPEC_CONTROL, 0, &p, sizeof(p),
ec_inbuf, ec_max_insize);
if (rv < 0)