From 8ac6fbf9c5a6fa7f4c56573a9a5973d21475b46c Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 23 Mar 2023 15:29:57 -0700 Subject: docs: Add instructions for tracing ec commands Document how we can trace ec_commands in the EC console and in the kernel. BUG=none BRANCH=none TEST=Check with `python3 src/chromium/src/tools/md_browser/md_browser.py -d src/platform/ec/docs` and go to http://localhost:8080/ap-ec-comm.md Change-Id: Iaf790dc945b46046b84b9f9574bf9a8e552789a5 Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369567 Reviewed-by: Rob Barnes --- docs/ap-ec-comm.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/ap-ec-comm.md b/docs/ap-ec-comm.md index 035e2d7457..4270fca5f8 100644 --- a/docs/ap-ec-comm.md +++ b/docs/ap-ec-comm.md @@ -106,6 +106,20 @@ they're being called with. Different versions of a command may have different parameter or response formats. `EC_CMD_GET_CMD_VERSIONS` returns the versions of the given command supported by the EC. These version numbers start at 0. +## Tracing + +Command tracing can be done on the EC console (`hc debug` command) and/or in +the kernel: +``` +echo 1 > /sys/kernel/debug/tracing/events/cros_ec/enable +cat /sys/kernel/debug/tracing/trace + +369.416372: cros_ec_request_start: version: 0, command: EC_CMD_USB_PD_POWER_INFO +369.420528: cros_ec_request_done: version: 0, command: EC_CMD_USB_PD_POWER_INFO, ec result: EC_RES_SUCCESS, retval: 16 +369.420529: cros_ec_request_start: version: 0, command: EC_CMD_USB_PD_DISCOVERY +369.421383: cros_ec_request_done: version: 0, command: EC_CMD_USB_PD_DISCOVERY, ec result: EC_RES_SUCCESS, retval: 5 +``` + ## Transport-specific details Although the command and response formats are the same across all transports, -- cgit v1.2.1