Discussion:
[PATCH] staging: speakup: refactor synths array to use a list
Samuel Thibault
2018-06-06 13:26:28 UTC
Permalink
Hello,
The synths[] array is a collection of synths acting like a list.
There is no need for synths to be an array, so refactor synths[] to use
standard kernel list_head API, instead, and modify the usages to suit.
As a side-effect, the maximum number of synths has also become redundant.
This looks good to me,

Reviewed-by: Samuel Thibault <***@ens-lyon.org>

Did you test to e.g. insmod speakup_soft ; insmod speakup_dummy ; rmmod
speakup_soft ; rmmod speakup_dummy

to make sure it did work correctly?

I'd also rather see it tested in the real wild before committing. Could
somebody on the speakup mailing list test the patch? (which I have
re-attached as a file for conveniency).

Samuel
Samuel Thibault
2018-06-04 09:57:30 UTC
Permalink
Hello,
The synths[] array is a collection of synths acting like a list.
There is no need for synths to be an array, so refactor synths[] to use
standard kernel list_head API, instead, and modify the usages to suit.
As a side-effect, the maximum number of synths has also become redundant.
This needs a review, but the principle looks sound to me :)

Thanks,
Samuel
---
drivers/staging/speakup/spk_types.h | 2 ++
drivers/staging/speakup/synth.c | 40 ++++++++++-------------------
2 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h
index 3e082dc3d45c..a2fc72c29894 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -160,6 +160,8 @@ struct spk_io_ops {
};
struct spk_synth {
+ struct list_head node;
+
const char *name;
const char *version;
const char *long_name;
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 7deeb7061018..25f259ee4ffc 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -18,8 +18,7 @@
#include "speakup.h"
#include "serialio.h"
-#define MAXSYNTHS 16 /* Max number of synths in array. */
-static struct spk_synth *synths[MAXSYNTHS + 1];
+static LIST_HEAD(synths);
struct spk_synth *synth;
char spk_pitch_buff[32] = "";
static int module_status;
@@ -355,9 +354,8 @@ struct var_t synth_time_vars[] = {
/* called by: speakup_init() */
int synth_init(char *synth_name)
{
- int i;
int ret = 0;
- struct spk_synth *synth = NULL;
+ struct spk_synth *tmp, *synth = NULL;
if (!synth_name)
return 0;
@@ -371,9 +369,10 @@ int synth_init(char *synth_name)
mutex_lock(&spk_mutex);
/* First, check if we already have it loaded. */
- for (i = 0; i < MAXSYNTHS && synths[i]; i++)
- if (strcmp(synths[i]->name, synth_name) == 0)
- synth = synths[i];
+ list_for_each_entry(tmp, &synths, node) {
+ if (strcmp(tmp->name, synth_name) == 0)
+ synth = tmp;
+ }
/* If we got one, initialize it now. */
if (synth)
@@ -448,29 +447,23 @@ void synth_release(void)
/* called by: all_driver_init() */
int synth_add(struct spk_synth *in_synth)
{
- int i;
int status = 0;
+ struct spk_synth *tmp;
mutex_lock(&spk_mutex);
- for (i = 0; i < MAXSYNTHS && synths[i]; i++)
- /* synth_remove() is responsible for rotating the array down */
- if (in_synth == synths[i]) {
+
+ list_for_each_entry(tmp, &synths, node) {
+ if (tmp == in_synth) {
mutex_unlock(&spk_mutex);
return 0;
}
- if (i == MAXSYNTHS) {
- pr_warn("Error: attempting to add a synth past end of array\n");
- mutex_unlock(&spk_mutex);
- return -1;
}
if (in_synth->startup)
status = do_synth_init(in_synth);
- if (!status) {
- synths[i++] = in_synth;
- synths[i] = NULL;
- }
+ if (!status)
+ list_add_tail(&in_synth->node, &synths);
mutex_unlock(&spk_mutex);
return status;
@@ -479,17 +472,10 @@ EXPORT_SYMBOL_GPL(synth_add);
void synth_remove(struct spk_synth *in_synth)
{
- int i;
-
mutex_lock(&spk_mutex);
if (synth == in_synth)
synth_release();
- for (i = 0; synths[i]; i++) {
- if (in_synth == synths[i])
- break;
- }
- for ( ; synths[i]; i++) /* compress table */
- synths[i] = synths[i + 1];
+ list_del(&in_synth->node);
module_status = 0;
mutex_unlock(&spk_mutex);
}
--
2.17.1
_______________________________________________
Speakup mailing list
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
--
Samuel
<N> un driver qui fait quoi, alors ?
<y> ben pour les bips
<s> pour passer les oops en morse
-+- #ens-mim - vive les rapports de bug -+-
Justin Skists
2018-06-06 20:28:12 UTC
Permalink
Post by Samuel Thibault
Hello,
The synths[] array is a collection of synths acting like a list.
There is no need for synths to be an array, so refactor synths[] to use
standard kernel list_head API, instead, and modify the usages to suit.
As a side-effect, the maximum number of synths has also become redundant.
This looks good to me,
Thank you.
Post by Samuel Thibault
Did you test to e.g. insmod speakup_soft ; insmod speakup_dummy ; rmmod
speakup_soft ; rmmod speakup_dummy
to make sure it did work correctly?
I did. And I swapped synths via the sysfs interface.

As always, it's always good to double-check. So, I've scripted the test
sequence that I used and attached the output.
Post by Samuel Thibault
I'd also rather see it tested in the real wild before committing.
As it should be. :)

Justin
Samuel Thibault
2018-06-11 22:57:03 UTC
Permalink
Hello,
Post by Samuel Thibault
I'd also rather see it tested in the real wild before committing. Could
somebody on the speakup mailing list test the patch? (which I have
re-attached as a file for conveniency).
Anybody up for testing please?

If people want to see speakup get mainlined instead of staging, please
help.

Samuel
Gregory Nowak
2018-06-11 23:51:22 UTC
Permalink
Post by Samuel Thibault
Anybody up for testing please?
If people want to see speakup get mainlined instead of staging, please
help.
If I understand right, this patch changes how synthesizers are loaded
and unloaded through /sys/accessibility/speakup/synth, correct? If
yes, then would for example verifying that

echo bns >/sys/accessibility/speakup/synth
echo soft >/sys/accessibility/speakup/synth

does what it should be good enough of a test? If this would not be
good enough, please describe exactly what needs testing.

I likely won't be able to do a kernel build until this weekend, but
should be able to report back next Monday on the 18th.

Greg
--
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-***@EU.org
Samuel Thibault
2018-06-12 06:31:06 UTC
Permalink
Post by Gregory Nowak
Post by Samuel Thibault
Anybody up for testing please?
If people want to see speakup get mainlined instead of staging, please
help.
If I understand right, this patch changes how synthesizers are loaded
and unloaded through /sys/accessibility/speakup/synth, correct?
The load/unload is about the module itself, i.e. modprobe speakup_bns ;
modprobe speakup_soft, switch between them, then rmmod speakup_bns ;
speakup_soft or the converse (to exercise both orders).

Thanks!
Samuel
Gregory Nowak
2018-06-18 05:34:44 UTC
Permalink
Post by Samuel Thibault
The load/unload is about the module itself, i.e. modprobe speakup_bns ;
modprobe speakup_soft, switch between them, then rmmod speakup_bns ;
speakup_soft or the converse (to exercise both orders).
# uname -a
Linux p41box 4.17.1 #1 SMP Sat Jun 16 11:19:57 MST 2018 i686 GNU/Linux
# lsmod |grep "speakup"
speakup_bns 16384 0
speakup_soft 16384 1
speakup 94208 3 speakup_bns,speakup_soft

With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer. Doing rmmod of all three speakup modules comes back with
no errors. There is also no unusual output in dmesg, I can see both
synthesizers being registered and unregistered as I switch between
them.

I can also reproduce this behavior with speakup_soft, and speakup_dummy
specifically:

1. modprobe speakup_soft and modprobe speakup_dummy

2. The synthesizer should now be set to dummy in
/sys/accessibility/speakup/synth.

3. Use the speakup review keys, press enter a number of times. You
should observe output from both the software speech, and from the
serial port alternating between each other.

4. echo soft >/sys/accessibility/speakup/synth

5. You should observe no output from either software speech or the
serial port as you use speakup review keys, or press enter
repeatedly.

6. echo dummy >/sys/accessibility/speakup/synth

7. You should alternately get speech from the software synthesizer and
from the serial port.

I built my kernel from the 4.17.1 kernel.org sources, and the patch
that Samuel reposted applied cleanly with no errors.

Greg
--
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-***@EU.org
Samuel Thibault
2018-06-18 06:22:25 UTC
Permalink
Thanks for the tests!

Samuel
Justin Skists
2018-06-18 08:41:44 UTC
Permalink
Post by Gregory Nowak
Post by Samuel Thibault
The load/unload is about the module itself, i.e. modprobe speakup_bns ;
modprobe speakup_soft, switch between them, then rmmod speakup_bns ;
speakup_soft or the converse (to exercise both orders).
# uname -a
Linux p41box 4.17.1 #1 SMP Sat Jun 16 11:19:57 MST 2018 i686 GNU/Linux
# lsmod |grep "speakup"
speakup_bns 16384 0
speakup_soft 16384 1
speakup 94208 3 speakup_bns,speakup_soft
With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer.
Is this a known issue, or a regression due to the patch?


Justin.
Samuel Thibault
2018-06-18 08:46:34 UTC
Permalink
Post by Justin Skists
Post by Gregory Nowak
With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer.
Is this a known issue, or a regression due to the patch?
I don't think it was a known issue, but I don't think it can be a
regression due to the patch, since none of that is handled by the
array/list at stake.

Samuel
Justin Skists
2018-06-18 08:55:32 UTC
Permalink
Post by Samuel Thibault
Post by Justin Skists
Post by Gregory Nowak
With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer.
Is this a known issue, or a regression due to the patch?
I don't think it was a known issue, but I don't think it can be a
regression due to the patch, since none of that is handled by the
array/list at stake.
OK, thanks. That's what I thought, too.

When I was going through the driver code, to become familiar with it, there
were a few places that I thought needed a closer look. But I need to finish
setting up a regression testing system before I do.

Justin.
Samuel Thibault
2018-06-18 08:58:34 UTC
Permalink
Post by Justin Skists
When I was going through the driver code, to become familiar with it, there
were a few places that I thought needed a closer look.
Yes, cleanup work is probably needed in various places.

Samuel
Keith Barrett
2018-10-09 14:42:04 UTC
Permalink
Post by Gregory Nowak
Post by Samuel Thibault
The load/unload is about the module itself, i.e. modprobe speakup_bns ;
modprobe speakup_soft, switch between them, then rmmod speakup_bns ;
speakup_soft or the converse (to exercise both orders).
# uname -a
Linux p41box 4.17.1 #1 SMP Sat Jun 16 11:19:57 MST 2018 i686 GNU/Linux
# lsmod |grep "speakup"
speakup_bns 16384 0
speakup_soft 16384 1
speakup 94208 3 speakup_bns,speakup_soft
With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer. Doing rmmod of all three speakup modules comes back with
no errors. There is also no unusual output in dmesg, I can see both
synthesizers being registered and unregistered as I switch between
them.
I can also reproduce this behavior with speakup_soft, and speakup_dummy
This also applies to speakup_soft and speakup_apollo as well, debian
buster updated as of 9th October 2018.
Post by Gregory Nowak
1. modprobe speakup_soft and modprobe speakup_dummy
2. The synthesizer should now be set to dummy in
/sys/accessibility/speakup/synth.
3. Use the speakup review keys, press enter a number of times. You
should observe output from both the software speech, and from the
serial port alternating between each other.
4. echo soft >/sys/accessibility/speakup/synth
5. You should observe no output from either software speech or the
serial port as you use speakup review keys, or press enter
repeatedly.
6. echo dummy >/sys/accessibility/speakup/synth
7. You should alternately get speech from the software synthesizer and
from the serial port.
I built my kernel from the 4.17.1 kernel.org sources, and the patch
that Samuel reposted applied cleanly with no errors.
Greg
Gregory Nowak
2018-10-16 00:24:14 UTC
Permalink
Just wanted to say I documented this issue on Okash's speakup issues
page:
<http://www.github.com/bytefire/speakup/issues/7>

Greg
Post by Gregory Nowak
Post by Samuel Thibault
The load/unload is about the module itself, i.e. modprobe speakup_bns ;
modprobe speakup_soft, switch between them, then rmmod speakup_bns ;
speakup_soft or the converse (to exercise both orders).
# uname -a
Linux p41box 4.17.1 #1 SMP Sat Jun 16 11:19:57 MST 2018 i686 GNU/Linux
# lsmod |grep "speakup"
speakup_bns 16384 0
speakup_soft 16384 1
speakup 94208 3 speakup_bns,speakup_soft
With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer. Doing rmmod of all three speakup modules comes back with
no errors. There is also no unusual output in dmesg, I can see both
synthesizers being registered and unregistered as I switch between
them.
I can also reproduce this behavior with speakup_soft, and speakup_dummy
Also the same with speakup_soft and speakup_apollo on debian buster updated
as of 9th October 2018.
Post by Gregory Nowak
1. modprobe speakup_soft and modprobe speakup_dummy
2. The synthesizer should now be set to dummy in
/sys/accessibility/speakup/synth.
3. Use the speakup review keys, press enter a number of times. You
should observe output from both the software speech, and from the
serial port alternating between each other.
4. echo soft >/sys/accessibility/speakup/synth
5. You should observe no output from either software speech or the
serial port as you use speakup review keys, or press enter
repeatedly.
6. echo dummy >/sys/accessibility/speakup/synth
7. You should alternately get speech from the software synthesizer and
from the serial port.
I built my kernel from the 4.17.1 kernel.org sources, and the patch
that Samuel reposted applied cleanly with no errors.
Greg
--
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-***@EU.org
Keith Barrett
2018-10-16 09:51:22 UTC
Permalink
Post by Gregory Nowak
Just wanted to say I documented this issue on Okash's speakup issues
<http://www.github.com/bytefire/speakup/issues/7>
Greg
Right, there is something very odd going on here regarding loading the
modules.

I have an appollo connected to the serial port.

There is an entry in /etc/modprobe.d/local.conf loading speakup_soft.
However, on booting the system, speakup_apollo is loaded and the apollo
works but I cannot work out how that module is being loaded.
Post by Gregory Nowak
Post by Gregory Nowak
Post by Samuel Thibault
The load/unload is about the module itself, i.e. modprobe speakup_bns ;
modprobe speakup_soft, switch between them, then rmmod speakup_bns ;
speakup_soft or the converse (to exercise both orders).
# uname -a
Linux p41box 4.17.1 #1 SMP Sat Jun 16 11:19:57 MST 2018 i686 GNU/Linux
# lsmod |grep "speakup"
speakup_bns 16384 0
speakup_soft 16384 1
speakup 94208 3 speakup_bns,speakup_soft
With /sys/accessibility/speakup/synth set to bns, I am getting output
alternately from the bns and from soft. It's as if speakup can't make
up its mind which synthesizer is being used. When I echo soft
Post by Samuel Thibault
/sys/accessibility/speakup/synth, I get no speech at all from either
synthesizer. Doing rmmod of all three speakup modules comes back with
no errors. There is also no unusual output in dmesg, I can see both
synthesizers being registered and unregistered as I switch between
them.
I can also reproduce this behavior with speakup_soft, and speakup_dummy
Also the same with speakup_soft and speakup_apollo on debian buster updated
as of 9th October 2018.
Post by Gregory Nowak
1. modprobe speakup_soft and modprobe speakup_dummy
2. The synthesizer should now be set to dummy in
/sys/accessibility/speakup/synth.
3. Use the speakup review keys, press enter a number of times. You
should observe output from both the software speech, and from the
serial port alternating between each other.
4. echo soft >/sys/accessibility/speakup/synth
5. You should observe no output from either software speech or the
serial port as you use speakup review keys, or press enter
repeatedly.
6. echo dummy >/sys/accessibility/speakup/synth
7. You should alternately get speech from the software synthesizer and
from the serial port.
I built my kernel from the 4.17.1 kernel.org sources, and the patch
that Samuel reposted applied cleanly with no errors.
Greg
Didier Spaier
2018-10-16 10:09:57 UTC
Permalink
Right, there is something very odd going on here regarding loading the modules.
I have an appollo connected to the serial port.
There is an entry in /etc/modprobe.d/local.conf loading speakup_soft.
However, on booting the system, speakup_apollo is loaded and the apollo works but I cannot work out how that module is being loaded.
Is the speakup_apollo driver built in the kernel, instead as provided as a module?

If it is the case it is available as soon as the kernel is uncompressed and the apollo should work very soon in the startup sequence.

Best,

Didier
John Covici
2018-06-11 23:55:27 UTC
Permalink
Maybe I can do it, I have a kernel with speakup, using 4.9.43. Will
the patch fit there?

On Mon, 11 Jun 2018 18:57:03 -0400,
[1 <text/plain; us-ascii (7bit)>]
Hello,
Post by Samuel Thibault
I'd also rather see it tested in the real wild before committing. Could
somebody on the speakup mailing list test the patch? (which I have
re-attached as a file for conveniency).
Anybody up for testing please?
If people want to see speakup get mainlined instead of staging, please
help.
Samuel
[2 patch <text/plain; us-ascii (7bit)>]
---
drivers/staging/speakup/spk_types.h | 2 ++
drivers/staging/speakup/synth.c | 40 ++++++++++-------------------
2 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h
index 3e082dc3d45c..a2fc72c29894 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -160,6 +160,8 @@ struct spk_io_ops {
};
struct spk_synth {
+ struct list_head node;
+
const char *name;
const char *version;
const char *long_name;
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 7deeb7061018..25f259ee4ffc 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -18,8 +18,7 @@
#include "speakup.h"
#include "serialio.h"
-#define MAXSYNTHS 16 /* Max number of synths in array. */
-static struct spk_synth *synths[MAXSYNTHS + 1];
+static LIST_HEAD(synths);
struct spk_synth *synth;
char spk_pitch_buff[32] = "";
static int module_status;
@@ -355,9 +354,8 @@ struct var_t synth_time_vars[] = {
/* called by: speakup_init() */
int synth_init(char *synth_name)
{
- int i;
int ret = 0;
- struct spk_synth *synth = NULL;
+ struct spk_synth *tmp, *synth = NULL;
if (!synth_name)
return 0;
@@ -371,9 +369,10 @@ int synth_init(char *synth_name)
mutex_lock(&spk_mutex);
/* First, check if we already have it loaded. */
- for (i = 0; i < MAXSYNTHS && synths[i]; i++)
- if (strcmp(synths[i]->name, synth_name) == 0)
- synth = synths[i];
+ list_for_each_entry(tmp, &synths, node) {
+ if (strcmp(tmp->name, synth_name) == 0)
+ synth = tmp;
+ }
/* If we got one, initialize it now. */
if (synth)
@@ -448,29 +447,23 @@ void synth_release(void)
/* called by: all_driver_init() */
int synth_add(struct spk_synth *in_synth)
{
- int i;
int status = 0;
+ struct spk_synth *tmp;
mutex_lock(&spk_mutex);
- for (i = 0; i < MAXSYNTHS && synths[i]; i++)
- /* synth_remove() is responsible for rotating the array down */
- if (in_synth == synths[i]) {
+
+ list_for_each_entry(tmp, &synths, node) {
+ if (tmp == in_synth) {
mutex_unlock(&spk_mutex);
return 0;
}
- if (i == MAXSYNTHS) {
- pr_warn("Error: attempting to add a synth past end of array\n");
- mutex_unlock(&spk_mutex);
- return -1;
}
if (in_synth->startup)
status = do_synth_init(in_synth);
- if (!status) {
- synths[i++] = in_synth;
- synths[i] = NULL;
- }
+ if (!status)
+ list_add_tail(&in_synth->node, &synths);
mutex_unlock(&spk_mutex);
return status;
@@ -479,17 +472,10 @@ EXPORT_SYMBOL_GPL(synth_add);
void synth_remove(struct spk_synth *in_synth)
{
- int i;
-
mutex_lock(&spk_mutex);
if (synth == in_synth)
synth_release();
- for (i = 0; synths[i]; i++) {
- if (in_synth == synths[i])
- break;
- }
- for ( ; synths[i]; i++) /* compress table */
- synths[i] = synths[i + 1];
+ list_del(&in_synth->node);
module_status = 0;
mutex_unlock(&spk_mutex);
}
--
2.17.1
[3 <text/plain; utf-8 (base64)>]
_______________________________________________
Speakup mailing list
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?

John Covici wb2una
***@ccs.covici.com
Samuel Thibault
2018-10-21 17:43:38 UTC
Permalink
Hello,
Post by Gregory Nowak
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
Samuel Thibault
2018-10-21 20:50:30 UTC
Permalink
Do I need to downgrade to 4.15 to apply this or can I use a 4.18 kernel?
Ah, the changes were based on 4.15 indeed, here is a version rebased on
4.18

Samuel
Gregory Nowak
2018-10-21 22:03:20 UTC
Permalink
Post by Samuel Thibault
Ah, the changes were based on 4.15 indeed, here is a version rebased on
4.18
Hmmm, the top line of the attached patch still says: "Index:
linux-4.15/drivers/staging/speakup/speakup_soft.c"

Greg
Post by Samuel Thibault
Samuel
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 - bytes_per_ch) {
+ 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 = EPOLLIN | EPOLLRDNORM;
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 };
_______________________________________________
Speakup mailing list
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
--
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-***@EU.org
Samuel Thibault
2018-10-21 22:06:25 UTC
Permalink
Post by Gregory Nowak
Post by Samuel Thibault
Ah, the changes were based on 4.15 indeed, here is a version rebased on
4.18
linux-4.15/drivers/staging/speakup/speakup_soft.c"
Yes, I modified it by hand and didn't think to change the version.

Samuel
Keith Barrett
2018-10-22 15:52:37 UTC
Permalink
Hi,

Before I start, I take it I need to install a patched kernel, taking the
instructions from last time when Okash was making changes?

If this is not the case, some instructions would be helpful.

Thanks

Keith
Post by Samuel Thibault
Post by Gregory Nowak
Post by Samuel Thibault
Ah, the changes were based on 4.15 indeed, here is a version rebased on
4.18
linux-4.15/drivers/staging/speakup/speakup_soft.c"
Yes, I modified it by hand and didn't think to change the version.
Samuel
_______________________________________________
Speakup mailing list
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
Samuel Thibault
2018-10-22 16:05:22 UTC
Permalink
Post by Keith Barrett
Before I start, I take it I need to install a patched kernel, taking the
instructions from last time when Okash was making changes?
All changes are in kernel 4.18 already, so you just need to apply my
patch on the top of 4.18.

Samuel
Gregory Nowak
2018-10-23 05:41:53 UTC
Permalink
Post by Samuel Thibault
Ah, the changes were based on 4.15 indeed, here is a version rebased on
4.18
I've only had a chance to use my newly built kernel for a few minutes,
but Samuel's patch does appear to fix the problem. I will do more
testing in the morning, and will report back.

Greg
--
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-***@EU.org
Gregory Nowak
2018-10-23 19:24:17 UTC
Permalink
I've been using the bns for two hours so far. I've also done a
repeated rmmod and modprobe of soft and bns in either order. I have as
well switched from bns to soft and back again with both modules
loaded, and see no problems here. Thanks to Samuel, Okash, and
everyone else who is maintaining speakup.

Greg
Post by Gregory Nowak
I've only had a chance to use my newly built kernel for a few minutes,
but Samuel's patch does appear to fix the problem. I will do more
testing in the morning, and will report back.
Greg
--
web site: http://www.gregn.net
gpg public key: http://www.gregn.net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
If we haven't been in touch before, e-mail me before adding me to your contacts.

--
Free domains: http://www.eu.org/ or mail dns-***@EU.org
Loading...