Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c597367 authored by Okash Khawaja's avatar Okash Khawaja Committed by Greg Kroah-Hartman
Browse files

staging: speakup: flush tty buffers and ensure hardware flow control



This patch fixes the issue where TTY-migrated synths would take a while
to shut up after hitting numpad enter key. When calling synth_flush,
even though XOFF character is sent as high priority, data buffered in
TTY layer is still sent to the synth. This patch flushes that buffered
data when synth_flush is called.

It also tries to ensure that hardware flow control is enabled, by
setting CRTSCTS using tty's termios.

Reported-by: default avatarJohn Covici <covici@ccs.covici.com>
Signed-off-by: default avatarOkash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 470790ee
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ static void spk_serial_send_xchar(char ch);
static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
static unsigned char spk_serial_in(void);
static unsigned char spk_serial_in_nowait(void);
static void spk_serial_flush_buffer(void);

struct spk_io_ops spk_serial_io_ops = {
	.synth_out = spk_serial_out,
@@ -37,6 +38,7 @@ struct spk_io_ops spk_serial_io_ops = {
	.tiocmset = spk_serial_tiocmset,
	.synth_in = spk_serial_in,
	.synth_in_nowait = spk_serial_in_nowait,
	.flush_buffer = spk_serial_flush_buffer,
};
EXPORT_SYMBOL_GPL(spk_serial_io_ops);

@@ -268,6 +270,11 @@ static unsigned char spk_serial_in_nowait(void)
	return inb_p(speakup_info.port_tts + UART_RX);
}

static void spk_serial_flush_buffer(void)
{
	/* TODO: flush the UART 16550 buffer */
}

static int spk_serial_out(struct spk_synth *in_synth, const char ch)
{
	if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ static struct spk_synth synth_audptr = {

static void synth_flush(struct spk_synth *synth)
{
	synth->io_ops->flush_buffer();
	synth->io_ops->send_xchar(SYNTH_CLEAR);
	synth->io_ops->synth_out(synth, PROCSPEECH);
}
+1 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ static void do_catch_up(struct spk_synth *synth)
static void synth_flush(struct spk_synth *synth)
{
	in_escape = 0;
	synth->io_ops->flush_buffer();
	synth->synth_immediate(synth, "\033P;10z\033\\");
}

+1 −0
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@ static void synth_flush(struct spk_synth *synth)
		synth->io_ops->synth_out(synth, ']');
	in_escape = 0;
	is_flushing = 1;
	synth->io_ops->flush_buffer();
	synth->io_ops->synth_out(synth, SYNTH_CLEAR);
}

+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ static struct spk_synth synth_spkout = {

static void synth_flush(struct spk_synth *synth)
{
	synth->io_ops->flush_buffer();
	synth->io_ops->send_xchar(SYNTH_CLEAR);
}

Loading