public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Keith Barrett <lists@barrettpianos.co.uk>,
	Gregory Nowak <greg@gregn.net>
Cc: speakup@linux-speakup.org
Subject: Re: [PATCH] staging: speakup: refactor synths array to use a list
Date: Sun, 21 Oct 2018 19:43:38 +0200	[thread overview]
Message-ID: <20181021174338.a2wgpnvz4vusmva7@function> (raw)
In-Reply-To: <20181016002413.GA6792@gregn.net> <b296b6dd-2ef6-54dc-a968-1c5f719c4e3d@barrettpianos.co.uk>

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

Hello,

> > With /sys/accessibility/speakup/synth set to bns, I am getting output
> > alternately from the bns and from soft.

Could people having this issue try the attached patch which should be
fixing it?

Samuel

[-- Attachment #2: mix.txt --]
[-- Type: text/plain, Size: 2608 bytes --]

Index: linux-4.15/drivers/staging/speakup/speakup_soft.c
===================================================================
--- linux-4.15.orig/drivers/staging/speakup/speakup_soft.c
+++ linux-4.15/drivers/staging/speakup/speakup_soft.c
@@ -214,12 +214,15 @@ static ssize_t softsynthx_read(struct fi
 	DEFINE_WAIT(wait);
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
+	synth_soft.alive = 1;
 	while (1) {
 		prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
-		if (!unicode)
-			synth_buffer_skip_nonlatin1();
-		if (!synth_buffer_empty() || speakup_info.flushing)
-			break;
+		if (synth_current() == &synth_soft) {
+			if (!unicode)
+				synth_buffer_skip_nonlatin1();
+			if (!synth_buffer_empty() || speakup_info.flushing)
+				break;
+		}
 		spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 		if (fp->f_flags & O_NONBLOCK) {
 			finish_wait(&speakup_event, &wait);
@@ -239,6 +242,8 @@ static ssize_t softsynthx_read(struct fi
 
 	/* Keep 3 bytes available for a 16bit UTF-8-encoded character */
 	while (chars_sent <= count - 3) {
+		if (synth_current() != &synth_soft)
+			break;
 		if (speakup_info.flushing) {
 			speakup_info.flushing = 0;
 			ch = '\x18';
@@ -335,7 +340,8 @@ static unsigned int softsynth_poll(struc
 	poll_wait(fp, &speakup_event, wait);
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
-	if (!synth_buffer_empty() || speakup_info.flushing)
+	if (synth_current() == &synth_soft &&
+	    (!synth_buffer_empty() || speakup_info.flushing))
 		ret = POLLIN | POLLRDNORM;
 	spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 	return ret;
Index: linux-4.15/drivers/staging/speakup/spk_priv.h
===================================================================
--- linux-4.15.orig/drivers/staging/speakup/spk_priv.h
+++ linux-4.15/drivers/staging/speakup/spk_priv.h
@@ -81,6 +81,7 @@ int synth_request_region(unsigned long s
 int synth_release_region(unsigned long start, unsigned long n);
 int synth_add(struct spk_synth *in_synth);
 void synth_remove(struct spk_synth *in_synth);
+struct spk_synth *synth_current(void);
 
 extern struct speakup_info_t speakup_info;
 
Index: linux-4.15/drivers/staging/speakup/synth.c
===================================================================
--- linux-4.15.orig/drivers/staging/speakup/synth.c
+++ linux-4.15/drivers/staging/speakup/synth.c
@@ -495,4 +495,10 @@ void synth_remove(struct spk_synth *in_s
 }
 EXPORT_SYMBOL_GPL(synth_remove);
 
+struct spk_synth *synth_current(void)
+{
+	return synth;
+}
+EXPORT_SYMBOL_GPL(synth_current);
+
 short spk_punc_masks[] = { 0, SOME, MOST, PUNC, PUNC | B_SYM };

  reply	other threads:[~ UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
 Justin Skists
 ` Samuel Thibault
 ` Samuel Thibault
   ` Justin Skists
   ` Samuel Thibault
     ` Gregory Nowak
       ` Samuel Thibault
         ` Gregory Nowak
           ` Samuel Thibault
           ` Justin Skists
             ` Samuel Thibault
               ` Justin Skists
                 ` Samuel Thibault
           ` Keith Barrett
             ` Samuel Thibault [this message]
     [not found]               ` <cd4895c4-4817-1862-cdb1-04e8282da660@barrettpianos.co.uk>
                 ` Samuel Thibault
                   ` Gregory Nowak
                     ` Samuel Thibault
                       ` Keith Barrett
                         ` Samuel Thibault
                   ` Gregory Nowak
                     ` Gregory Nowak
     [not found]           ` <b952bff3-86e2-cce9-606e-3ee5c6bd09a3@barrettpianos.co.uk>
             ` Gregory Nowak
               ` Keith Barrett
                 ` Didier Spaier
     ` John Covici

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181021174338.a2wgpnvz4vusmva7@function \
    --to=samuel.thibault@ens-lyon.org \
    --cc=greg@gregn.net \
    --cc=lists@barrettpianos.co.uk \
    --cc=speakup@linux-speakup.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).