Hi Titus,

On 21/1/25 11:36, Titus Rwantare wrote:
This has been useful when debugging when unsure if the guest is
generating i2c traffic.

Signed-off-by: Titus Rwantare <tit...@google.com>
---
  hw/misc/i2c-echo.c   | 13 +++++++++++++
  hw/misc/trace-events |  5 +++++
  2 files changed, 18 insertions(+)

diff --git a/hw/misc/i2c-echo.c b/hw/misc/i2c-echo.c
index 5ae3d0817e..06110e0f8e 100644
--- a/hw/misc/i2c-echo.c
+++ b/hw/misc/i2c-echo.c
@@ -13,6 +13,7 @@
  #include "qemu/main-loop.h"
  #include "block/aio.h"
  #include "hw/i2c/i2c.h"
+#include "trace.h"
#define TYPE_I2C_ECHO "i2c-echo"
  OBJECT_DECLARE_SIMPLE_TYPE(I2CEchoState, I2C_ECHO)
@@ -80,11 +81,19 @@ static int i2c_echo_event(I2CSlave *s, enum i2c_event event)
      case I2C_START_RECV:
          state->pos = 0;
+ trace_i2c_echo_event(DEVICE(s)->canonical_path, "I2C_START_RECV");
          break;
case I2C_START_SEND:
          state->pos = 0;
+ trace_i2c_echo_event(DEVICE(s)->canonical_path, "I2C_START_SEND");
+        break;
+
+    case I2C_START_SEND_ASYNC:
+        state->pos = 0;
+
+        trace_i2c_echo_event(DEVICE(s)->canonical_path, 
"I2C_START_SEND_ASYNC");

This patch is doing a bit more that what it describes, since now
START_SEND_ASYNC returns 0x00 instead of 0xff (besides updating pos).

Please split as one patch per logical change.

Thanks!

Phil.

          break;
case I2C_FINISH:

Reply via email to