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 <samuel.thibault@ens-lyon.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
1beea6204e
Коммит
45ac7b31bc
|
@ -210,12 +210,15 @@ static ssize_t softsynthx_read(struct file *fp, char __user *buf, size_t count,
|
|||
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);
|
||||
|
@ -235,6 +238,8 @@ static ssize_t softsynthx_read(struct file *fp, char __user *buf, size_t count,
|
|||
|
||||
/* 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';
|
||||
|
@ -331,7 +336,8 @@ static __poll_t softsynth_poll(struct file *fp, struct poll_table_struct *wait)
|
|||
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;
|
||||
|
|
|
@ -74,6 +74,7 @@ int synth_request_region(unsigned long start, unsigned long n);
|
|||
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;
|
||||
|
||||
|
|
|
@ -481,4 +481,10 @@ void synth_remove(struct spk_synth *in_synth)
|
|||
}
|
||||
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 };
|
||||
|
|
Загрузка…
Ссылка в новой задаче