From 1efa0109d3a12ac00ef958744ba17bfebdceee9a Mon Sep 17 00:00:00 2001 From: Diana Z Date: Fri, 25 Sep 2020 14:45:14 -0600 Subject: 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 Change-Id: I38d522f346bfd500b72109db46f78a9c135ce96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432457 Reviewed-by: Jett Rink Reviewed-by: Abe Levkoy --- util/ectool.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'util/ectool.c') 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 \n" + "Usage: %s [args]\n" " is the type-c port to query\n" " 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) -- cgit v1.2.1