From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id 9FAA21EFBD4; Sat, 27 Oct 2018 08:46:37 -0400 (EDT) Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by befuddled.reisers.ca (Postfix) with ESMTPS id 241641EFB6B for ; Sat, 27 Oct 2018 08:45:27 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8C7EDD65 for ; Sat, 27 Oct 2018 14:45:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5ivf4r7tazSL for ; Sat, 27 Oct 2018 14:45:19 +0200 (CEST) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B45F04AE for ; Sat, 27 Oct 2018 14:45:19 +0200 (CEST) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gGNxu-00019y-OO for speakup@linux-speakup.org; Sat, 27 Oct 2018 14:45:18 +0200 Date: Sat, 27 Oct 2018 14:45:18 +0200 From: Samuel Thibault To: "Speakup is a screen review system for Linux." Subject: Re: Issue if both speakup_soft and speakup-apollo are loaded in initrd, system on an USB drive Message-ID: <20181027124518.4wdgsrzxhqhonbnv@function> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="woe4cuwe3mf44j7b" Content-Disposition: inline In-Reply-To: Organization: I am not organized User-Agent: NeoMutt/20170113 (1.7.2) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Oct 2018 12:46:37 -0000 --woe4cuwe3mf44j7b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Didier Spaier, le jeu. 25 oct. 2018 14:44:13 +0200, a ecrit: > Is this a known issue that could be solved just upgrading the kernel? It is a known bug, the attached patch is currently submitted for inclusion, it will however probably only make it for 4.21. Samuel --woe4cuwe3mf44j7b Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=mix From: Samuel Thibault To: akpm@linux-foundation.org Cc: speakup@braille.uwo.ca, linux-kernel@vger.kernel.org Subject: staging/speakup_soft: Fix alternate speech with other synths When switching from speakup_soft to another synth, speakup_soft would keep calling synth_buffer_getc() from softsynthx_read. Let's thus make synth.c export the knowledge of the current synth, so that speakup_soft can determine whether it should be running. speakup_soft also needs to set itself alive, otherwise the switch would let it remain silent. Signed-off-by: Samuel Thibault --- drivers/staging/speakup/speakup_soft.c | 16 +++++++++++----- drivers/staging/speakup/spk_priv.h | 1 + drivers/staging/speakup/synth.c | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-) --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -208,12 +208,15 @@ static ssize_t softsynthx_read(struct fi return -EINVAL; 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); @@ -233,6 +236,8 @@ static ssize_t softsynthx_read(struct fi /* Keep 3 bytes available for a 16bit UTF-8-encoded character */ while (chars_sent <= count - bytes_per_ch) { + if (synth_current() != &synth_soft) + break; if (speakup_info.flushing) { speakup_info.flushing = 0; ch = '\x18'; @@ -329,7 +334,8 @@ static __poll_t softsynth_poll(struct fi 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 = EPOLLIN | EPOLLRDNORM; spin_unlock_irqrestore(&speakup_info.spinlock, flags); return ret; --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -72,6 +72,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; --- a/drivers/staging/speakup/synth.c +++ b/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 }; --woe4cuwe3mf44j7b--