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
Signed-off-by: Zheyu Ma zheyuma97@gmail.com
---
hw/input/adb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/input/adb.c b/hw/input/adb.c
index aff7130fd0..2d65ad3f4d 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -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;
}
--
2.34.1