summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2022-10-28 14:19:21 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-13 22:43:14 +0000
commit3a705db54bc6f87df6e3b63db08fa379e9b02708 (patch)
treed5fffa2b5a471f9c5c306ecd44daf41dd8e166b6 /util
parent29d14affe55ffc3a2bb9eee19c355b756aeb7f7e (diff)
downloadchrome-ec-3a705db54bc6f87df6e3b63db08fa379e9b02708.tar.gz
TCPMv2: Make VDM ACKs available to the AP
When the AP is supplying VDM REQ messages, the responses should be delivered to the AP after the message has either sent or failed to send. Add storage of the reply in the DPM. BRANCH=None BUG=b:208884535 TEST=./twister -T ./zephyr/test, on skyrim ensure VDM responses and events are seen for both successful and unsuccessful REQs Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ica713c3b3f3f571f193c1458a0e28788cd205c72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3990995 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/util/ectool.cc b/util/ectool.cc
index 3c4b190c3c..76e617e3ba 100644
--- a/util/ectool.cc
+++ b/util/ectool.cc
@@ -342,6 +342,8 @@ const char help_str[] =
" Get discovery information for port and type\n"
" typecstatus <port>\n"
" Get status information for port\n"
+ " typecvdmresponse <port>\n"
+ " Get last VDM response for AP-requested VDM\n"
" uptimeinfo\n"
" Get info about how long the EC has been running and the most\n"
" recent AP resets\n"
@@ -10600,6 +10602,45 @@ int cmd_typec_status(int argc, char *argv[])
return 0;
}
+int cmd_typec_vdm_response(int argc, char *argv[])
+{
+ struct ec_params_typec_vdm_response p;
+ struct ec_response_typec_vdm_response *r =
+ (ec_response_typec_vdm_response *)ec_inbuf;
+ char *endptr;
+ int rv, i;
+
+ if (argc != 2) {
+ fprintf(stderr,
+ "Usage: %s <port>\n"
+ " <port> is the type-c port to query\n",
+ argv[0]);
+ return -1;
+ }
+
+ p.port = strtol(argv[1], &endptr, 0);
+ if (endptr && *endptr) {
+ fprintf(stderr, "Bad port\n");
+ return -1;
+ }
+
+ rv = ec_command(EC_CMD_TYPEC_VDM_RESPONSE, 0, &p, sizeof(p), ec_inbuf,
+ ec_max_insize);
+ if (rv < 0)
+ return -1;
+
+ if (r->vdm_data_objects > 0) {
+ printf("VDM response from partner: %d", r->partner_type);
+ for (i = 0; i < r->vdm_data_objects; i++)
+ printf("\n 0x%08x", r->vdm_response[i]);
+ printf("\n");
+ } else {
+ printf("No VDM response found\n");
+ }
+
+ return 0;
+}
+
int cmd_tp_self_test(int argc, char *argv[])
{
int rv;
@@ -11078,6 +11119,7 @@ const struct command commands[] = {
{ "typeccontrol", cmd_typec_control },
{ "typecdiscovery", cmd_typec_discovery },
{ "typecstatus", cmd_typec_status },
+ { "typecvdmresponse", cmd_typec_vdm_response },
{ "uptimeinfo", cmd_uptimeinfo },
{ "usbchargemode", cmd_usb_charge_set_mode },
{ "usbmux", cmd_usb_mux },