Skip to contentSkip to conversation

adb: Fix assertion failure in adb_request() by blocking/unblocking autopoll

PATCH New Zheyu Ma 1 participant 1 message Jun 18, 2024

lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 adb: Fix assertion failure in adb_request() by blocking/unblocking autopoll

This commit addresses an assertion failure in the adb_request() function. The failure occurs because the autopoll feature is not properly blocked/unblocked during an ADB request. By calling adb_autopoll_block() at the beginning and adb_autopoll_unblock() at the end of the adb_request() function, we ensure that autopolling is correctly managed.

Reproducer:
cat << EOF | qemu-system-m68k -display none -machine accel=qtest, -m 512M -machine q800 -qtest stdio write 0x5000166d 0x1 0x10
write 0x5000000b 0x1 0x10
EOF

---
 hw/input/adb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/input/adb.c +3 -1
index aff7130fd0..2d65ad3f4d 100644
@@ -98,10 +98,12 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
 
     trace_adb_bus_request(buf[0] >> 4, adb_commands[buf[0] & 0xf], len);
 
-    assert(s->autopoll_blocked);
+    adb_autopoll_block(s);
 
     ret = do_adb_request(s, obuf, buf, len);
 
+    adb_autopoll_unblock(s);
+
     trace_adb_bus_request_done(buf[0] >> 4, adb_commands[buf[0] & 0xf], ret);
     return ret;
 }
Signature · 1 line
2.34.1