[PATCH] speakup: flush serial input buffer
From: EPAXGAMINGtv
Date: Sun Aug 30 2026 - 13:47:33 EST
Implement the serial buffer flush operation for the Speakup serial
I/O backend by draining pending characters from the UART receive
buffer.
Signed-off-by: EPAXGAMINGtv <sureyjan@xxxxxxxxx>
Signed-off-by: EPAXGAMINGtv <dev_epaxgaming@xxxxxxxxxx>
---
drivers/accessibility/speakup/serialio.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/accessibility/speakup/serialio.c b/drivers/accessibility/speakup/serialio.c
index 3418ea31d..921303505 100644
--- a/drivers/accessibility/speakup/serialio.c
+++ b/drivers/accessibility/speakup/serialio.c
@@ -277,7 +277,16 @@ static unsigned char spk_serial_in_nowait(struct spk_synth *in_synth)
static void spk_serial_flush_buffer(struct spk_synth *in_synth)
{
- /* TODO: flush the UART 16550 buffer */
+
+ unsigned long flags;
+
+ spin_lock_irqsave(&speakup_info.spinlock,flags);
+
+ while (inb_p(speakup_info.port_tts + UART_LSR) & UART_LSR_DR)
+ inb_p(speakup_info.port_tts + UART_RX);
+
+ spin_unlock_irqrestore(&speakup_info.spinlock,flags);
+
}
static int spk_serial_out(struct spk_synth *in_synth, const char ch)
base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
--
2.55.0