Skip to contentSkip to conversation

speakup: flush serial input buffer

PATCH New EPAXGAMINGtv 1 participant 1 message Aug 30 Speakup console speech driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 speakup: flush serial input buffer

Implement the serial buffer flush operation for the Speakup serial I/O backend by draining pending characters from the UART receive buffer.

---
 drivers/accessibility/speakup/serialio.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/accessibility/speakup/serialio.c +10 -1
index 3418ea31d..921303505 100644
@@ -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

Signature · 1 line
2.55.0