LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCHv2] staging: speakup: Add pause command used on switching to graphical mode
@ 2018-05-07 20:14 Samuel Thibault
  2018-05-08 11:31 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2018-05-07 20:14 UTC (permalink / raw)
  To: gregkh, w.d.hubbs, chris, kirk, devel, linux-kernel, speakup

For software speech syntheses to be able to manage concurrent audio card
access, they need to know when speakup stops emitting text to be spoken
because the console has switched to graphical mode.  This introduces a
PAUSE command to do so.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

---
Difference from v1: fix codestyle issues.

 drivers/staging/speakup/buffers.c       |    4 ++++
 drivers/staging/speakup/main.c          |    6 ++++++
 drivers/staging/speakup/speakup.h       |    3 ++-
 drivers/staging/speakup/speakup_dummy.c |    1 +
 drivers/staging/speakup/speakup_soft.c  |    3 ++-
 drivers/staging/speakup/spk_types.h     |    2 +-
 drivers/staging/speakup/varhandlers.c   |    1 +
 7 files changed, 17 insertions(+), 3 deletions(-)

--- a/drivers/staging/speakup/speakup_dummy.c
+++ b/drivers/staging/speakup/speakup_dummy.c
@@ -21,6 +21,7 @@
 static struct var_t vars[] = {
 	{ CAPS_START, .u.s = {"CAPS_START\n" } },
 	{ CAPS_STOP, .u.s = {"CAPS_STOP\n" } },
+	{ PAUSE, .u.s = {"PAUSE\n"} },
 	{ RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },
 	{ PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },
 	{ VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -35,6 +35,7 @@ static int misc_registered;
 static struct var_t vars[] = {
 	{ CAPS_START, .u.s = {"\x01+3p" } },
 	{ CAPS_STOP, .u.s = {"\x01-3p" } },
+	{ PAUSE, .u.n = {"\x01P" } },
 	{ RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } },
 	{ PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } },
 	{ VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
@@ -154,7 +155,7 @@ static char *get_initstring(void)
 	var = synth_soft.vars;
 	while (var->var_id != MAXVARS) {
 		if (var->var_id != CAPS_START && var->var_id != CAPS_STOP &&
-		    var->var_id != DIRECT)
+		    var->var_id != PAUSE && var->var_id != DIRECT)
 			cp = cp + sprintf(cp, var->u.n.synth_fmt,
 					  var->u.n.value);
 		var++;
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -42,7 +42,7 @@ enum var_id_t {
 	SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
 	SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
 	ATTRIB_BLEEP, BLEEPS,
-	RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
+	RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT, PAUSE,
 	CAPS_START, CAPS_STOP, CHARTAB,
 	MAXVARS
 };
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -45,6 +45,7 @@ static struct st_var_header var_headers[
 	{ "lang", LANG, VAR_NUM, NULL, NULL },
 	{ "chartab", CHARTAB, VAR_PROC, NULL, NULL },
 	{ "direct", DIRECT, VAR_NUM, NULL, NULL },
+	{ "pause", PAUSE, VAR_STRING, spk_str_pause, NULL },
 };
 
 static struct st_var_header *var_ptrs[MAXVARS] = { NULL, NULL, NULL };
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -67,6 +67,8 @@ short spk_punc_mask;
 int spk_punc_level, spk_reading_punc;
 char spk_str_caps_start[MAXVARLEN + 1] = "\0";
 char spk_str_caps_stop[MAXVARLEN + 1] = "\0";
+char spk_str_pause[MAXVARLEN + 1] = "\0";
+bool spk_paused;
 const struct st_bits_data spk_punc_info[] = {
 	{"none", "", 0},
 	{"some", "/$%&@", SOME},
@@ -1780,6 +1782,10 @@ static void speakup_con_update(struct vc
 		/* Speakup output, discard */
 		return;
 	speakup_date(vc);
+	if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
+		synth_printf("%s", spk_str_pause);
+		spk_paused = 1;
+	}
 	spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 }
 
--- a/drivers/staging/speakup/speakup.h
+++ b/drivers/staging/speakup/speakup.h
@@ -94,7 +94,8 @@ extern struct spk_synth *synth;
 extern char spk_pitch_buff[];
 extern u_char *spk_our_keys[];
 extern short spk_punc_masks[];
-extern char spk_str_caps_start[], spk_str_caps_stop[];
+extern char spk_str_caps_start[], spk_str_caps_stop[], spk_str_pause[];
+extern bool spk_paused;
 extern const struct st_bits_data spk_punc_info[];
 extern u_char spk_key_buf[600];
 extern char *spk_characters[];
--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -77,6 +77,10 @@ void synth_buffer_add(u16 ch)
 	*buff_in++ = ch;
 	if (buff_in > buffer_end)
 		buff_in = synth_buffer;
+	/* We have written something to the speech synthesis, so we are not
+	 * paused any more.
+	 */
+	spk_paused = 0;
 }
 
 u16 synth_buffer_getc(void)
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2] staging: speakup: Add pause command used on switching to graphical mode
  2018-05-07 20:14 [PATCHv2] staging: speakup: Add pause command used on switching to graphical mode Samuel Thibault
@ 2018-05-08 11:31 ` Greg KH
  2018-05-08 14:04   ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2018-05-08 11:31 UTC (permalink / raw)
  To: Samuel Thibault, w.d.hubbs, chris, kirk, devel, linux-kernel, speakup

On Mon, May 07, 2018 at 10:14:27PM +0200, Samuel Thibault wrote:
> For software speech syntheses to be able to manage concurrent audio card
> access, they need to know when speakup stops emitting text to be spoken
> because the console has switched to graphical mode.  This introduces a
> PAUSE command to do so.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> ---
> Difference from v1: fix codestyle issues.

I already applied the v1 version, can you just send a patch for the
coding style fixes?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2] staging: speakup: Add pause command used on switching to graphical mode
  2018-05-08 11:31 ` Greg KH
@ 2018-05-08 14:04   ` Samuel Thibault
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2018-05-08 14:04 UTC (permalink / raw)
  To: Greg KH; +Cc: w.d.hubbs, chris, kirk, devel, linux-kernel, speakup

Greg KH, le mar. 08 mai 2018 13:31:31 +0200, a ecrit:
> On Mon, May 07, 2018 at 10:14:27PM +0200, Samuel Thibault wrote:
> > For software speech syntheses to be able to manage concurrent audio card
> > access, they need to know when speakup stops emitting text to be spoken
> > because the console has switched to graphical mode.  This introduces a
> > PAUSE command to do so.
> > 
> > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> > 
> > ---
> > Difference from v1: fix codestyle issues.
> 
> I already applied the v1 version, can you just send a patch for the
> coding style fixes?

Yes, sure, will do.

Samuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-08 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07 20:14 [PATCHv2] staging: speakup: Add pause command used on switching to graphical mode Samuel Thibault
2018-05-08 11:31 ` Greg KH
2018-05-08 14:04   ` Samuel Thibault

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 NNTP newsgroup(s).