linux-kernel 追踪I2C事件

示例

注意:我假设它debugfs安装在/sys/kernel/debug

如果没有,请尝试:

mount -t debugfs none /sys/kernel/debug

转到跟踪目录:

cd /sys/kernel/debug/tracing/

确保功能跟踪器已禁用:

echo nop > current_tracer

启用所有I2C事件:

echo 1 > events/i2c/enable

确保启用了跟踪:

echo 1 > tracing_on

跟踪消息可以在中查看/sys/kernel/debug/tracing/trace,例如:

... i2c_write: i2c-5 #0 a=044 f=0000 l=2 [02-14]
... i2c_read: i2c-5 #1 a=044 f=0001 l=4
... i2c_reply: i2c-5 #1 a=044 f=0001 l=4 [33-00-00-00]
... i2c_result: i2c-5 n=2 ret=2

跟踪事件用户空间API文档可以Documentation/trace/events.txt在内核源文件中找到。