summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2023-03-23 15:29:57 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-10 18:09:38 +0000
commit8ac6fbf9c5a6fa7f4c56573a9a5973d21475b46c (patch)
tree79039caeea9fc8f0714961b5ddb3cc99ebc53887
parent7de11dc636bc6cee6dfbb52b83407710e6257909 (diff)
downloadchrome-ec-8ac6fbf9c5a6fa7f4c56573a9a5973d21475b46c.tar.gz
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 <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369567 Reviewed-by: Rob Barnes <robbarnes@google.com>
-rw-r--r--docs/ap-ec-comm.md14
1 files changed, 14 insertions, 0 deletions
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,