From 5e1c43a514a22bc4ac35d97cf545b693b3441b79 Mon Sep 17 00:00:00 2001 From: Tim Jarzombek Date: Fri, 20 Feb 2026 17:25:09 -0500 Subject: [PATCH] viacuda: fix livelock caused by autopoll clobbering in-progress transactions --- devices/common/viacuda.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/devices/common/viacuda.cpp b/devices/common/viacuda.cpp index f6fe314007..db908b7ab0 100644 --- a/devices/common/viacuda.cpp +++ b/devices/common/viacuda.cpp @@ -581,13 +581,16 @@ void ViaCuda::autopoll_handler() { this->do_post_keyboard_state_events = false; } + // Don't start async packets while a transaction is in progress + // or Cuda already has unsent data (TREQ asserted). + // Events stay queued in ADB devices until the bus is idle. + if (!this->old_tip || !this->treq) { + return; + } + uint8_t poll_command = this->autopoll_enabled ? this->adb_bus_obj->poll() : 0; if (poll_command) { - if (!this->old_tip || !this->treq) { - LOG_F(WARNING, "Cuda transaction probably in progress"); - } - // prepare autopoll packet response_header(CUDA_PKT_ADB, ADB_STAT_OK | ADB_STAT_AUTOPOLL); this->out_buf[2] = poll_command; // put the proper ADB command