Re: [PATCH] staging: speakup: clean up few indentation issues

2018-10-30 Thread Samuel Thibault
Colin King, le mar. 30 oct. 2018 11:09:59 +, a ecrit:
> From: Colin Ian King 
> 
> Trivial fix to clean up indentation issues across the driver
> 
> Signed-off-by: Colin Ian King 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/kobjects.c  | 2 +-
>  drivers/staging/speakup/speakup_decpc.c | 6 +++---
>  drivers/staging/speakup/speakup_keypc.c | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index 08f11cc17371..2e36d872662c 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -545,7 +545,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct 
> kobj_attribute *attr,
>   int rv = 0;
>   struct st_var_header *param;
>   struct var_t *var;
> - char *cp1;
> + char *cp1;
>   char *cp;
>   char ch;
>   unsigned long flags;
> diff --git a/drivers/staging/speakup/speakup_decpc.c 
> b/drivers/staging/speakup/speakup_decpc.c
> index 6649309e0342..459ee0c0bd57 100644
> --- a/drivers/staging/speakup/speakup_decpc.c
> +++ b/drivers/staging/speakup/speakup_decpc.c
> @@ -302,12 +302,12 @@ static void synth_flush(struct spk_synth *synth)
>   while (dt_ctrl(CTRL_flush)) {
>   if (--timeout == 0)
>   break;
> -udelay(50);
> + udelay(50);
>   }
>   for (timeout = 0; timeout < 10; timeout++) {
>   if (dt_waitbit(STAT_dma_ready))
>   break;
> -udelay(50);
> + udelay(50);
>   }
>   outb_p(DMA_sync, speakup_info.port_tts + 4);
>   outb_p(0, speakup_info.port_tts + 4);
> @@ -315,7 +315,7 @@ udelay(50);
>   for (timeout = 0; timeout < 10; timeout++) {
>   if (!(dt_getstatus() & STAT_flushing))
>   break;
> -udelay(50);
> + udelay(50);
>   }
>   dma_state = dt_getstatus() & STAT_dma_state;
>   dma_state ^= STAT_dma_state;
> diff --git a/drivers/staging/speakup/speakup_keypc.c 
> b/drivers/staging/speakup/speakup_keypc.c
> index 3901734982a4..b788272da4f9 100644
> --- a/drivers/staging/speakup/speakup_keypc.c
> +++ b/drivers/staging/speakup/speakup_keypc.c
> @@ -177,7 +177,7 @@ static void do_catch_up(struct spk_synth *synth)
>   jiffy_delta = spk_get_var(JIFFY);
>   delay_time = spk_get_var(DELAY);
>   full_time = spk_get_var(FULL);
> -spin_lock_irqsave(&speakup_info.spinlock, flags);
> + spin_lock_irqsave(&speakup_info.spinlock, flags);
>   jiffy_delta_val = jiffy_delta->u.n.value;
>   spin_unlock_irqrestore(&speakup_info.spinlock, flags);
>  
> -- 
> 2.19.1
> 

-- 
Samuel
 je sens venir la fonte 14 pour le rapport
 -+- #ens-mim -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: i18n: fix spelling mistake "phoneticly" -> "phonetically"

2018-11-28 Thread Samuel Thibault
Hello,

Colin King, le mer. 28 nov. 2018 16:12:32 +, a ecrit:
> - [MSG_FUNCNAME_SPELL_WORD_PHONETICALLY] = "spell word phoneticly",
> + [MSG_FUNCNAME_SPELL_WORD_PHONETICALLY] = "spell word phonetically",

Mmm, clearly an english typo. Speakup people, do you think there might
be any downside here?  Could it be that it was done on purpose for e.g.
syntheses to pronounce it right?

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: change semaphore to completion

2018-12-10 Thread Samuel Thibault
Arnd Bergmann, le lun. 10 déc. 2018 22:41:50 +0100, a ecrit:
> In this driver, both function the same way, but we want to eventually
> kill off semaphores, so a completion is the better choice here.
> 
> Signed-off-by: Arnd Bergmann 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/spk_ttyio.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/speakup/spk_ttyio.c 
> b/drivers/staging/speakup/spk_ttyio.c
> index 979e3ae249c1..c92bbd05516e 100644
> --- a/drivers/staging/speakup/spk_ttyio.c
> +++ b/drivers/staging/speakup/spk_ttyio.c
> @@ -10,7 +10,7 @@
>  
>  struct spk_ldisc_data {
>   char buf;
> - struct semaphore sem;
> + struct completion completion;
>   bool buf_free;
>  };
>  
> @@ -55,7 +55,7 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
>   if (!ldisc_data)
>   return -ENOMEM;
>  
> - sema_init(&ldisc_data->sem, 0);
> + init_completion(&ldisc_data->completion);
>   ldisc_data->buf_free = true;
>   speakup_tty->disc_data = ldisc_data;
>  
> @@ -95,7 +95,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty,
>  
>   ldisc_data->buf = cp[0];
>   ldisc_data->buf_free = false;
> - up(&ldisc_data->sem);
> + complete(&ldisc_data->completion);
>  
>   return 1;
>  }
> @@ -286,7 +286,8 @@ static unsigned char ttyio_in(int timeout)
>   struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
>   char rv;
>  
> - if (down_timeout(&ldisc_data->sem, usecs_to_jiffies(timeout)) == 
> -ETIME) {
> + if (wait_for_completion_timeout(&ldisc_data->completion,
> + usecs_to_jiffies(timeout)) == 0) {
>   if (timeout)
>   pr_warn("spk_ttyio: timeout (%d)  while waiting for 
> input\n",
>   timeout);
> -- 
> 2.20.0
> 

-- 
Samuel
Progress (n.): The process through which the Internet has evolved from
smart people in front of dumb terminals to dumb people in front of smart
terminals.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: general protection fault in spk_ttyio_ldisc_close

2019-01-08 Thread Samuel Thibault
Greg KH, le mar. 08 janv. 2019 15:25:07 +0100, a ecrit:
> On Tue, Jan 08, 2019 at 09:15:02AM -0500, Kyungtae Kim wrote:
> > On Tue, Jan 8, 2019 at 8:50 AM Greg KH  wrote:
> > >
> > > On Tue, Jan 08, 2019 at 08:37:37AM -0500, Kyungtae Kim wrote:
> > > > We report a bug in linux-4.20: "general protection fault in
> > > > spk_ttyio_ldisc_close"
> > > >
> > > > kernel config: https://kt0755.github.io/etc/config_v4.20_stable
> > > > repro: https://kt0755.github.io/etc/repro.a670e.c
> > > >
> > > > This occurs when the function kfree is about to execute
> > > > (driver/staging/speakup/spk_ttyio.c:68).
> > > > Particularly, kfree takes the argument like speakup_tty->disc_data.
> > > > But speakup_tty is invalid, so the pointer dereference causes GPF.
> > > > At a glance, it seems that speakup_tty was deallocated somewhere ahead 
> > > > of kfree.
> > >
> > > How did you trigger this?  Did you shut down and close the device
> > > already somehow?  Do you have a real tty device that is driven by the
> > > device?
> > >
> > > thanks,
> > >
> > > greg k-h
> > 
> > For this crash, we did without real speakup tty device.
> 
> How did you bind a non-real speakup tty device to the driver?

One can tell any device name to the driver and it will attempt to
communicate with it.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix tty-operation NULL derefs

2019-01-30 Thread Samuel Thibault
Johan Hovold, le mer. 30 janv. 2019 10:49:34 +0100, a ecrit:
> The send_xchar() and tiocmset() tty operations are optional. Add the
> missing sanity checks to prevent user-space triggerable NULL-pointer
> dereferences.
> 
> Fixes: 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input 
> functionality for tty")
> Cc: stable  # 4.13
> Cc: Okash Khawaja 
> Cc: Samuel Thibault 
> Signed-off-by: Johan Hovold 

Indeed.

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/spk_ttyio.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/speakup/spk_ttyio.c 
> b/drivers/staging/speakup/spk_ttyio.c
> index c92bbd05516e..005de0024dd4 100644
> --- a/drivers/staging/speakup/spk_ttyio.c
> +++ b/drivers/staging/speakup/spk_ttyio.c
> @@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
>   return;
>   }
>  
> - speakup_tty->ops->send_xchar(speakup_tty, ch);
> + if (speakup_tty->ops->send_xchar)
> + speakup_tty->ops->send_xchar(speakup_tty, ch);
>   mutex_unlock(&speakup_tty_mutex);
>  }
>  
> @@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
> int clear)
>   return;
>   }
>  
> - speakup_tty->ops->tiocmset(speakup_tty, set, clear);
> + if (speakup_tty->ops->tiocmset)
> + speakup_tty->ops->tiocmset(speakup_tty, set, clear);
>   mutex_unlock(&speakup_tty_mutex);
>  }
>  
> -- 
> 2.20.1
> 

-- 
Samuel
R: Parce que ça renverse bêtement l'ordre naturel de lecture!
Q: Mais pourquoi citer en fin d'article est-il si effroyable?
R: Citer en fin d'article
Q: Quelle est la chose la plus désagréable sur les groupes de news?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: Note that simple_strtoul can't simply be replaced by kstrtoul

2019-02-23 Thread Samuel Thibault
We often receive patches which erroneously try to use kstrtoul in these
places.

Signed-off-by: Samuel Thibault 
---
 drivers/staging/speakup/kobjects.c|2 ++
 drivers/staging/speakup/main.c|1 +
 drivers/staging/speakup/varhandlers.c |1 +
 3 files changed, 4 insertions(+)

--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -154,6 +154,7 @@ static ssize_t chars_chartab_store(struc
continue;
}
 
+   /* Do not replace with kstrtoul: here we need temp to be 
updated */
index = simple_strtoul(cp, &temp, 10);
if (index > 255) {
rejected++;
@@ -787,6 +788,7 @@ static ssize_t message_store_helper(cons
continue;
}
 
+   /* Do not replace with kstrtoul: here we need temp to be 
updated */
index = simple_strtoul(cp, &temp, 10);
 
while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1979,6 +1979,7 @@ oops:
return 1;
}
 
+   /* Do not replace with kstrtoul: here we need cp to be updated */
goto_pos = simple_strtoul(goto_buf, &cp, 10);
 
if (*cp == 'x') {
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -328,6 +328,7 @@ char *spk_s2uchar(char *start, char *des
 {
int val;
 
+   /* Do not replace with kstrtoul: here we need start to be updated */
val = simple_strtoul(skip_spaces(start), &start, 10);
if (*start == ',')
start++;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: Replace simple_strtoul with kstrtoul

2019-02-23 Thread Samuel Thibault
Bharath Vedartham, le dim. 24 févr. 2019 01:01:21 +0530, a ecrit:
> simple_strtoul is obsolete. Change it to kstrtoul. Kernel is building
> and booting successfully.

Please recheck your patch, temp is used after the simple_strtoul call.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging : speakup: replace ---help--- with help in Kconfig

2019-02-23 Thread Samuel Thibault
Hello, and thanks for your patch,

Bharath Vedartham, le dim. 24 févr. 2019 01:51:17 +0530, a ecrit:
> @@ -148,7 +148,7 @@ config SPEAKUP_SYNTH_KEYPC
>  
>  config SPEAKUP_SYNTH_LTLK
>   tristate "DoubleTalk LT/LiteTalk synthesizer support"
> help---
> +help

I'd say while at it, align it with tristate?

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: Note that simple_strtoul can't simply be replaced by kstrtoul

2019-02-24 Thread Samuel Thibault
Greg KH, le dim. 24 févr. 2019 08:59:21 +0100, a ecrit:
> On Sat, Feb 23, 2019 at 08:42:19PM +0100, Samuel Thibault wrote:
> > We often receive patches which erroneously try to use kstrtoul in these
> > places.
> > 
> > Signed-off-by: Samuel Thibault 
> 
> Awe, it's fun to try to see people do this and not really think about
> the consequences :)

Sure :)
But I have to say I'm a bit scared one of these could pass through :)

> Anyway, seriously, thanks for this, I'll go queue it up later today...

Thanks!

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging : speakup: Fix format issues in Kconfig

2019-02-24 Thread Samuel Thibault
Bharath Vedartham, le dim. 24 févr. 2019 18:41:42 +0530, a ecrit:
> Fix the checkpatch.pl warning to replace ---help--- with help in
> Kconfig.
> 
> Signed-off-by: Bharath Vedartham 

Reviewed-by: Samuel Thibault 

Thanks!

> ---
> Changes since v1:
>   - Allign help and removed redundant spaces.
> ---
>  drivers/staging/speakup/Kconfig | 42 
> -
>  1 file changed, 16 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/staging/speakup/Kconfig b/drivers/staging/speakup/Kconfig
> index efd6f45..4a78ab1 100644
> --- a/drivers/staging/speakup/Kconfig
> +++ b/drivers/staging/speakup/Kconfig
> @@ -3,7 +3,7 @@ menu "Speakup console speech"
>  config SPEAKUP
>   depends on VT
>   tristate "Speakup core"
> - ---help---
> + help
>   This is the Speakup screen reader.  Think of it as a
>   video console for blind people.  If built in to the
>   kernel, it can speak everything on the text console from
> @@ -43,7 +43,7 @@ config SPEAKUP
>  if SPEAKUP
>  config SPEAKUP_SYNTH_ACNTSA
>   tristate "Accent SA synthesizer support"
> - ---help---
> + help
>   This is the Speakup driver for the Accent SA
>   synthesizer.  You can say y to build it into the kernel,
>   or m to build it as a module.  See the configuration
> @@ -52,7 +52,7 @@ config SPEAKUP_SYNTH_ACNTSA
>  config SPEAKUP_SYNTH_ACNTPC
>   tristate "Accent PC synthesizer support"
>   depends on ISA || COMPILE_TEST
> - ---help---
> + help
>   This is the Speakup driver for the accent pc
>   synthesizer.  You can say y to build it into the kernel,
>   or m to build it as a module.  See the configuration
> @@ -60,7 +60,7 @@ config SPEAKUP_SYNTH_ACNTPC
>  
>  config SPEAKUP_SYNTH_APOLLO
>   tristate "Apollo II synthesizer support"
> - ---help---
> + help
>   This is the Speakup driver for the Apollo II
>   synthesizer.  You can say y to build it into the kernel,
>   or m to build it as a module.  See the configuration
> @@ -68,7 +68,7 @@ config SPEAKUP_SYNTH_APOLLO
>  
>  config SPEAKUP_SYNTH_AUDPTR
>   tristate "Audapter synthesizer support"
> - ---help---
> + help
>   This is the Speakup driver for the Audapter synthesizer.
>You can say y to build it into the kernel, or m to
>   build it as a module.  See the configuration help on the
> @@ -76,7 +76,7 @@ config SPEAKUP_SYNTH_AUDPTR
>  
>  config SPEAKUP_SYNTH_BNS
>   tristate "Braille 'n' Speak synthesizer support"
> - ---help---
> + help
>   This is the Speakup driver for the Braille 'n' Speak
>   synthesizer.  You can say y to build it into the kernel,
>   or m to build it as a module.  See the configuration
> @@ -84,8 +84,7 @@ config SPEAKUP_SYNTH_BNS
>  
>  config SPEAKUP_SYNTH_DECTLK
>   tristate "DECtalk Express synthesizer support"
> - ---help---
> -
> + help
>   This is the Speakup driver for the DecTalk Express
>   synthesizer.  You can say y to build it into the kernel,
>   or m to build it as a module.  See the configuration
> @@ -93,8 +92,7 @@ config SPEAKUP_SYNTH_DECTLK
>  
>  config SPEAKUP_SYNTH_DECEXT
>   tristate "DECtalk External (old) synthesizer support"
> - ---help---
> -
> + help
>   This is the Speakup driver for the DecTalk External
>   (old) synthesizer.  You can say y to build it into the
>   kernel, or m to build it as a module.  See the
> @@ -105,8 +103,7 @@ config SPEAKUP_SYNTH_DECPC
>   depends on m
>   depends on ISA || COMPILE_TEST
>   tristate "DECtalk PC (big ISA card) synthesizer support"
> - ---help---
> -
> + help
>   This is the Speakup driver for the DecTalk PC (full
>   length ISA) synthesizer.  You can say m to build it as
>   a module.  See the configuration help on the Speakup
> @@ -127,8 +124,7 @@ config SPEAKUP_SYNTH_DECPC
>  config SPEAKUP_SYNTH_DTLK
>   tristate "DoubleTalk PC synthesizer support"
>   depends on ISA || COMPILE_TEST
> - ---help---
> -
> + help
>   This is the Speakup driver for the internal DoubleTalk
>   PC synthesizer.  You can say y to build it into the
>   kernel, or m to build it as a module.  See the
> @@ -138,8 +134,7 @@ config SPEAKUP_SYNTH_DTLK
&g

Re: [PATCH] staging: speakup: i18n: fix spelling mistake "phoneticly" -> "phonetically"

2019-03-02 Thread Samuel Thibault
Hello,

Colin King, le mer. 28 nov. 2018 16:12:32 +, a ecrit:
> From: Colin Ian King 
> 
> There is a spelling mistake in array speakup_default_msgs at index
> MSG_FUNCNAME_SPELL_WORD_PHONETICALLY, fix this.
> 
> Signed-off-by: Colin Ian King 

We never got any feedback from the speakup mailing list, I guess fixing
the typo is fine.

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/i18n.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c
> index cea8707653f5..ee240d36f947 100644
> --- a/drivers/staging/speakup/i18n.c
> +++ b/drivers/staging/speakup/i18n.c
> @@ -336,7 +336,7 @@ static char *speakup_default_msgs[MSG_LAST_INDEX] = {
>   [MSG_FUNCNAME_SPELL_DELAY_DEC] = "spell delay decrement",
>   [MSG_FUNCNAME_SPELL_DELAY_INC] = "spell delay increment",
>   [MSG_FUNCNAME_SPELL_WORD] = "spell word",
> - [MSG_FUNCNAME_SPELL_WORD_PHONETICALLY] = "spell word phoneticly",
> + [MSG_FUNCNAME_SPELL_WORD_PHONETICALLY] = "spell word phonetically",
>   [MSG_FUNCNAME_TONE_DEC] = "tone decrement",
>   [MSG_FUNCNAME_TONE_INC] = "tone increment",
>   [MSG_FUNCNAME_VOICE_DEC] = "voice decrement",
> -- 
> 2.19.1
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Staging status of speakup

2019-03-16 Thread Samuel Thibault
Chris Brannon, le ven. 15 mars 2019 18:19:39 -0700, a ecrit:
> Okash Khawaja  writes:
> > Finally there is an issue where text in output buffer sometimes gets
> > garbled on SMP systems, but we can continue working on it after the
> > driver is moved out of staging, if that's okay. Basically we need a
> > reproducer of this issue.
> 
> What kind of reproducer do you need here?  It's straightforward to
> reproduce in casual use, at least with a software synthesizer.

The problem is that neither Okash nor I are even casual users of
speakup, so we need a walk-through of the kind of operation that
produces the issue. It does not have to be reproducible each time it is
done. Perhaps (I really don't know what that bug is about actually) it
is a matter of putting text in the selection buffer, and try to paste it
100 times, and once every 10 times it will be garbled, for instance.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Staging status of speakup

2019-03-16 Thread Samuel Thibault
Hello,

Please keep the lists in Cc, so that not only I have the information
(in particular since I will probably *not* have the time to investigate
myself).

Samuel Thibault, le sam. 16 mars 2019 10:35:43 +0100, a ecrit:
> The problem is that neither Okash nor I are even casual users of
> speakup, so we need a walk-through of the kind of operation that
> produces the issue.

deedra Waters  wrote:
> it's dead simple

For a user, perhaps, but again, neither Okash or I are actual users of
speakup, so we have just no idea what casual use is.

> just lead the screenreader read large blocks of text i guarantee it's
> reproduceable.

Which shortcut do you use to make the screen reader read it?  What is
"large"? Is that only one 80x25 complete output screen? Is that cat-ing
a long text? How is it garbled: is that right from the beginning of the
text? or at some point during it? or is that just a piece of it and then
it's Ok again?

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Staging status of speakup

2019-03-19 Thread Samuel Thibault
Alan Cox, le mar. 19 mars 2019 16:31:21 +, a ecrit:
> On Sat, 16 Mar 2019 10:35:43 +0100
> Samuel Thibault  wrote:
> > Chris Brannon, le ven. 15 mars 2019 18:19:39 -0700, a ecrit:
> > > Okash Khawaja  writes:  
> > > > Finally there is an issue where text in output buffer sometimes gets
> > > > garbled on SMP systems, but we can continue working on it after the
> > > > driver is moved out of staging, if that's okay. Basically we need a
> > > > reproducer of this issue.  
> > > 
> > > What kind of reproducer do you need here?  It's straightforward to
> > > reproduce in casual use, at least with a software synthesizer.  
> > 
> > The problem is that neither Okash nor I are even casual users of
> > speakup, so we need a walk-through of the kind of operation that
> > produces the issue. It does not have to be reproducible each time it is
> > done. Perhaps (I really don't know what that bug is about actually) it
> > is a matter of putting text in the selection buffer, and try to paste it
> > 100 times, and once every 10 times it will be garbled, for instance.
> 
> paste_selection still says

The issue is not actually with pasting a selection, just plain text
output from applications.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] vt: selection: allow functions to be called from inside kernel

2019-04-04 Thread Samuel Thibault
Greg KH, le jeu. 04 avril 2019 22:35:49 +0200, a ecrit:
> On Thu, Apr 04, 2019 at 08:45:29PM +0100, Okash Khawaja wrote:
> > diff --git a/include/linux/selection.h b/include/linux/selection.h
> > index a8f5b97b216f..171d77dfc825 100644
> > --- a/include/linux/selection.h
> > +++ b/include/linux/selection.h
> > @@ -11,13 +11,12 @@
> >  #include 
> >  #include 
> >  
> > -struct tty_struct;
> > -
> 
> Nit, why remove these lines?

The same line shows up already just a couple of lines below, so it's
just a clean-up along the way.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [HELP REQUESTED from the community] Was: Staging status of speakup

2019-09-14 Thread Samuel Thibault
Hello,

Okash Khawaja, le sam. 14 sept. 2019 22:08:35 +0100, a ecrit:
> 2. We are still missing descriptions for i18n/ directory. I have added
> filenames below. can someone can add description please:

There are some descriptions in the "14.1.  Files Under the i18n
Subdirectory" section of spkguide.txt

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [HELP REQUESTED from the community] Was: Staging status of speakup

2019-09-16 Thread Samuel Thibault
Okash Khawaja, le dim. 15 sept. 2019 19:41:30 +0100, a ecrit:
> I have attached the descriptions.

Attachment is missing :)

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: speakup: Split the comment to fit the length

2014-12-24 Thread Samuel Thibault
Panir.Nyan, le Wed 24 Dec 2014 04:07:31 +, a écrit :
> Split the comment to fit the length.
> 
> Signed-off-by: Panir Nyan 

Acked-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/synth.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
> index f3aa423..01eddab 100644
> --- a/drivers/staging/speakup/synth.c
> +++ b/drivers/staging/speakup/synth.c
> @@ -30,9 +30,9 @@ struct speakup_info_t speakup_info = {
>* must be taken at each kernel->speakup transition and released at
>* each corresponding speakup->kernel transition.
>*
> -  * The progression thread only interferes with the speakup machinery 
> through
> -  * the synth buffer, so only needs to take the lock while tinkering with
> -  * the buffer.
> +  * The progression thread only interferes with the speakup machinery
> +  * through the synth buffer, so only needs to take the lock
> +  * while tinkering with the buffer.
>*
>* We use spin_lock/trylock_irqsave and spin_unlock_irqrestore with this
>* spinlock because speakup needs to disable the keyboard IRQ.
> --
> 1.7.10.4
> 

-- 
Samuel
Linux, c'est simple : ça s'adresse à une machine qui est parfois un peu
maraboutée mais qui d'habitude n'a pas d'états d'âme. Sur Usenet y'a
plein d'humains et de primates, et ça devient vraiment gore par moment.
-+- TP in : Guide du linuxien pervers - "Le linuxien a-t-il une âme ?" -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: speakup: Combine the consecutive string

2014-12-24 Thread Samuel Thibault
Panir.Nyan, le Wed 24 Dec 2014 04:07:32 +, a écrit :
> Combine the consecutive string
> 
> Signed-off-by: Panir Nyan 

Acked-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/kobjects.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index b12c76d..3708bc1 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -566,7 +566,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct 
> kobj_attribute *attr,
>   if (ch >= ' ' && ch < '~')
>   *cp1++ = ch;
>   else
> - cp1 += sprintf(cp1, "\\""x%02x", ch);
> + cp1 += sprintf(cp1, "\\x%02x", ch);
>   }
>   *cp1++ = '"';
>   *cp1++ = '\n';
> --
> 1.7.10.4
> 

-- 
Samuel
"...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and
the Ugly)."
(By Matt Welsh)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: speakup: Replace return type

2019-05-05 Thread Samuel Thibault
Hello,

Madhumitha Prabakaran, le dim. 05 mai 2019 02:26:45 -0500, a ecrit:
> Replace return type and remove the respective assignment.

I prefer to keep it the way it was, it looks more straightforward for
the reader.

Samuel

> Issue found by Coccinelle.
> 
> Signed-off-by: Madhumitha Prabakaran 
> ---
>  drivers/staging/speakup/i18n.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c
> index ee240d36f947..a748eb8052d1 100644
> --- a/drivers/staging/speakup/i18n.c
> +++ b/drivers/staging/speakup/i18n.c
> @@ -470,8 +470,7 @@ static char *find_specifier_end(char *input)
>   input++;/* Advance over %. */
>   input = skip_flags(input);
>   input = skip_width(input);
> - input = skip_conversion(input);
> - return input;
> + return skip_conversion(input);
>  }
>  
>  /*
> -- 
> 2.17.1
> 

-- 
Samuel
Progress (n.): The process through which the Internet has evolved from
smart people in front of dumb terminals to dumb people in front of smart
terminals.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] drivers: staging: speakup: serialio: fix warning linux/serial.h is included more than once

2019-05-27 Thread Samuel Thibault
Hariprasad Kelam, le dim. 26 mai 2019 12:43:22 +0530, a ecrit:
> fix below warning reported by  includecheck
> 
> ./drivers/staging/speakup/serialio.h: linux/serial.h is included more
> than once.
> 
> Signed-off-by: Hariprasad Kelam 

That was indeed the result of f79b0d9c223ca09cefffc72304a7bcbc401a1c6f
("staging: speakup: Fixed warning  instead of
") which didn't take care of the inclusion above.
I believe  only is fine, the important part is in
drivers/staging/speakup/serialio.c which really needs to include
asm/serial.h to get SERIAL_PORT_DFNS

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/serialio.h | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/staging/speakup/serialio.h 
> b/drivers/staging/speakup/serialio.h
> index aa691e4..6f8f86f 100644
> --- a/drivers/staging/speakup/serialio.h
> +++ b/drivers/staging/speakup/serialio.h
> @@ -4,9 +4,6 @@
>  
>  #include /* for rs_table, serial constants */
>  #include /* for more serial constants */
> -#ifndef __sparc__
> -#include 
> -#endif
>  #include 
>  
>  #include "spk_priv.h"
> -- 
> 2.7.4
> 

-- 
Samuel
> No manual is ever necessary.
May I politely interject here: BULLSHIT.  That's the biggest Apple lie of all!
(Discussion in comp.os.linux.misc on the intuitiveness of interfaces.)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: One function call less in speakup_win_enable()

2019-07-06 Thread Samuel Thibault
Markus Elfring, le sam. 06 juil. 2019 10:15:30 +0200, a ecrit:
> From: Markus Elfring 
> Date: Sat, 6 Jul 2019 10:03:56 +0200
> 
> Avoid an extra function call by using a ternary operator instead of
> a conditional statement.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/main.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 488f2539aa9a..03bbc9a4dbb3 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1917,10 +1917,9 @@ static void speakup_win_enable(struct vc_data *vc)
>   return;
>   }
>   win_enabled ^= 1;
> - if (win_enabled)
> - synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCED));
> - else
> - synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCE_DISABLED));
> + synth_printf("%s\n", spk_msg_get(win_enabled
> +  ? MSG_WINDOW_SILENCED
> +  : MSG_WINDOW_SILENCE_DISABLED));
>  }
> 
>  static void speakup_bits(struct vc_data *vc)
> --
> 2.22.0
> 

-- 
Samuel
--- christ gives channel operator status to Dieu
 -+- #ens-mim and hell -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[HELP REQUESTED from the community] Was: Staging status of speakup

2019-07-12 Thread Samuel Thibault
Hello,

To readers of the linux-speakup: could you help on this so we can get
Speakup in mainline?  Neither Okash or I completely know what user
consequences the files in /sys/accessibility/speakup/ have, so could
people give brief explanations for each file (something like 3-6 lines
of explanation)?

The i18n/ files have been already documented in section 14.1 of the
spkguide.txt, so we do not need help for them.

Thanks!
Samuel

Greg KH, le ven. 12 juil. 2019 10:38:19 +0200, a ecrit:
> Can you make up a patch to create a
> drivers/staging/speakup/sysfs-speakup file with the needed information?
> That way it will be much easier to determine exactly what these sysfs
> files do and my review can be easier, and perhaps not needed at all :)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: selection: replace _manual_ swap with swap macro

2017-11-10 Thread Samuel Thibault
Gustavo A. R. Silva, on ven. 10 nov. 2017 16:13:03 -0600, wrote:
> Make use of the swap macro instead of _manually_ swapping values
> and remove unnecessary variable tmp.
> 
> This makes the code easier to read and maintain.
> 
> This code was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva 

Acked-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/selection.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/speakup/selection.c 
> b/drivers/staging/speakup/selection.c
> index 66061b5..0ed1fef 100644
> --- a/drivers/staging/speakup/selection.c
> +++ b/drivers/staging/speakup/selection.c
> @@ -64,13 +64,8 @@ int speakup_set_selection(struct tty_struct *tty)
>   ps = spk_ys * vc->vc_size_row + (spk_xs << 1);
>   pe = spk_ye * vc->vc_size_row + (spk_xe << 1);
>  
> - if (ps > pe) {
> - /* make sel_start <= sel_end */
> - int tmp = ps;
> -
> - ps = pe;
> - pe = tmp;
> - }
> + if (ps > pe)/* make sel_start <= sel_end */
> + swap(ps, pe);
>  
>   if (spk_sel_cons != vc_cons[fg_console].d) {
>   speakup_clear_selection();
> -- 
> 2.7.4
> 

-- 
Samuel
 il faut combien de chevaux pour tirer une doloréan à 88 morph ?
***b vient de remarque que 88 mph c'est 142 km/h
 ah
 c'est pour ça qu'ils limitent à 130 km/h sur les autoroutes
 c'est pour éviter que les gens voyagent dans le temps
 probablement
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: Replace strncpy with memcpy

2018-07-01 Thread Samuel Thibault
Guenter Roeck, le dim. 01 juil. 2018 13:57:24 -0700, a ecrit:
> gcc 8.1.0 generates the following warnings.
> 
> drivers/staging/speakup/kobjects.c: In function 'punc_store':
> drivers/staging/speakup/kobjects.c:522:2: warning:
>   'strncpy' output truncated before terminating nul
>   copying as many bytes from a string as its length
> drivers/staging/speakup/kobjects.c:504:6: note: length computed here
> 
> drivers/staging/speakup/kobjects.c: In function 'synth_store':
> drivers/staging/speakup/kobjects.c:391:2: warning:
>   'strncpy' output truncated before terminating nul
>   copying as many bytes from a string as its length
> drivers/staging/speakup/kobjects.c:388:8: note: length computed here
> 
> Using strncpy() is indeed less than perfect since the length of data to
> be copied has already been determined with strlen(). Replace strncpy()
> with memcpy() to address the warning and optimize the code a little.
> 
> Signed-off-by: Guenter Roeck 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/kobjects.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index f1f90222186b..08f11cc17371 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -388,7 +388,7 @@ static ssize_t synth_store(struct kobject *kobj, struct 
> kobj_attribute *attr,
>   len = strlen(buf);
>   if (len < 2 || len > 9)
>   return -EINVAL;
> - strncpy(new_synth_name, buf, len);
> + memcpy(new_synth_name, buf, len);
>   if (new_synth_name[len - 1] == '\n')
>   len--;
>   new_synth_name[len] = '\0';
> @@ -519,7 +519,7 @@ static ssize_t punc_store(struct kobject *kobj, struct 
> kobj_attribute *attr,
>   return -EINVAL;
>   }
>  
> - strncpy(punc_buf, buf, x);
> + memcpy(punc_buf, buf, x);
>  
>   while (x && punc_buf[x - 1] == '\n')
>   x--;
> -- 
> 2.7.4
> 

-- 
Samuel
Tu as lu les docs. Tu es devenu un informaticien. Que tu le veuilles
ou non. Lire la doc, c'est le Premier et Unique Commandement de
l'informaticien.
-+- TP in: Guide du Linuxien pervers - "L'évangile selon St Thomas"
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Samuel Thibault
Jann Horn, le sam. 07 juil. 2018 03:53:44 +0200, a ecrit:
> @@ -257,6 +257,8 @@ static ssize_t softsynthx_read(struct file *fp, char 
> __user *buf, size_t count,
>   0x80 | (ch & 0x3f)
>   };
>  
> + if (chars_sent + 2 > count)
> + break;
>   if (copy_to_user(cp, s, sizeof(s)))
>   return -EFAULT;

Err, but then we have lost 'ch' that was consumed by the
synth_buffer_getc() call, so the fix seems wrong to me.

Nacked-by: Samuel Thibault 

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Samuel Thibault
Re,

Could you review, test, and resubmit the patch below instead?

Samuel


If softsynthx_read() is called with `count < 3`, `count - 3` wraps, causing
the loop to copy as much data as available to the provided buffer. If
softsynthx_read() is invoked through sys_splice(), this causes an
unbounded kernel write; but even when userspace just reads from it
normally, a small size could cause userspace crashes.

Fixes: 425e586cf95b ("speakup: add unicode variant of /dev/softsynth")
Cc: sta...@vger.kernel.org
Signed-off-by: Samuel Thibault 

--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -198,11 +198,15 @@ static ssize_t softsynthx_read(struct fi
int chars_sent = 0;
char __user *cp;
char *init;
+   size_t bytes_per_ch = unicode ? 3 : 1;
u16 ch;
int empty;
unsigned long flags;
DEFINE_WAIT(wait);
 
+   if (count < bytes_per_ch)
+   return -EINVAL;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (1) {
prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
@@ -228,7 +232,7 @@ static ssize_t softsynthx_read(struct fi
init = get_initstring();
 
/* Keep 3 bytes available for a 16bit UTF-8-encoded character */
-   while (chars_sent <= count - 3) {
+   while (chars_sent <= count - bytes_per_ch) {
if (speakup_info.flushing) {
speakup_info.flushing = 0;
ch = '\x18';
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Samuel Thibault
Jann Horn, le sam. 07 juil. 2018 10:22:52 +0200, a ecrit:
> Or should I rewrite the
> patch to be simple and just bail out on `count < 3`?

Our mails have crossed :)

I believe what I sent is correct: for softsynth it does not make sense
to have room for less than 1 (non-unicode) or 3 (unicode) bytes.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-11 Thread Samuel Thibault
Hello,

Jann Horn, le mar. 10 juil. 2018 13:34:33 -0700, a ecrit:
> On Sat, Jul 7, 2018 at 1:29 AM Samuel Thibault
>  wrote:
> > Could you review, test, and resubmit the patch below instead?
> 
> Er... you mean, you want me to take your patch, add my Signed-off-by
> below yours, and then send that?

Yes, please.

> Some random thing I noticed, but I don't think it has anything to do
> with this issue: In some runs, when the console is repeatedly printing
> "Debian GNU/Linux 9 debian tty1\n\ndebian login: " in response to me
> pressing enter repeatedly, /dev/softsynthu (read in 1-byte steps)
> seems to return things like "Debian GNU slash Linux 9 debian tty1 \n
> debi login: ". I don't understand why it sometimes says "debi login"
> instead of "debian login".

It's odd indeed, but I agree it's unrelated.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: remove redundant variable l

2018-07-11 Thread Samuel Thibault
Colin King, le mer. 11 juil. 2018 12:26:07 +0100, a ecrit:
> From: Colin Ian King 
> 
> Variable l is being assigned but is never used hence it is redundant
> and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'l' set but not used [-Wunused-but-set-variable
> 
> Signed-off-by: Colin Ian King 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/varhandlers.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/speakup/varhandlers.c 
> b/drivers/staging/speakup/varhandlers.c
> index 54a76b6752ad..1b545152cc49 100644
> --- a/drivers/staging/speakup/varhandlers.c
> +++ b/drivers/staging/speakup/varhandlers.c
> @@ -179,7 +179,6 @@ int spk_set_num_var(int input, struct st_var_header *var, 
> int how)
>  {
>   int val;
>   int *p_val = var->p_val;
> - int l;
>   char buf[32];
>   char *cp;
>   struct var_t *var_data = var->data;
> @@ -237,9 +236,9 @@ int spk_set_num_var(int input, struct st_var_header *var, 
> int how)
>   else
>   cp = buf;
>   if (!var_data->u.n.out_str)
> - l = sprintf(cp, var_data->u.n.synth_fmt, (int)val);
> + sprintf(cp, var_data->u.n.synth_fmt, (int)val);
>   else
> - l = sprintf(cp, var_data->u.n.synth_fmt, 
> var_data->u.n.out_str[val]);
> + sprintf(cp, var_data->u.n.synth_fmt, 
> var_data->u.n.out_str[val]);
>   synth_printf("%s", cp);
>   return 0;
>  }
> -- 
> 2.17.1
> 

-- 
Samuel
> Allez, soyez sympa ... traduisez-lui "linux"
Linux, c'est comme le miel : c'est vachement bon mais ça attire les
mouches. En plus, ça colle aux doigts et on a du mal à s'en défaire.
-+- TP in: Guide du linuxien pervers - "Barrez vous les mouches !"
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] return same error value from spk_set_key_info

2017-02-21 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 21 févr. 2017 17:24:42 +0530, wrote:
> Retain the previous error values as debug messages
> instead.

Well, they are not really useful because they are actually undocumented.

> + if (version != KEY_MAP_VER) {
> + pr_debug("Version mismatch %d\n", -1);

Rather print version and KEY_MAP_VER

> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("Data len and Shift table too big %d\n", -2);

Rather print key_data_len + SHIFT_TBL_SIZE + 4 and sizeof(spk_key_buf)

> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("Key table size overflow %d\n", -3);

Rather print ch and SHIFT_TBL_SIZE.

> + if (ch >= MAX_KEY) {
> + pr_debug("Max Key overflow %d\n", -4);

Rather print ch and MAX_KEY.

Apart from that, returning -EINVAL instead of different values is fine
for me.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH Speakup v2] return same error value from spk_set_key_info

2017-02-21 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 21 févr. 2017 19:14:38 +0530, wrote:
> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
> +  "sizeof(spk_key_buf) = %lu\n", key_data_len,
> +  SHIFT_TBL_SIZE + 4, sizeof(spk_key_buf));

Well, that's very technical, and not useful to an actual user :)
Rather print
"too many key infos (%d bytes over %d)",
key_data_len + SHIFT_TBL_SIZE + 4,
sizeof(spk_key_buf)

> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("ch = %d, SHIFT_TBL_SIZE = %d\n", ch,
> +  SHIFT_TBL_SIZE);

similarly, rather
"ch %d is not a valid shift state (maximum %d)", ch, 
SHIFT_TBL_SIZE

> + if (ch >= MAX_KEY) {
> + pr_debug("ch = %d, MAX_KEY = %d\n", ch, MAX_KEY);

and
"ch %d is not a valid keycode (maximum %d)", ch, MAX_KEY

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] remove unnecessary initial allocation of vc

2017-02-21 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 21 févr. 2017 19:33:32 +0530, wrote:
> This patch removes the unnecessary allocation of
> current foreground vc during initialization.
> 
> Also change the prototype of speakup_allocate to take
> extra argument of gfp_* flags. Thus not requiring
> GFP_ATOMIC during initialization.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

Just add in the log that it's unnecessary because the for loop below
does the initialization already.

> ---
>  drivers/staging/speakup/main.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index ad95905..4437b39 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1328,14 +1328,14 @@ static int edit_bits(struct vc_data *vc, u_char type, 
> u_char ch, u_short key)
>  }
>  
>  /* Allocation concurrency is protected by the console semaphore */
> -static int speakup_allocate(struct vc_data *vc)
> +static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
>  {
>   int vc_num;
>  
>   vc_num = vc->vc_num;
>   if (speakup_console[vc_num] == NULL) {
>   speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
> -   GFP_ATOMIC);
> +   gfp_flags);
>   if (speakup_console[vc_num] == NULL)
>   return -ENOMEM;
>   speakup_date(vc);
> @@ -2258,7 +2258,7 @@ static int vt_notifier_call(struct notifier_block *nb,
>   switch (code) {
>   case VT_ALLOCATE:
>   if (vc->vc_mode == KD_TEXT)
> - speakup_allocate(vc);
> + speakup_allocate(vc, GFP_ATOMIC);
>   break;
>   case VT_DEALLOCATE:
>   speakup_deallocate(vc);
> @@ -2318,7 +2318,6 @@ static int __init speakup_init(void)
>  {
>   int i;
>   long err = 0;
> - struct st_spk_t *first_console;
>   struct vc_data *vc = vc_cons[fg_console].d;
>   struct var_t *var;
>  
> @@ -2343,18 +2342,9 @@ static int __init speakup_init(void)
>   if (err)
>   goto error_virtkeyboard;
>  
> - first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
> - if (!first_console) {
> - err = -ENOMEM;
> - goto error_alloc;
> - }
> -
> - speakup_console[vc->vc_num] = first_console;
> - speakup_date(vc);
> -
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   if (vc_cons[i].d) {
> - err = speakup_allocate(vc_cons[i].d);
> + err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
>   if (err)
>   goto error_kobjects;
>   }
> @@ -2413,7 +2403,6 @@ static int __init speakup_init(void)
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   kfree(speakup_console[i]);
>  
> -error_alloc:
>   speakup_remove_virtual_keyboard();
>  
>  error_virtkeyboard:
> -- 
> 2.10.2
> 

-- 
Samuel
 Battery 1: charging, 90%, charging at zero rate - will never fully charge.
 -+- acpi - et pourtant, ca monte -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info

2017-02-22 Thread Samuel Thibault
Pranay Kr. Srivastava, on mer. 22 févr. 2017 12:50:26 +0530, wrote:
> This patch makes spk_set_key_info return -EINVAL
> in case of failure instead of returning 4 different
> values for the type of error that occurred.
> 
> Print the offending values instead as debug message.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/main.c | 27 +++
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index c2f70ef..6667cf2 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1216,13 +1216,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
> *k_buffer)
>   u_char ch, version, num_keys;
>  
>   version = *cp++;
> - if (version != KEY_MAP_VER)
> - return -1;
> + if (version != KEY_MAP_VER) {
> + pr_debug("version found %d should be %d\n",
> +  version, KEY_MAP_VER);
> + return -EINVAL;
> + }
>   num_keys = *cp;
>   states = (int)cp[1];
>   key_data_len = (states + 1) * (num_keys + 1);
> - if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf))
> - return -2;
> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("too many key_infos (%d over %lu)\n",
> +  key_data_len + SHIFT_TBL_SIZE + 4, 
> sizeof(spk_key_buf));
> + return -EINVAL;
> + }
>   memset(k_buffer, 0, SHIFT_TBL_SIZE);
>   memset(spk_our_keys, 0, sizeof(spk_our_keys));
>   spk_shift_table = k_buffer;
> @@ -1233,14 +1239,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
> *k_buffer)
>   cp1 += 2;   /* now pointing at shift states */
>   for (i = 1; i <= states; i++) {
>   ch = *cp1++;
> - if (ch >= SHIFT_TBL_SIZE)
> - return -3;
> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("(%d) not valid shift state (max_allowed = 
> %d)\n", ch,
> +  SHIFT_TBL_SIZE);
> + return -EINVAL;
> + }
>   spk_shift_table[ch] = i;
>   }
>   keymap_flags = *cp1++;
>   while ((ch = *cp1)) {
> - if (ch >= MAX_KEY)
> - return -4;
> + if (ch >= MAX_KEY) {
> + pr_debug("(%d), not valid key, (max_allowed = %d)\n", 
> ch, MAX_KEY);
> + return -EINVAL;
> + }
>   spk_our_keys[ch] = cp1;
>   cp1 += states + 1;
>   }
> -- 
> 2.10.2
> 

-- 
Samuel
 j'en ai parlé à xavier, il n'est pas interdit qu'il le change un jour
 -+- #sos - a le bras long vers le chameau -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH-SPEAKUP 2/2] remove unecessary initial allocation of vc

2017-02-22 Thread Samuel Thibault
Pranay Kr. Srivastava, on mer. 22 févr. 2017 12:50:27 +0530, wrote:
> This patch removes the unnecessary allocation of
> current foreground vc during initialization.
> 
> This initialization is already handled in the loop
> that follows it for all available virtual consoles.
> 
> Also change the prototype of speakup_allocate to take
> extra argument of gfp_* flags. Thus not requiring
> GFP_ATOMIC during initialization.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/main.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 6667cf2..f81a936 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1327,14 +1327,14 @@ static int edit_bits(struct vc_data *vc, u_char type, 
> u_char ch, u_short key)
>  }
>  
>  /* Allocation concurrency is protected by the console semaphore */
> -static int speakup_allocate(struct vc_data *vc)
> +static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
>  {
>   int vc_num;
>  
>   vc_num = vc->vc_num;
>   if (speakup_console[vc_num] == NULL) {
>   speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
> -   GFP_ATOMIC);
> +   gfp_flags);
>   if (speakup_console[vc_num] == NULL)
>   return -ENOMEM;
>   speakup_date(vc);
> @@ -2257,7 +2257,7 @@ static int vt_notifier_call(struct notifier_block *nb,
>   switch (code) {
>   case VT_ALLOCATE:
>   if (vc->vc_mode == KD_TEXT)
> - speakup_allocate(vc);
> + speakup_allocate(vc, GFP_ATOMIC);
>   break;
>   case VT_DEALLOCATE:
>   speakup_deallocate(vc);
> @@ -2317,7 +2317,6 @@ static int __init speakup_init(void)
>  {
>   int i;
>   long err = 0;
> - struct st_spk_t *first_console;
>   struct vc_data *vc = vc_cons[fg_console].d;
>   struct var_t *var;
>  
> @@ -2342,18 +2341,9 @@ static int __init speakup_init(void)
>   if (err)
>   goto error_virtkeyboard;
>  
> - first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
> - if (!first_console) {
> - err = -ENOMEM;
> - goto error_alloc;
> - }
> -
> - speakup_console[vc->vc_num] = first_console;
> - speakup_date(vc);
> -
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   if (vc_cons[i].d) {
> - err = speakup_allocate(vc_cons[i].d);
> + err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
>   if (err)
>   goto error_kobjects;
>   }
> @@ -2412,7 +2402,6 @@ static int __init speakup_init(void)
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   kfree(speakup_console[i]);
>  
> -error_alloc:
>   speakup_remove_virtual_keyboard();
>  
>  error_virtkeyboard:
> -- 
> 2.10.2
> 

-- 
Samuel
 Créer une hiérarchie supplementaire pour remedier à un problème (?) de
 dispersion est d'une logique digne des Shadocks.
 * BT in: Guide du Cabaliste Usenet - La Cabale vote oui (les Shadocks aussi) *
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH SPEAKUP v2 1/3] return same error value from spk_set_key_info

2017-02-28 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 28 févr. 2017 13:57:53 +0530, wrote:
> This patch makes spk_set_key_info return -EINVAL
> in case of failure instead of returning 4 different
> values for the type of error that occurred.
> 
> Print the offending values instead as debug message.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/main.c | 27 +++
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index c2f70ef..a1d5b66 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1216,13 +1216,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
> *k_buffer)
>   u_char ch, version, num_keys;
>  
>   version = *cp++;
> - if (version != KEY_MAP_VER)
> - return -1;
> + if (version != KEY_MAP_VER) {
> + pr_debug("version found %d should be %d\n",
> +  version, KEY_MAP_VER);
> + return -EINVAL;
> + }
>   num_keys = *cp;
>   states = (int)cp[1];
>   key_data_len = (states + 1) * (num_keys + 1);
> - if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf))
> - return -2;
> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("too many key_infos (%d over %u)\n",
> +  key_data_len + SHIFT_TBL_SIZE + 4, (unsigned 
> int)(sizeof(spk_key_buf)));
> + return -EINVAL;
> + }
>   memset(k_buffer, 0, SHIFT_TBL_SIZE);
>   memset(spk_our_keys, 0, sizeof(spk_our_keys));
>   spk_shift_table = k_buffer;
> @@ -1233,14 +1239,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
> *k_buffer)
>   cp1 += 2;   /* now pointing at shift states */
>   for (i = 1; i <= states; i++) {
>   ch = *cp1++;
> - if (ch >= SHIFT_TBL_SIZE)
> - return -3;
> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("(%d) not valid shift state (max_allowed = 
> %d)\n", ch,
> +  SHIFT_TBL_SIZE);
> + return -EINVAL;
> + }
>   spk_shift_table[ch] = i;
>   }
>   keymap_flags = *cp1++;
>   while ((ch = *cp1)) {
> - if (ch >= MAX_KEY)
> - return -4;
> + if (ch >= MAX_KEY) {
> + pr_debug("(%d), not valid key, (max_allowed = %d)\n", 
> ch, MAX_KEY);
> + return -EINVAL;
> + }
>   spk_our_keys[ch] = cp1;
>   cp1 += states + 1;
>   }
> -- 
> 2.10.2
> 

-- 
Samuel
Progress (n.): The process through which the Internet has evolved from
smart people in front of dumb terminals to dumb people in front of smart
terminals.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH SPEAKUP v2 2/3] remove unecessary initial allocation of vc

2017-02-28 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 28 févr. 2017 13:57:54 +0530, wrote:
> This patch removes the unnecessary allocation of
> current foreground vc during initialization.
> 
> This initialization is already handled in the loop
> that follows it for all available virtual consoles.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/main.c | 11 ---
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index a1d5b66..ca817ca 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -2317,7 +2317,6 @@ static int __init speakup_init(void)
>  {
>   int i;
>   long err = 0;
> - struct st_spk_t *first_console;
>   struct vc_data *vc = vc_cons[fg_console].d;
>   struct var_t *var;
>  
> @@ -2342,15 +2341,6 @@ static int __init speakup_init(void)
>   if (err)
>   goto error_virtkeyboard;
>  
> - first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
> - if (!first_console) {
> - err = -ENOMEM;
> - goto error_alloc;
> - }
> -
> - speakup_console[vc->vc_num] = first_console;
> - speakup_date(vc);
> -
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   if (vc_cons[i].d) {
>   err = speakup_allocate(vc_cons[i].d);
> @@ -2412,7 +2402,6 @@ static int __init speakup_init(void)
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   kfree(speakup_console[i]);
>  
> -error_alloc:
>   speakup_remove_virtual_keyboard();
>  
>  error_virtkeyboard:
> -- 
> 2.10.2
> 

-- 
Samuel
 ben oui ce serait idiot, mais osb
  -+- m'en fous de faire un truc débile ! -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH SPEAKUP v2 3/3] use spkeaup_allocate as per required context

2017-02-28 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 28 févr. 2017 13:57:55 +0530, wrote:
> speakup_allocate used GFP_ATOMIC for allocations
> even while during initialization due to it's use
> in notifier call.
> 
> Pass GFP_ flags as well to speakup_allocate depending
> on the context it is called in.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/main.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index ca817ca..ede842e 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1327,14 +1327,14 @@ static int edit_bits(struct vc_data *vc, u_char type, 
> u_char ch, u_short key)
>  }
>  
>  /* Allocation concurrency is protected by the console semaphore */
> -static int speakup_allocate(struct vc_data *vc)
> +static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
>  {
>   int vc_num;
>  
>   vc_num = vc->vc_num;
>   if (speakup_console[vc_num] == NULL) {
>   speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
> -   GFP_ATOMIC);
> +   gfp_flags);
>   if (speakup_console[vc_num] == NULL)
>   return -ENOMEM;
>   speakup_date(vc);
> @@ -2257,7 +2257,7 @@ static int vt_notifier_call(struct notifier_block *nb,
>   switch (code) {
>   case VT_ALLOCATE:
>   if (vc->vc_mode == KD_TEXT)
> - speakup_allocate(vc);
> + speakup_allocate(vc, GFP_ATOMIC);
>   break;
>   case VT_DEALLOCATE:
>   speakup_deallocate(vc);
> @@ -2343,7 +2343,7 @@ static int __init speakup_init(void)
>  
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   if (vc_cons[i].d) {
> - err = speakup_allocate(vc_cons[i].d);
> + err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
>   if (err)
>   goto error_kobjects;
>   }
> -- 
> 2.10.2
> 

-- 
Samuel
(03:13:14)  bon
(03:13:19)  il est tard :p
(03:13:25)  c'est l'heure de manger
(03:13:38)  hm j'ai mangé à 1h moi, j'ai des horaires raisonnables
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 1/3] speakup: extend synth buffer to 16bit unicode characters

2017-03-01 Thread Samuel Thibault
This extends the synth buffer slots to 16bit, so as to hold 16bit
unicode characters.

synth_buffer_getc and synth_buffer_peek now return 16bit characters.
Speech synthesizers which do not support characters beyond latin1 can
use the synth_buffer_skip_nonlatin1() helper to skip the non-latin1
characters before getting or peeking. All synthesizers are made to use
it for now.

This makes synth_buffer_add take a 16bit character. For simplicity for
now, synth_printf is left to using latin1 formats and strings.
synth_putwc, synth_putwc_s, synth_putws and synth_putws_s helpers are
however added to put 16bit characters and strings.

Signed-off-by: Samuel Thibault 

Index: linux-4.10/drivers/staging/speakup/spk_priv.h
===
--- linux-4.10.orig/drivers/staging/speakup/spk_priv.h
+++ linux-4.10/drivers/staging/speakup/spk_priv.h
@@ -48,8 +48,9 @@ unsigned char spk_serial_in_nowait(void)
 int spk_serial_out(const char ch);
 void spk_serial_release(void);
 
-char synth_buffer_getc(void);
-char synth_buffer_peek(void);
+void synth_buffer_skip_nonlatin1(void);
+u16 synth_buffer_getc(void);
+u16 synth_buffer_peek(void);
 int synth_buffer_empty(void);
 struct var_t *spk_get_var(enum var_id_t var_id);
 ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr,
@@ -64,6 +65,10 @@ void spk_synth_flush(struct spk_synth *s
 int spk_synth_is_alive_nop(struct spk_synth *synth);
 int spk_synth_is_alive_restart(struct spk_synth *synth);
 void synth_printf(const char *buf, ...);
+void synth_putwc(u16 wc);
+void synth_putwc_s(u16 wc);
+void synth_putws(const u16 *buf);
+void synth_putws_s(const u16 *buf);
 int synth_request_region(u_long, u_long);
 int synth_release_region(u_long, u_long);
 int synth_add(struct spk_synth *in_synth);
Index: linux-4.10/drivers/staging/speakup/speakup.h
===
--- linux-4.10.orig/drivers/staging/speakup/speakup.h
+++ linux-4.10/drivers/staging/speakup/speakup.h
@@ -70,7 +70,7 @@ void synth_release(void);
 
 void spk_do_flush(void);
 void speakup_start_ttys(void);
-void synth_buffer_add(char ch);
+void synth_buffer_add(u16 ch);
 void synth_buffer_clear(void);
 void speakup_clear_selection(void);
 int speakup_set_selection(struct tty_struct *tty);
Index: linux-4.10/drivers/staging/speakup/synth.c
===
--- linux-4.10.orig/drivers/staging/speakup/synth.c
+++ linux-4.10/drivers/staging/speakup/synth.c
@@ -109,6 +109,7 @@ void spk_do_catch_up(struct spk_synth *s
synth->flush(synth);
continue;
}
+   synth_buffer_skip_nonlatin1();
if (synth_buffer_empty()) {
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
break;
@@ -255,6 +256,35 @@ void synth_printf(const char *fmt, ...)
 }
 EXPORT_SYMBOL_GPL(synth_printf);
 
+void synth_putwc(u16 wc)
+{
+   synth_buffer_add(wc);
+}
+EXPORT_SYMBOL_GPL(synth_putwc);
+
+void synth_putwc_s(u16 wc)
+{
+   synth_buffer_add(wc);
+   synth_start();
+}
+EXPORT_SYMBOL_GPL(synth_putwc_s);
+
+void synth_putws(const u16 *buf)
+{
+   const u16 *p;
+
+   for (p = buf; *p; p++)
+   synth_buffer_add(*p);
+}
+EXPORT_SYMBOL_GPL(synth_putws);
+
+void synth_putws_s(const u16 *buf)
+{
+   synth_putws(buf);
+   synth_start();
+}
+EXPORT_SYMBOL_GPL(synth_putws_s);
+
 static int index_count;
 static int sentence_count;
 
Index: linux-4.10/drivers/staging/speakup/buffers.c
===
--- linux-4.10.orig/drivers/staging/speakup/buffers.c
+++ linux-4.10/drivers/staging/speakup/buffers.c
@@ -7,10 +7,10 @@
 
 #define SYNTH_BUF_SIZE 8192/* currently 8K bytes */
 
-static u_char synth_buffer[SYNTH_BUF_SIZE];/* guess what this is for! */
-static u_char *buff_in = synth_buffer;
-static u_char *buff_out = synth_buffer;
-static u_char *buffer_end = synth_buffer + SYNTH_BUF_SIZE - 1;
+static u16 synth_buffer[SYNTH_BUF_SIZE];   /* guess what this is for! */
+static u16 *buff_in = synth_buffer;
+static u16 *buff_out = synth_buffer;
+static u16 *buffer_end = synth_buffer + SYNTH_BUF_SIZE - 1;
 
 /* These try to throttle applications by stopping the TTYs
  * Note: we need to make sure that we will restart them eventually, which is
@@ -44,13 +44,13 @@ static void speakup_stop_ttys(void)
 
 static int synth_buffer_free(void)
 {
-   int bytes_free;
+   int chars_free;
 
if (buff_in >= buff_out)
-   bytes_free = SYNTH_BUF_SIZE - (buff_in - buff_out);
+   chars_free = SYNTH_BUF_SIZE - (buff_in - buff_out);
else
-   bytes_free = buff_out - buff_in;
-   return bytes_free;
+   chars_free = buff_out - buff_in;
+   return chars_free;
 }
 
 int synth_buffer_empty(void)
@@ -59,7 +5

[patch 2/3] speakup: convert screen reading to 16bit characters

2017-03-01 Thread Samuel Thibault
This adds 16bit character support to most of the screen reading by
extending characters to u16 throughout the code.

Non-latin1 characters are assumed to be alphabetic type for now.

non-latin1 vt_notifier_call-provided characters are not ignored any
more, and the 16bit character returned by get_char is not truncated any
more. For simplicity, speak_char still only supports latin1 characters.
Its direct mode however does support 16bit characters, so in practice
this will not be a limitation, non-latin1 languages will be handled by
the synthesizer. spelling words does not support direct mode yet, for
simplicity for now it will ignore 16bit characters.

For simplicity again, speakup messages are left in latin1 for now.

Some coding style is fixed along the way.

Signed-off-by: Samuel Thibault 

Index: linux-4.10/drivers/staging/speakup/main.c
===
--- linux-4.10.orig/drivers/staging/speakup/main.c
+++ linux-4.10/drivers/staging/speakup/main.c
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(quiet, "Do not announce
 special_func spk_special_handler;
 
 short spk_pitch_shift, synth_flags;
-static char buf[256];
+static u16 buf[256];
 int spk_attrib_bleep, spk_bleeps, spk_bleep_time = 10;
 int spk_no_intr, spk_spell_delay;
 int spk_key_echo, spk_say_word_ctl;
@@ -112,7 +112,7 @@ enum {
 
 static struct tty_struct *tty;
 
-static void spkup_write(const char *in_buf, int count);
+static void spkup_write(const u16 *in_buf, int count);
 
 static char *phonetic[] = {
"alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel",
@@ -238,7 +238,8 @@ static u_short default_chartab[256] = {
 struct task_struct *speakup_task;
 struct bleep spk_unprocessed_sound;
 static int spk_keydown;
-static u_char spk_lastkey, spk_close_press, keymap_flags;
+static u16 spk_lastkey;
+static u_char spk_close_press, keymap_flags;
 static u_char last_keycode, this_speakup_key;
 static u_long last_spk_jiffy;
 
@@ -426,9 +427,9 @@ static void announce_edge(struct vc_data
spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1));
 }
 
-static void speak_char(u_char ch)
+static void speak_char(u16 ch)
 {
-   char *cp = spk_characters[ch];
+   char *cp;
struct var_t *direct = spk_get_var(DIRECT);
 
if (direct && direct->u.n.value) {
@@ -436,11 +437,15 @@ static void speak_char(u_char ch)
spk_pitch_shift++;
synth_printf("%s", spk_str_caps_start);
}
-   synth_printf("%c", ch);
+   synth_putwc_s(ch);
if (IS_CHAR(ch, B_CAP))
synth_printf("%s", spk_str_caps_stop);
return;
}
+
+   if (ch >= 0x100)
+   return;
+   cp = spk_characters[ch];
if (cp == NULL) {
pr_info("speak_char: cp == NULL!\n");
return;
@@ -486,7 +491,7 @@ static u16 get_char(struct vc_data *vc,
 
 static void say_char(struct vc_data *vc)
 {
-   u_short ch;
+   u16 ch;
 
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
@@ -496,20 +501,20 @@ static void say_char(struct vc_data *vc)
if (spk_attrib_bleep & 2)
say_attributes(vc);
}
-   speak_char(ch & 0xff);
+   speak_char(ch);
 }
 
 static void say_phonetic_char(struct vc_data *vc)
 {
-   u_short ch;
+   u16 ch;
 
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
-   if (isascii(ch) && isalpha(ch)) {
+   if (ch <= 0x7f && isalpha(ch)) {
ch &= 0x1f;
synth_printf("%s\n", phonetic[--ch]);
} else {
-   if (IS_CHAR(ch, B_NUM))
+   if (ch < 0x100 && IS_CHAR(ch, B_NUM))
synth_printf("%s ", spk_msg_get(MSG_NUMBER));
speak_char(ch);
}
@@ -551,42 +556,42 @@ static void say_next_char(struct vc_data
 static u_long get_word(struct vc_data *vc)
 {
u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
-   char ch;
-   u_short attr_ch;
+   u16 ch;
+   u16 attr_ch;
u_char temp;
 
spk_old_attr = spk_attr;
-   ch = (char)get_char(vc, (u_short *)tmp_pos, &temp);
+   ch = get_char(vc, (u_short *)tmp_pos, &temp);
 
 /* decided to take out the sayword if on a space (mis-information */
if (spk_say_word_ctl && ch == SPACE) {
*buf = '\0';
synth_printf("%s\n", spk_msg_get(MSG_SPACE));
return 0;
-   } else if ((tmpx < vc->vc_cols - 2)
-  && (ch == SPACE || ch == 0 || IS_WDLM(ch))
-  &&

[patch 3/3] speakup: add unicode variant of /dev/softsynth

2017-03-01 Thread Samuel Thibault
This adds /dev/softsynthu, along /dev/softsynth, which emits output in
UTF-8 encoding, thus allowing to support 16bit characters.  Most of the
code is shared, only the read function has to behave differently in
latin1 and in unicode mode.  Since Linux only supports 16bit characters,
we can just hardcode the UTF-8 encoding.

Signed-off-by: Samuel Thibault 

Index: linux-4.10/drivers/staging/speakup/speakup_soft.c
===
--- linux-4.10.orig/drivers/staging/speakup/speakup_soft.c
+++ linux-4.10/drivers/staging/speakup/speakup_soft.c
@@ -29,6 +29,7 @@
 
 #define DRV_VERSION "2.6"
 #define SOFTSYNTH_MINOR 26 /* might as well give it one more than /dev/synth */
+#define SOFTSYNTHU_MINOR 27 /* might as well give it one more than /dev/synth 
*/
 #define PROCSPEECH 0x0d
 #define CLEAR_SYNTH 0x18
 
@@ -37,7 +38,7 @@ static void softsynth_release(void);
 static int softsynth_is_alive(struct spk_synth *synth);
 static unsigned char get_index(void);
 
-static struct miscdevice synth_device;
+static struct miscdevice synth_device, synthu_device;
 static int init_pos;
 static int misc_registered;
 
@@ -199,13 +200,13 @@ static int softsynth_close(struct inode
return 0;
 }
 
-static ssize_t softsynth_read(struct file *fp, char __user *buf, size_t count,
- loff_t *pos)
+static ssize_t softsynthx_read(struct file *fp, char __user *buf, size_t count,
+  loff_t *pos, int unicode)
 {
int chars_sent = 0;
char __user *cp;
char *init;
-   char ch;
+   u16 ch;
int empty;
unsigned long flags;
DEFINE_WAIT(wait);
@@ -213,7 +214,8 @@ static ssize_t softsynth_read(struct fil
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (1) {
prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
-   synth_buffer_skip_nonlatin1();
+   if (!unicode)
+   synth_buffer_skip_nonlatin1();
if (!synth_buffer_empty() || speakup_info.flushing)
break;
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
@@ -232,23 +234,57 @@ static ssize_t softsynth_read(struct fil
 
cp = buf;
init = get_initstring();
-   while (chars_sent < count) {
+
+   /* Keep 3 bytes available for a 16bit UTF-8-encoded character */
+   while (chars_sent <= count - 3) {
if (speakup_info.flushing) {
speakup_info.flushing = 0;
ch = '\x18';
-   } else if (synth_buffer_empty()) {
-   break;
} else if (init[init_pos]) {
ch = init[init_pos++];
} else {
+   if (!unicode)
+   synth_buffer_skip_nonlatin1();
+   if (synth_buffer_empty())
+   break;
ch = synth_buffer_getc();
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
-   if (copy_to_user(cp, &ch, 1))
-   return -EFAULT;
+
+   if ((!unicode && ch < 0x100) || (unicode && ch < 0x80)) {
+   u_char c = ch;
+
+   if (copy_to_user(cp, &c, 1))
+   return -EFAULT;
+
+   chars_sent++;
+   cp++;
+   } else if (unicode && ch < 0x800) {
+   u_char s[2] = {
+   0xc0 | (ch >> 6),
+   0x80 | (ch & 0x3f)
+   };
+
+   if (copy_to_user(cp, s, sizeof(s)))
+   return -EFAULT;
+
+   chars_sent += sizeof(s);
+   cp += sizeof(s);
+   } else if (unicode) {
+   u_char s[3] = {
+   0xe0 | (ch >> 12),
+   0x80 | ((ch >> 6) & 0x3f),
+   0x80 | (ch & 0x3f)
+   };
+
+   if (copy_to_user(cp, s, sizeof(s)))
+   return -EFAULT;
+
+   chars_sent += sizeof(s);
+   cp += sizeof(s);
+   }
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
-   chars_sent++;
-   cp++;
}
*pos += chars_sent;
empty = synth_buffer_empty();
@@ -260,6 +296,18 @@ static ssize_t softsynth_read(struct fil
return chars_sent;
 }
 
+static ssize_t softsynth_read(struct file *fp, char __user *buf, size_t count,
+ loff_t *pos)
+{
+   return soft

[patch 0/3] speakup: support 16bit unicode screen reading

2017-03-01 Thread Samuel Thibault
Hello,

This patch series adds 16bit unicode support to speakup, through three
patches:

- extend synth buffer to 16bit unicode characters
- convert screen reading to 16bit characters
- add unicode variant of /dev/softsynth

Samuel

-- 
Samuel
 hm. I've lost a machine.. literally _lost_. it responds to ping, it 
works completely, I just can't figure out where in my apartment it is.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: replace simple_strtoul with kstrtou8

2017-03-02 Thread Samuel Thibault
Marcin Ciupak, on jeu. 02 mars 2017 15:28:23 +0100, wrote:
> - int val;
> + int ret;
>  
> - val = simple_strtoul(skip_spaces(start), &start, 10);
> + ret = kstrtou8(skip_spaces(start), 10, dest);

This is not the same, you need to have start properly move, since it's
used below:

>   if (*start == ',')
>   start++;
> - *dest = (u_char)val;
>   return start;

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 2/3] speakup: convert screen reading to 16bit characters

2017-03-04 Thread Samuel Thibault
This adds 16bit character support to most of the screen reading by
extending characters to u16 throughout the code.

Non-latin1 characters are assumed to be alphabetic type for now.

non-latin1 vt_notifier_call-provided characters are not ignored any
more, and the 16bit character returned by get_char is not truncated any
more. For simplicity, speak_char still only supports latin1 characters.
Its direct mode however does support 16bit characters, so in practice
this will not be a limitation, non-latin1 languages will be handled by
the synthesizer. spelling words does not support direct mode yet, for
simplicity for now it will ignore 16bit characters.

For simplicity again, speakup messages are left in latin1 for now.

Some coding style is fixed along the way.

Signed-off-by: Samuel Thibault 
Reviewed-by: Okash Khawaja 

Index: linux-4.10/drivers/staging/speakup/main.c
===
--- linux-4.10.orig/drivers/staging/speakup/main.c
+++ linux-4.10/drivers/staging/speakup/main.c
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(quiet, "Do not announce
 special_func spk_special_handler;
 
 short spk_pitch_shift, synth_flags;
-static char buf[256];
+static u16 buf[256];
 int spk_attrib_bleep, spk_bleeps, spk_bleep_time = 10;
 int spk_no_intr, spk_spell_delay;
 int spk_key_echo, spk_say_word_ctl;
@@ -112,7 +112,7 @@ enum {
 
 static struct tty_struct *tty;
 
-static void spkup_write(const char *in_buf, int count);
+static void spkup_write(const u16 *in_buf, int count);
 
 static char *phonetic[] = {
"alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel",
@@ -238,7 +238,8 @@ static u_short default_chartab[256] = {
 struct task_struct *speakup_task;
 struct bleep spk_unprocessed_sound;
 static int spk_keydown;
-static u_char spk_lastkey, spk_close_press, keymap_flags;
+static u16 spk_lastkey;
+static u_char spk_close_press, keymap_flags;
 static u_char last_keycode, this_speakup_key;
 static u_long last_spk_jiffy;
 
@@ -426,9 +427,9 @@ static void announce_edge(struct vc_data
spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1));
 }
 
-static void speak_char(u_char ch)
+static void speak_char(u16 ch)
 {
-   char *cp = spk_characters[ch];
+   char *cp;
struct var_t *direct = spk_get_var(DIRECT);
 
if (direct && direct->u.n.value) {
@@ -436,11 +437,15 @@ static void speak_char(u_char ch)
spk_pitch_shift++;
synth_printf("%s", spk_str_caps_start);
}
-   synth_printf("%c", ch);
+   synth_putwc_s(ch);
if (IS_CHAR(ch, B_CAP))
synth_printf("%s", spk_str_caps_stop);
return;
}
+
+   if (ch >= 0x100)
+   return;
+   cp = spk_characters[ch];
if (cp == NULL) {
pr_info("speak_char: cp == NULL!\n");
return;
@@ -486,7 +491,7 @@ static u16 get_char(struct vc_data *vc,
 
 static void say_char(struct vc_data *vc)
 {
-   u_short ch;
+   u16 ch;
 
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
@@ -496,20 +501,20 @@ static void say_char(struct vc_data *vc)
if (spk_attrib_bleep & 2)
say_attributes(vc);
}
-   speak_char(ch & 0xff);
+   speak_char(ch);
 }
 
 static void say_phonetic_char(struct vc_data *vc)
 {
-   u_short ch;
+   u16 ch;
 
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
-   if (isascii(ch) && isalpha(ch)) {
+   if (ch <= 0x7f && isalpha(ch)) {
ch &= 0x1f;
synth_printf("%s\n", phonetic[--ch]);
} else {
-   if (IS_CHAR(ch, B_NUM))
+   if (ch < 0x100 && IS_CHAR(ch, B_NUM))
synth_printf("%s ", spk_msg_get(MSG_NUMBER));
speak_char(ch);
}
@@ -551,42 +556,42 @@ static void say_next_char(struct vc_data
 static u_long get_word(struct vc_data *vc)
 {
u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
-   char ch;
-   u_short attr_ch;
+   u16 ch;
+   u16 attr_ch;
u_char temp;
 
spk_old_attr = spk_attr;
-   ch = (char)get_char(vc, (u_short *)tmp_pos, &temp);
+   ch = get_char(vc, (u_short *)tmp_pos, &temp);
 
 /* decided to take out the sayword if on a space (mis-information */
if (spk_say_word_ctl && ch == SPACE) {
*buf = '\0';
synth_printf("%s\n", spk_msg_get(MSG_SPACE));
return 0;
-   } else if ((tmpx < vc->vc_cols - 2)
-  && (ch == SPACE || ch == 0 || IS_WDLM(ch))
-  

[patch 3/3] speakup: add unicode variant of /dev/softsynth

2017-03-04 Thread Samuel Thibault
This adds /dev/softsynthu, along /dev/softsynth, which emits output in
UTF-8 encoding, thus allowing to support 16bit characters.  Most of the
code is shared, only the read function has to behave differently in
latin1 and in unicode mode.  Since Linux only supports 16bit characters,
we can just hardcode the UTF-8 encoding.

Signed-off-by: Samuel Thibault 
Reviewed-by: Chris Brannon 

Index: linux-4.10/drivers/staging/speakup/speakup_soft.c
===
--- linux-4.10.orig/drivers/staging/speakup/speakup_soft.c
+++ linux-4.10/drivers/staging/speakup/speakup_soft.c
@@ -29,6 +29,7 @@
 
 #define DRV_VERSION "2.6"
 #define SOFTSYNTH_MINOR 26 /* might as well give it one more than /dev/synth */
+#define SOFTSYNTHU_MINOR 27 /* might as well give it one more than /dev/synth 
*/
 #define PROCSPEECH 0x0d
 #define CLEAR_SYNTH 0x18
 
@@ -37,7 +38,7 @@ static void softsynth_release(void);
 static int softsynth_is_alive(struct spk_synth *synth);
 static unsigned char get_index(void);
 
-static struct miscdevice synth_device;
+static struct miscdevice synth_device, synthu_device;
 static int init_pos;
 static int misc_registered;
 
@@ -199,13 +200,13 @@ static int softsynth_close(struct inode
return 0;
 }
 
-static ssize_t softsynth_read(struct file *fp, char __user *buf, size_t count,
- loff_t *pos)
+static ssize_t softsynthx_read(struct file *fp, char __user *buf, size_t count,
+  loff_t *pos, int unicode)
 {
int chars_sent = 0;
char __user *cp;
char *init;
-   char ch;
+   u16 ch;
int empty;
unsigned long flags;
DEFINE_WAIT(wait);
@@ -213,7 +214,8 @@ static ssize_t softsynth_read(struct fil
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (1) {
prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
-   synth_buffer_skip_nonlatin1();
+   if (!unicode)
+   synth_buffer_skip_nonlatin1();
if (!synth_buffer_empty() || speakup_info.flushing)
break;
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
@@ -232,23 +234,57 @@ static ssize_t softsynth_read(struct fil
 
cp = buf;
init = get_initstring();
-   while (chars_sent < count) {
+
+   /* Keep 3 bytes available for a 16bit UTF-8-encoded character */
+   while (chars_sent <= count - 3) {
if (speakup_info.flushing) {
speakup_info.flushing = 0;
ch = '\x18';
-   } else if (synth_buffer_empty()) {
-   break;
} else if (init[init_pos]) {
ch = init[init_pos++];
} else {
+   if (!unicode)
+   synth_buffer_skip_nonlatin1();
+   if (synth_buffer_empty())
+   break;
ch = synth_buffer_getc();
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
-   if (copy_to_user(cp, &ch, 1))
-   return -EFAULT;
+
+   if ((!unicode && ch < 0x100) || (unicode && ch < 0x80)) {
+   u_char c = ch;
+
+   if (copy_to_user(cp, &c, 1))
+   return -EFAULT;
+
+   chars_sent++;
+   cp++;
+   } else if (unicode && ch < 0x800) {
+   u_char s[2] = {
+   0xc0 | (ch >> 6),
+   0x80 | (ch & 0x3f)
+   };
+
+   if (copy_to_user(cp, s, sizeof(s)))
+   return -EFAULT;
+
+   chars_sent += sizeof(s);
+   cp += sizeof(s);
+   } else if (unicode) {
+   u_char s[3] = {
+   0xe0 | (ch >> 12),
+   0x80 | ((ch >> 6) & 0x3f),
+   0x80 | (ch & 0x3f)
+   };
+
+   if (copy_to_user(cp, s, sizeof(s)))
+   return -EFAULT;
+
+   chars_sent += sizeof(s);
+   cp += sizeof(s);
+   }
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
-   chars_sent++;
-   cp++;
}
*pos += chars_sent;
empty = synth_buffer_empty();
@@ -260,6 +296,18 @@ static ssize_t softsynth_read(struct fil
return chars_sent;
 }
 
+static ssize_t softsynth_read(struct file *fp, char __user *buf, size_t count,
+ loff_t *pos)
+{
+

[patch 0/3] speakup: support 16bit unicode screen reading

2017-03-04 Thread Samuel Thibault
Hello,

This patch series adds 16bit unicode support to speakup, through three
patches:

- extend synth buffer to 16bit unicode characters
- convert screen reading to 16bit characters
- add unicode variant of /dev/softsynth

Samuel

-- 
Samuel
"...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and
the Ugly)."
(By Matt Welsh)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 1/3] speakup: extend synth buffer to 16bit unicode characters

2017-03-04 Thread Samuel Thibault
This extends the synth buffer slots to 16bit, so as to hold 16bit
unicode characters.

synth_buffer_getc and synth_buffer_peek now return 16bit characters.
Speech synthesizers which do not support characters beyond latin1 can
use the synth_buffer_skip_nonlatin1() helper to skip the non-latin1
characters before getting or peeking. All synthesizers are made to use
it for now.

This makes synth_buffer_add take a 16bit character. For simplicity for
now, synth_printf is left to using latin1 formats and strings.
synth_putwc, synth_putwc_s, synth_putws and synth_putws_s helpers are
however added to put 16bit characters and strings.

Signed-off-by: Samuel Thibault 
Reviewed-by: Chris Brannon 

Index: linux-4.10/drivers/staging/speakup/spk_priv.h
===
--- linux-4.10.orig/drivers/staging/speakup/spk_priv.h
+++ linux-4.10/drivers/staging/speakup/spk_priv.h
@@ -48,8 +48,9 @@ unsigned char spk_serial_in_nowait(void)
 int spk_serial_out(const char ch);
 void spk_serial_release(void);
 
-char synth_buffer_getc(void);
-char synth_buffer_peek(void);
+void synth_buffer_skip_nonlatin1(void);
+u16 synth_buffer_getc(void);
+u16 synth_buffer_peek(void);
 int synth_buffer_empty(void);
 struct var_t *spk_get_var(enum var_id_t var_id);
 ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr,
@@ -64,6 +65,10 @@ void spk_synth_flush(struct spk_synth *s
 int spk_synth_is_alive_nop(struct spk_synth *synth);
 int spk_synth_is_alive_restart(struct spk_synth *synth);
 void synth_printf(const char *buf, ...);
+void synth_putwc(u16 wc);
+void synth_putwc_s(u16 wc);
+void synth_putws(const u16 *buf);
+void synth_putws_s(const u16 *buf);
 int synth_request_region(u_long, u_long);
 int synth_release_region(u_long, u_long);
 int synth_add(struct spk_synth *in_synth);
Index: linux-4.10/drivers/staging/speakup/speakup.h
===
--- linux-4.10.orig/drivers/staging/speakup/speakup.h
+++ linux-4.10/drivers/staging/speakup/speakup.h
@@ -70,7 +70,7 @@ void synth_release(void);
 
 void spk_do_flush(void);
 void speakup_start_ttys(void);
-void synth_buffer_add(char ch);
+void synth_buffer_add(u16 ch);
 void synth_buffer_clear(void);
 void speakup_clear_selection(void);
 int speakup_set_selection(struct tty_struct *tty);
Index: linux-4.10/drivers/staging/speakup/synth.c
===
--- linux-4.10.orig/drivers/staging/speakup/synth.c
+++ linux-4.10/drivers/staging/speakup/synth.c
@@ -109,6 +109,7 @@ void spk_do_catch_up(struct spk_synth *s
synth->flush(synth);
continue;
}
+   synth_buffer_skip_nonlatin1();
if (synth_buffer_empty()) {
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
break;
@@ -255,6 +256,35 @@ void synth_printf(const char *fmt, ...)
 }
 EXPORT_SYMBOL_GPL(synth_printf);
 
+void synth_putwc(u16 wc)
+{
+   synth_buffer_add(wc);
+}
+EXPORT_SYMBOL_GPL(synth_putwc);
+
+void synth_putwc_s(u16 wc)
+{
+   synth_buffer_add(wc);
+   synth_start();
+}
+EXPORT_SYMBOL_GPL(synth_putwc_s);
+
+void synth_putws(const u16 *buf)
+{
+   const u16 *p;
+
+   for (p = buf; *p; p++)
+   synth_buffer_add(*p);
+}
+EXPORT_SYMBOL_GPL(synth_putws);
+
+void synth_putws_s(const u16 *buf)
+{
+   synth_putws(buf);
+   synth_start();
+}
+EXPORT_SYMBOL_GPL(synth_putws_s);
+
 static int index_count;
 static int sentence_count;
 
Index: linux-4.10/drivers/staging/speakup/buffers.c
===
--- linux-4.10.orig/drivers/staging/speakup/buffers.c
+++ linux-4.10/drivers/staging/speakup/buffers.c
@@ -7,10 +7,10 @@
 
 #define SYNTH_BUF_SIZE 8192/* currently 8K bytes */
 
-static u_char synth_buffer[SYNTH_BUF_SIZE];/* guess what this is for! */
-static u_char *buff_in = synth_buffer;
-static u_char *buff_out = synth_buffer;
-static u_char *buffer_end = synth_buffer + SYNTH_BUF_SIZE - 1;
+static u16 synth_buffer[SYNTH_BUF_SIZE];   /* guess what this is for! */
+static u16 *buff_in = synth_buffer;
+static u16 *buff_out = synth_buffer;
+static u16 *buffer_end = synth_buffer + SYNTH_BUF_SIZE - 1;
 
 /* These try to throttle applications by stopping the TTYs
  * Note: we need to make sure that we will restart them eventually, which is
@@ -44,13 +44,13 @@ static void speakup_stop_ttys(void)
 
 static int synth_buffer_free(void)
 {
-   int bytes_free;
+   int chars_free;
 
if (buff_in >= buff_out)
-   bytes_free = SYNTH_BUF_SIZE - (buff_in - buff_out);
+   chars_free = SYNTH_BUF_SIZE - (buff_in - buff_out);
else
-   bytes_free = buff_out - buff_in;
-   return bytes_free;
+   chars_free = buff_out - buff_in;
+   return chars_free;
 }
 
 int synth_buffer_

Re: [patch 0/3] speakup: support 16bit unicode screen reading

2017-03-09 Thread Samuel Thibault
Greg KH, on jeu. 09 mars 2017 17:25:51 +0100, wrote:
> This is the second version of this series, correct?  Next time, please
> put a "v2" in them so that I know which to apply.

Ah, yes, sorry. The only difference was the Reviewed-by lines.

Thanks!
Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 0/2] speakup: unicode fixes

2017-03-11 Thread Samuel Thibault
Hello,

This patch series fixes a couple of issues of the previous "support 16bit
unicode screen reading" series:

- fix infinite loop on word spelling
- actually get unicode characters when reviewing console text.

Samuel

-- 
Samuel
How do I type "for i in *.dvi do xdvi i done" in a GUI?
(Discussion in comp.os.linux.misc on the intuitiveness of interfaces.)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 2/2] speakup: make get_char actually get unicode characters

2017-03-11 Thread Samuel Thibault
9831013cbdbd3d06430a1db01d8c32d50c7d1c04 ('speakup: convert screen reading to
16bit characters') paved the way for handling unicode characters in speakup, but
for the review mode, it missed actually getting unicode characters from the VC. 
This fixes by just turning the use_unicode parameter to 1.

Reported-by: Zahari Yurukov 
Signed-off-by: Samuel Thibault 
Tested-by: Zahari Yurukov 

Index: linux-2.6/drivers/staging/speakup/main.c
===
--- linux-2.6.orig/drivers/staging/speakup/main.c
+++ linux-2.6/drivers/staging/speakup/main.c
@@ -483,7 +483,7 @@ static u16 get_char(struct vc_data *vc,
c |= 0x100;
}
 
-   ch = inverse_translate(vc, c, 0);
+   ch = inverse_translate(vc, c, 1);
*attribs = (w & 0xff00) >> 8;
}
return ch;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 1/2] speakup: Fix hang on spelling words with non-latin1 characters

2017-03-11 Thread Samuel Thibault
9831013cbdbd3d06430a1db01d8c32d50c7d1c04 ('speakup: convert screen reading to
16bit characters') made spell_word() ignore non-latin1 characters now read from
the VC, but it missed actually skipping them, leading to an infinite loop. This 
fixes it by just advancing the unicode character pointer.

Reported-by: Zahari Yurukov 
Signed-off-by: Samuel Thibault 
Tested-by: Zahari Yurukov 

Index: linux-2.6/drivers/staging/speakup/main.c
===
--- linux-2.6.orig/drivers/staging/speakup/main.c
+++ linux-2.6/drivers/staging/speakup/main.c
@@ -718,8 +718,11 @@ static void spell_word(struct vc_data *v
return;
while ((ch = *cp)) {
if (ch >= 0x100)
+   {
/* FIXME */
+   cp++;
continue;
+   }
if (cp != buf)
synth_printf(" %s ", delay_str[spk_spell_delay]);
if (IS_CHAR(ch, B_CAP)) {

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 1/2] speakup: make get_char actually get unicode characters

2017-03-12 Thread Samuel Thibault
9831013cbdbd3d06430a1db01d8c32d50c7d1c04 ('speakup: convert screen reading to
16bit characters') paved the way for handling unicode characters in speakup, but
for the review mode, it missed actually getting unicode characters from the VC. 
This fixes by just turning the use_unicode parameter to 1.

Signed-off-by: Samuel Thibault 
Tested-by: Zahari Yurukov 

Index: linux-2.6/drivers/staging/speakup/main.c
===
--- linux-2.6.orig/drivers/staging/speakup/main.c
+++ linux-2.6/drivers/staging/speakup/main.c
@@ -483,7 +483,7 @@ static u16 get_char(struct vc_data *vc,
c |= 0x100;
}
 
-   ch = inverse_translate(vc, c, 0);
+   ch = inverse_translate(vc, c, 1);
*attribs = (w & 0xff00) >> 8;
}
return ch;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 2/2] speakup: Support spelling unicode characters

2017-03-12 Thread Samuel Thibault
This supports spelling unicode characters by just passing them to
the speech synthesis in direct mode.

Signed-off-by: Samuel Thibault 

Index: linux-4.10/drivers/staging/speakup/main.c
===
--- linux-4.10.orig/drivers/staging/speakup/main.c
+++ linux-4.10/drivers/staging/speakup/main.c
@@ -432,7 +432,7 @@ static void speak_char(u16 ch)
char *cp;
struct var_t *direct = spk_get_var(DIRECT);
 
-   if (direct && direct->u.n.value) {
+   if (ch >= 0x100 || (direct && direct->u.n.value)) {
if (IS_CHAR(ch, B_CAP)) {
spk_pitch_shift++;
synth_printf("%s", spk_str_caps_start);
@@ -443,8 +443,6 @@ static void speak_char(u16 ch)
return;
}
 
-   if (ch >= 0x100)
-   return;
cp = spk_characters[ch];
if (cp == NULL) {
pr_info("speak_char: cp == NULL!\n");
@@ -712,17 +710,16 @@ static void spell_word(struct vc_data *v
char *cp1;
char *str_cap = spk_str_caps_stop;
char *last_cap = spk_str_caps_stop;
+   struct var_t *direct = spk_get_var(DIRECT);
u16 ch;
 
if (!get_word(vc))
return;
while ((ch = *cp)) {
-   if (ch >= 0x100)
-   /* FIXME */
-   continue;
if (cp != buf)
synth_printf(" %s ", delay_str[spk_spell_delay]);
-   if (IS_CHAR(ch, B_CAP)) {
+   /* FIXME: Non-latin1 considered as lower case */
+   if (ch < 0x100 && IS_CHAR(ch, B_CAP)) {
str_cap = spk_str_caps_start;
if (*spk_str_caps_stop)
spk_pitch_shift++;
@@ -734,18 +731,21 @@ static void spell_word(struct vc_data *v
synth_printf("%s", str_cap);
last_cap = str_cap;
}
-   if (this_speakup_key == SPELL_PHONETIC &&
+   if (ch >= 0x100 || (direct && direct->u.n.value)) {
+   synth_putwc_s(ch);
+   } else if (this_speakup_key == SPELL_PHONETIC &&
ch <= 0x7f && isalpha(ch)) {
ch &= 0x1f;
cp1 = phonetic[--ch];
+   synth_printf("%s", cp1);
} else {
cp1 = spk_characters[ch];
if (*cp1 == '^') {
synth_printf("%s", spk_msg_get(MSG_CTRL));
cp1++;
}
+   synth_printf("%s", cp1);
}
-   synth_printf("%s", cp1);
cp++;
}
if (str_cap != spk_str_caps_stop)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 0/2] speakup: unicode fixes

2017-03-12 Thread Samuel Thibault
Hello,

This patch series fixes a couple of issues of the previous "support 16bit
unicode screen reading" series:

- actually get unicode characters when reviewing console text.
- fix unicode character spelling

Samuel

-- 
Samuel
 CN > J'ai enseigné l'algorythmique.
 GLG> C'est quoi l'algorythmique ? Une contrebasse programmée en Algol ?
 -+- in : Guide du Neuneu d'Usenet - Neuneu fait ses gammes. -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 1/2] speakup: Fix hang on spelling words with non-latin1 characters

2017-03-13 Thread Samuel Thibault
Dan Carpenter, on lun. 13 mars 2017 15:46:34 +0300, wrote:
> Run your patches through scripts/checkpatch.pl

D'oh. For such a small patch, I didn't bother doing it indeed. Anyway,
that's superseded by version 2 I have submitted (speakup: Support
spelling unicode characters)

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-13 Thread Samuel Thibault
Hello,

Greg KH, on mar. 14 mars 2017 06:14:04 +0800, wrote:
> On Mon, Mar 13, 2017 at 10:05:51PM +, okash.khaw...@gmail.com wrote:
> > This patchset introduces a TTY-based way for the synths to communicate
> > with devices as an alternate for direct serial comms used by the synths
> > at the moment. It then migrates some of the synths to the TTY-based
> > comms. Synths migrated in this patchset are dummy, acntsa, bns and
> > txprt.
> 
> What about using the serbus code that is now in the tree?

I guess you mean serdev?

Well, for a start that didn't exist when Okash worked on the TTY part :)

> That should make this a lot easier than your patchset from what I can
> see.

Will serdev support modem line control?  We need this for some devices.
How is the serial port chosen with serdev?

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-13 Thread Samuel Thibault
Greg KH, on mar. 14 mars 2017 07:43:03 +0800, wrote:
> > Well, for a start that didn't exist when Okash worked on the TTY part :)
> 
> Fair enough, but it has been discussed for many months now on the
> linux-serial mailing list.

I have not had time for years to actually work on this subject, so I've
had even less time to follow linux-serial :) (and Okash, who actually
got the time to do the work, is very new to all this).

> > > That should make this a lot easier than your patchset from what I can
> > > see.
> > 
> > Will serdev support modem line control?  We need this for some devices.
> > How is the serial port chosen with serdev?
> 
> Best asked on the linux-serial mailing list :)

Let's discuss there, then.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-13 Thread Samuel Thibault
Samuel Thibault, on lun. 13 mars 2017 23:26:08 +0100, wrote:
> > That should make this a lot easier than your patchset from what I can
> > see.
> 
> Will serdev support modem line control?  We need this for some devices.

"serdev: add serdev_device_set_rts" seems to be saying yes :)

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-13 Thread Samuel Thibault
Hello Okash,

I'd say for a start already, rebase and submit patches 2-5, since they
are refactoring that makes sense anyway. And we can discuss about serdev
while that gets integrated, and thus serdev-equivalents of patches 1 and
6 will then be immediatetly applicable.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-13 Thread Samuel Thibault
Hello,

Greg KH, on mar. 14 mars 2017 06:14:04 +0800, wrote:
> On Mon, Mar 13, 2017 at 10:05:51PM +, okash.khaw...@gmail.com wrote:
> > This patchset introduces a TTY-based way for the synths to communicate
> > with devices as an alternate for direct serial comms used by the synths
> > at the moment. It then migrates some of the synths to the TTY-based
> > comms. Synths migrated in this patchset are dummy, acntsa, bns and
> > txprt.
> 
> What about using the serbus code that is now in the tree?  That should
> make this a lot easier than your patchset from what I can see.

Mmm... AIUI from reading tty_port_register_device_attr, one
would have to have registered a speakup serdev device driver
*before* tty_port_register_device_attr gets called, so that
serdev_tty_port_register matches the driver in the loop of
of_serdev_register_devices, and no TTY cdev is created?

That would mean that speakup can not be loaded as a module after ttyS0
initialization, that won't fly for our use needs. The line discipline
mechanism allows us to attach ourself to an existing tty.  Could we
imagine a tty_port function which removes the cdev and tries to register
the tty port again to serdev?

What we basically need to be able to say on speakup module load is
e.g. "I'm now attaching a device to ttyS0, use this serdev_device_ops to
discuss with it".

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-13 Thread Samuel Thibault
Samuel Thibault, on mar. 14 mars 2017 01:47:01 +0100, wrote:
> Greg KH, on mar. 14 mars 2017 06:14:04 +0800, wrote:
> > On Mon, Mar 13, 2017 at 10:05:51PM +, okash.khaw...@gmail.com wrote:
> > > This patchset introduces a TTY-based way for the synths to communicate
> > > with devices as an alternate for direct serial comms used by the synths
> > > at the moment. It then migrates some of the synths to the TTY-based
> > > comms. Synths migrated in this patchset are dummy, acntsa, bns and
> > > txprt.
> > 
> > What about using the serbus code that is now in the tree?  That should
> > make this a lot easier than your patchset from what I can see.
> 
> Mmm... AIUI from reading tty_port_register_device_attr, one
> would have to have registered a speakup serdev device driver
> *before* tty_port_register_device_attr gets called, so that
> serdev_tty_port_register matches the driver in the loop of
> of_serdev_register_devices, and no TTY cdev is created?
> 
> That would mean that speakup can not be loaded as a module after ttyS0
> initialization, that won't fly for our use needs. The line discipline
> mechanism allows us to attach ourself to an existing tty.  Could we
> imagine a tty_port function which removes the cdev and tries to register
> the tty port again to serdev?
> 
> What we basically need to be able to say on speakup module load is
> e.g. "I'm now attaching a device to ttyS0, use this serdev_device_ops to
> discuss with it".

That for_each_available_child_of_node loop is really way more complex
than what we need.  And what's more, it's not working without CONFIG_OF
(!)

It would really make sense to me to have a

serdev_device *tty_port_register_serdev_device(tty, device)

which unregisters the character device of the tty, and creates instead a
controler with the given device plugged to it. Really much like a line
discipline, but way simpler :)

The issue that remains is the "tty" part: we'd need there the tty_port,
the parent device, the tty driver, the idx. All we know when we load
speakup is "ttyS0". That's where going through the cdev to attach a line
discipline was simpler :)

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] speakup: Fix bogus caps on speaking unicode characters

2017-03-14 Thread Samuel Thibault
commit 33590c185299 ("speakup: Support spelling unicode characters")
mistakenly passed unicode characters to IS_CHAR(), which only
supports latin1.  Let's assume non-latin1 is lower case, like is done
in spell_word().

Signed-off-by: Samuel Thibault 

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index dc07b23..6f15957 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -433,12 +433,12 @@ static void speak_char(u16 ch)
struct var_t *direct = spk_get_var(DIRECT);
 
if (ch >= 0x100 || (direct && direct->u.n.value)) {
-   if (IS_CHAR(ch, B_CAP)) {
+   if (ch < 0x100 && IS_CHAR(ch, B_CAP)) {
spk_pitch_shift++;
synth_printf("%s", spk_str_caps_start);
}
synth_putwc_s(ch);
-   if (IS_CHAR(ch, B_CAP))
+   if (ch < 0x100 && IS_CHAR(ch, B_CAP))
synth_printf("%s", spk_str_caps_stop);
return;
}
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv2 2/2] speakup: Support spelling unicode characters

2017-03-14 Thread Samuel Thibault
Chris Brannon, on mar. 14 mars 2017 09:06:36 -0700, wrote:
> This is going to misidentify some Unicode characters >= 0x100 as
> capital.  You probably want to add ch < 0x100 tests to the if

Indeed, I've submitted a correction, thanks!

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-15 Thread Samuel Thibault
Rob Herring, on mer. 15 mars 2017 09:45:59 -0500, wrote:
> On Mon, Mar 13, 2017 at 8:18 PM, Samuel Thibault
>  wrote:
> > Samuel Thibault, on mar. 14 mars 2017 01:47:01 +0100, wrote:
> >> Greg KH, on mar. 14 mars 2017 06:14:04 +0800, wrote:
> >> > On Mon, Mar 13, 2017 at 10:05:51PM +, okash.khaw...@gmail.com wrote:
> >> > > This patchset introduces a TTY-based way for the synths to communicate
> >> > > with devices as an alternate for direct serial comms used by the synths
> >> > > at the moment. It then migrates some of the synths to the TTY-based
> >> > > comms. Synths migrated in this patchset are dummy, acntsa, bns and
> >> > > txprt.
> >> >
> >> > What about using the serbus code that is now in the tree?  That should
> >> > make this a lot easier than your patchset from what I can see.
> >>
> >> Mmm... AIUI from reading tty_port_register_device_attr, one
> >> would have to have registered a speakup serdev device driver
> >> *before* tty_port_register_device_attr gets called, so that
> >> serdev_tty_port_register matches the driver in the loop of
> >> of_serdev_register_devices, and no TTY cdev is created?
> 
> Not exactly. The driver doesn't have to be registered nor loaded, but
> the device does have to be present so no tty cdev is created. The only
> way a device is present currently is when a node is in the DT. I
> expect the x86 folks will be adding ACPI support soon.

Ok, but in our case there is no hardware device that the system can
see/probe, it's just plugged externally.

> >> That would mean that speakup can not be loaded as a module after ttyS0
> >> initialization, that won't fly for our use needs. The line discipline
> >> mechanism allows us to attach ourself to an existing tty.  Could we
> >> imagine a tty_port function which removes the cdev and tries to register
> >> the tty port again to serdev?
> >>
> >> What we basically need to be able to say on speakup module load is
> >> e.g. "I'm now attaching a device to ttyS0, use this serdev_device_ops to
> >> discuss with it".
> >
> > That for_each_available_child_of_node loop is really way more complex
> > than what we need.  And what's more, it's not working without CONFIG_OF
> > (!)
> >
> > It would really make sense to me to have a
> >
> > serdev_device *tty_port_register_serdev_device(tty, device)
> >
> > which unregisters the character device of the tty, and creates instead a
> > controler with the given device plugged to it. Really much like a line
> > discipline, but way simpler :)
> 
> What would trigger calling this function?

>From the user point of view, loading the speakup module for the external
device, typically, with "ttyS0" as module parameter. Then the speakup
init function can do whatever it needs to achieve this :)

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-16 Thread Samuel Thibault
Hello,

Also, could serdev also provide an send_xchar function similar to the
send_xchar tty driver function?  We need this to send high-priority
characters.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] speakup: Fix spurious space pronunciation on spelling letters

2017-03-21 Thread Samuel Thibault
This gathers emitting the caps start string, space, spelled letter
string, space, and caps stop string, into one printf, to avoid
sending to the synth a space character alone, which the synth would
then pronounce.

Similarly, emit space along control-letter and letter spelling.

Signed-off-by: Samuel Thibault 
Tested-by: Zahari Yurukov 

Index: linux-4.10/drivers/staging/speakup/main.c
===
--- linux-4.10.orig/drivers/staging/speakup/main.c
+++ linux-4.10/drivers/staging/speakup/main.c
@@ -448,20 +448,17 @@ static void speak_char(u16 ch)
pr_info("speak_char: cp == NULL!\n");
return;
}
-   synth_buffer_add(SPACE);
if (IS_CHAR(ch, B_CAP)) {
spk_pitch_shift++;
-   synth_printf("%s", spk_str_caps_start);
-   synth_printf("%s", cp);
-   synth_printf("%s", spk_str_caps_stop);
+   synth_printf("%s %s %s",
+spk_str_caps_start, cp, spk_str_caps_stop);
} else {
if (*cp == '^') {
-   synth_printf("%s", spk_msg_get(MSG_CTRL));
cp++;
-   }
-   synth_printf("%s", cp);
+   synth_printf(" %s%s ", spk_msg_get(MSG_CTRL), cp);
+   } else
+   synth_printf(" %s ", cp);
}
-   synth_buffer_add(SPACE);
 }
 
 static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 0/7] staging: speakup: introduce tty-based comms

2017-03-21 Thread Samuel Thibault
Hello,

So Rob, how do you see this going?  Shall we introduce a serdev_device
*tty_port_register_serdev_device(tty, device)? Will you work on it or
should I give it a try?

Samuel

Samuel Thibault, on mer. 15 mars 2017 16:03:23 +0100, wrote:
> Rob Herring, on mer. 15 mars 2017 09:45:59 -0500, wrote:
> > On Mon, Mar 13, 2017 at 8:18 PM, Samuel Thibault
> >  wrote:
> > > Samuel Thibault, on mar. 14 mars 2017 01:47:01 +0100, wrote:
> > >> Greg KH, on mar. 14 mars 2017 06:14:04 +0800, wrote:
> > >> > On Mon, Mar 13, 2017 at 10:05:51PM +, okash.khaw...@gmail.com 
> > >> > wrote:
> > >> > > This patchset introduces a TTY-based way for the synths to 
> > >> > > communicate
> > >> > > with devices as an alternate for direct serial comms used by the 
> > >> > > synths
> > >> > > at the moment. It then migrates some of the synths to the TTY-based
> > >> > > comms. Synths migrated in this patchset are dummy, acntsa, bns and
> > >> > > txprt.
> > >> >
> > >> > What about using the serbus code that is now in the tree?  That should
> > >> > make this a lot easier than your patchset from what I can see.
> > >>
> > >> Mmm... AIUI from reading tty_port_register_device_attr, one
> > >> would have to have registered a speakup serdev device driver
> > >> *before* tty_port_register_device_attr gets called, so that
> > >> serdev_tty_port_register matches the driver in the loop of
> > >> of_serdev_register_devices, and no TTY cdev is created?
> > 
> > Not exactly. The driver doesn't have to be registered nor loaded, but
> > the device does have to be present so no tty cdev is created. The only
> > way a device is present currently is when a node is in the DT. I
> > expect the x86 folks will be adding ACPI support soon.
> 
> Ok, but in our case there is no hardware device that the system can
> see/probe, it's just plugged externally.
> 
> > >> That would mean that speakup can not be loaded as a module after ttyS0
> > >> initialization, that won't fly for our use needs. The line discipline
> > >> mechanism allows us to attach ourself to an existing tty.  Could we
> > >> imagine a tty_port function which removes the cdev and tries to register
> > >> the tty port again to serdev?
> > >>
> > >> What we basically need to be able to say on speakup module load is
> > >> e.g. "I'm now attaching a device to ttyS0, use this serdev_device_ops to
> > >> discuss with it".
> > >
> > > That for_each_available_child_of_node loop is really way more complex
> > > than what we need.  And what's more, it's not working without CONFIG_OF
> > > (!)
> > >
> > > It would really make sense to me to have a
> > >
> > > serdev_device *tty_port_register_serdev_device(tty, device)
> > >
> > > which unregisters the character device of the tty, and creates instead a
> > > controler with the given device plugged to it. Really much like a line
> > > discipline, but way simpler :)
> > 
> > What would trigger calling this function?
> 
> From the user point of view, loading the speakup module for the external
> device, typically, with "ttyS0" as module parameter. Then the speakup
> init function can do whatever it needs to achieve this :)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix warning for static declaration

2017-03-27 Thread Samuel Thibault
Gustavo A. R. Silva, on lun. 27 mars 2017 01:37:29 -0500, wrote:
> Fix the following sparse warning:
> symbol 'spk_serial_out' was not declared. Should it be static?
> 
> Signed-off-by: Gustavo A. R. Silva 

Yes, indeed.

Reviewed-by: Samuel Thibault 

Thanks

> ---
>  drivers/staging/speakup/serialio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/serialio.c 
> b/drivers/staging/speakup/serialio.c
> index 5e31aca..3fab1c3 100644
> --- a/drivers/staging/speakup/serialio.c
> +++ b/drivers/staging/speakup/serialio.c
> @@ -243,7 +243,7 @@ unsigned char spk_serial_in_nowait(void)
>  }
>  EXPORT_SYMBOL_GPL(spk_serial_in_nowait);
>  
> -int spk_serial_out(struct spk_synth *in_synth, const char ch)
> +static int spk_serial_out(struct spk_synth *in_synth, const char ch)
>  {
>   if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
>   outb_p(ch, speakup_info.port_tts);
> -- 
> 2.5.0
> 

-- 
Samuel
 Je suis maintenant possesseur d'un ordinateur portable Compaq Armada
 1592DT avec port infra-rouge. Auriez-vous connaissance de programmes
 suceptibles d'utiliser ce port afin de servir de télécommande ?
 -+- JN in NPC : ben quoi, c'est pas à ça que ça sert ?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix warning for static declaration

2017-03-27 Thread Samuel Thibault
Okash Khawaja, on lun. 27 mars 2017 08:51:02 +0100, wrote:
> Thanks for this :) Could you also move the function higher in the same
> file - above line 139 where all static functions are defined?

I'd say no need for this. spk_serial_in is just above.  Moving functions
just for the sake of static vs non-static does not make the code more
readable to my eyes :)
(and it makes tracking changes harder in git annotate)

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: Add pause command used on switching to graphical mode

2018-05-01 Thread Samuel Thibault
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 

Index: linux-4.15/drivers/staging/speakup/speakup_dummy.c
===
--- linux-4.15.orig/drivers/staging/speakup/speakup_dummy.c
+++ linux-4.15/drivers/staging/speakup/speakup_dummy.c
@@ -30,6 +30,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 } },
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
@@ -45,6 +45,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 } },
@@ -164,7 +165,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++;
Index: linux-4.15/drivers/staging/speakup/spk_types.h
===
--- linux-4.15.orig/drivers/staging/speakup/spk_types.h
+++ linux-4.15/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
 };
Index: linux-4.15/drivers/staging/speakup/varhandlers.c
===
--- linux-4.15.orig/drivers/staging/speakup/varhandlers.c
+++ linux-4.15/drivers/staging/speakup/varhandlers.c
@@ -44,6 +44,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 };
Index: linux-4.15/drivers/staging/speakup/main.c
===
--- linux-4.15.orig/drivers/staging/speakup/main.c
+++ linux-4.15/drivers/staging/speakup/main.c
@@ -76,6 +76,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 = 0;
 const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -1789,6 +1791,11 @@ 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);
 }
 
Index: linux-4.15/drivers/staging/speakup/speakup.h
===
--- linux-4.15.orig/drivers/staging/speakup/speakup.h
+++ linux-4.15/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

[PATCH] staging: speakup: Add pause command used on switching to graphical mode

2018-05-01 Thread Samuel Thibault
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 

Index: linux-4.15/drivers/staging/speakup/speakup_dummy.c
===
--- linux-4.15.orig/drivers/staging/speakup/speakup_dummy.c
+++ linux-4.15/drivers/staging/speakup/speakup_dummy.c
@@ -30,6 +30,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 } },
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
@@ -45,6 +45,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 } },
@@ -164,7 +165,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++;
Index: linux-4.15/drivers/staging/speakup/spk_types.h
===
--- linux-4.15.orig/drivers/staging/speakup/spk_types.h
+++ linux-4.15/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
 };
Index: linux-4.15/drivers/staging/speakup/varhandlers.c
===
--- linux-4.15.orig/drivers/staging/speakup/varhandlers.c
+++ linux-4.15/drivers/staging/speakup/varhandlers.c
@@ -44,6 +44,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 };
Index: linux-4.15/drivers/staging/speakup/main.c
===
--- linux-4.15.orig/drivers/staging/speakup/main.c
+++ linux-4.15/drivers/staging/speakup/main.c
@@ -76,6 +76,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 = 0;
 const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -1789,6 +1791,11 @@ 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);
 }
 
Index: linux-4.15/drivers/staging/speakup/speakup.h
===
--- linux-4.15.orig/drivers/staging/speakup/speakup.h
+++ linux-4.15/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

[PATCHv2] staging: speakup: Add pause command used on switching to graphical mode

2018-05-07 Thread Samuel Thibault
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 

---
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
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv2] staging: speakup: Add pause command used on switching to graphical mode

2018-05-08 Thread Samuel Thibault
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 
> > 
> > ---
> > 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: speakup: Fix coding style

2018-05-13 Thread Samuel Thibault
Signed-off-by: Samuel Thibault 
---
 drivers/staging/speakup/buffers.c |3 ++-
 drivers/staging/speakup/main.c|5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -78,7 +78,8 @@ void synth_buffer_add(u16 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. */
+* paused any more.
+*/
spk_paused = 0;
 }
 
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -68,7 +68,7 @@ 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 = 0;
+bool spk_paused;
 const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -1782,8 +1782,7 @@ 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])
-   {
+   if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
synth_printf("%s", spk_str_pause);
spk_paused = 1;
}
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: speakup: use true/false instead of 1/0

2018-05-14 Thread Samuel Thibault
Signed-off-by: Samuel Thibault 
---
 drivers/staging/speakup/buffers.c |2 +-
 drivers/staging/speakup/main.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -80,7 +80,7 @@ void synth_buffer_add(u16 ch)
/* We have written something to the speech synthesis, so we are not
 * paused any more.
 */
-   spk_paused = 0;
+   spk_paused = false;
 }
 
 u16 synth_buffer_getc(void)
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1784,7 +1784,7 @@ static void speakup_con_update(struct vc
speakup_date(vc);
if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
synth_printf("%s", spk_str_pause);
-   spk_paused = 1;
+   spk_paused = true;
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 }
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: speakup: remove simple_strtoul()

2018-05-26 Thread Samuel Thibault
Hello,

Gabriel Fedel, le sam. 26 mai 2018 16:03:35 -0300, a ecrit:
> Replace simple_strtoul() with kstrtoul(), because simple_strtoul() is
> obsolete. 

Well, rather than putting again a dozen lines of code, if simple_strtoul
is really considered to be obsolete, a replacement should be defined so
we can use it instead (and not duplicate the dozen lines of code in each
please where kstrtoul is not enough).

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-04 Thread Samuel Thibault
Hello,

Justin Skists, le lun. 04 juin 2018 10:52:12 +0100, a ecrit:
> 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.
> 
> Signed-off-by: Justin Skists 

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
> spea...@linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup

-- 
Samuel
 un driver qui fait quoi, alors ?
 ben pour les bips
 pour passer les oops en morse
 -+- #ens-mim - vive les rapports de bug -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-06 Thread Samuel Thibault
Hello,

Justin Skists, le lun. 04 juin 2018 10:52:12 +0100, a ecrit:
> 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 

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
---
 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-11 Thread Samuel Thibault
Hello,

Samuel Thibault, le mer. 06 juin 2018 15:26:28 +0200, a ecrit:
> 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
---
 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-11 Thread Samuel Thibault
Gregory Nowak, le lun. 11 juin 2018 16:51:22 -0700, a ecrit:
> On Tue, Jun 12, 2018 at 12:57:03AM +0200, Samuel Thibault wrote:
> > 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-17 Thread Samuel Thibault
Thanks for the tests!

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-18 Thread Samuel Thibault
Justin Skists, le lun. 18 juin 2018 09:41:44 +0100, a ecrit:
> > On 18 June 2018 at 06:34 Gregory Nowak  wrote:
> > 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
> > >/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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: refactor synths array to use a list

2018-06-18 Thread Samuel Thibault
Justin Skists, le lun. 18 juin 2018 09:55:32 +0100, a ecrit:
> 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: remove redundant initialization of pointer p_key

2020-02-23 Thread Samuel Thibault
Colin King, le dim. 23 févr. 2020 15:39:54 +, a ecrit:
> From: Colin Ian King 
> 
> Pointer p_key is being initialized with a value that is never read,
> it is assigned a new value later on. The initialization is redundant
> and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King 

Indeed, thanks!

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/keyhelp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/keyhelp.c 
> b/drivers/staging/speakup/keyhelp.c
> index 5f1bda37f86d..822ceac83068 100644
> --- a/drivers/staging/speakup/keyhelp.c
> +++ b/drivers/staging/speakup/keyhelp.c
> @@ -49,7 +49,7 @@ static int cur_item, nstates;
>  static void build_key_data(void)
>  {
>   u_char *kp, counters[MAXFUNCS], ch, ch1;
> - u_short *p_key = key_data, key;
> + u_short *p_key, key;
>   int i, offset = 1;
>  
>   nstates = (int)(state_tbl[-1]);
> -- 
> 2.25.0
> 

-- 
Samuel
j'etais en train de nettoyer ma souris et le coup est parti...
 -+- s sur #ens-mim - et en plus c vrai... -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: Fix a typo error print for softsynthu device

2020-03-04 Thread Samuel Thibault
Zhenzhong Duan, le jeu. 05 mars 2020 15:21:51 +0800, a ecrit:
> When softsynthu device fails the register, "/dev/softsynthu" should be
> printed instead of "/dev/softsynth".

Reviewed-by: Samuel Thibault 

Thanks!

> Signed-off-by: Zhenzhong Duan 
> Cc: William Hubbs 
> Cc: Chris Brannon 
> Cc: Kirk Reiser 
> Cc: Samuel Thibault 
> Cc: Greg Kroah-Hartman 
> ---
>  drivers/staging/speakup/speakup_soft.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/speakup_soft.c 
> b/drivers/staging/speakup/speakup_soft.c
> index 9d85a3a1af4c..28cedaec6d8a 100644
> --- a/drivers/staging/speakup/speakup_soft.c
> +++ b/drivers/staging/speakup/speakup_soft.c
> @@ -388,7 +388,7 @@ static int softsynth_probe(struct spk_synth *synth)
>   synthu_device.name = "softsynthu";
>   synthu_device.fops = &softsynthu_fops;
>   if (misc_register(&synthu_device)) {
> - pr_warn("Couldn't initialize miscdevice /dev/softsynth.\n");
> + pr_warn("Couldn't initialize miscdevice /dev/softsynthu.\n");
>   return -ENODEV;
>   }
>  
> -- 
> 2.17.1
> 

-- 
Samuel
N: beep beep Miam miam? 
y: ++
a: kill -MIAM -1
 -+- #runtime < /dev/miam -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: signedness bug in spk_ttyio_in_nowait()

2017-05-19 Thread Samuel Thibault
Dan Carpenter, on sam. 20 mai 2017 00:27:18 +0300, wrote:
> On most of the common arches char is signed so it can't ever == 0xff.
> Let's fix this by making it a u8.
> 
> Fixes: 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input 
> functionality for tty")
> Signed-off-by: Dan Carpenter 

Reviewed-by: Samuel Thibault 

> diff --git a/drivers/staging/speakup/spk_ttyio.c 
> b/drivers/staging/speakup/spk_ttyio.c
> index 6e0f042f6a44..8ed7c71c712f 100644
> --- a/drivers/staging/speakup/spk_ttyio.c
> +++ b/drivers/staging/speakup/spk_ttyio.c
> @@ -220,7 +220,7 @@ static unsigned char spk_ttyio_in(void)
>  
>  static unsigned char spk_ttyio_in_nowait(void)
>  {
> - char rv = ttyio_in(0);
> + u8 rv = ttyio_in(0);
>  
>   return (rv == 0xff) ? 0 : rv;
>  }
> 

-- 
Samuel
Now, it we had this sort of thing:
  yield -a for yield to all traffic
  yield -t for yield to trucks
  yield -f for yield to people walking (yield foot)
  yield -d t*  for yield on days starting with t
...you'd have a lot of dead people at intersections, and traffic jams you
wouldn't believe...
(Discussion in comp.os.linux.misc on the intuitiveness of commands.)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 1/2] staging: speakup: add function to convert dev name to number

2017-06-14 Thread Samuel Thibault
Greg KH, on mer. 14 juin 2017 12:15:41 +0200, wrote:
> Ah, no, nevermind, you just need the major/minor.  So why not just take
> that as the input here, and not a string?

Because real users don't know about major/minor numbers.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 1/2] staging: speakup: add function to convert dev name to number

2017-06-14 Thread Samuel Thibault
Greg KH, on mer. 14 juin 2017 13:48:02 +0200, wrote:
> On Wed, Jun 14, 2017 at 01:26:09PM +0200, Samuel Thibault wrote:
> > Greg KH, on mer. 14 juin 2017 12:15:41 +0200, wrote:
> > > Ah, no, nevermind, you just need the major/minor.  So why not just take
> > > that as the input here, and not a string?
> > 
> > Because real users don't know about major/minor numbers.
> 
> I'm not disagreeing, it's just that the kernel doesn't know about
> "device names" either :)

Well, it does for the console= parameter, for instance.  I know it's not
actually related with major/minor numbering, but it's still meant to
designate the same thing.

> And trying to have the kernel do the mapping based on strings like this
> is not ok, sorry.

So what is the solution?  Users would find it completely crazy to have
to provide major/minor numbers.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 1/2] staging: speakup: add function to convert dev name to number

2017-06-14 Thread Samuel Thibault
Andy Shevchenko, on mer. 14 juin 2017 15:36:30 +0300, wrote:
> On Wed, Jun 14, 2017 at 3:18 PM, Samuel Thibault
>  wrote:
> > Greg KH, on mer. 14 juin 2017 13:48:02 +0200, wrote:
> >> On Wed, Jun 14, 2017 at 01:26:09PM +0200, Samuel Thibault wrote:
> >> > Greg KH, on mer. 14 juin 2017 12:15:41 +0200, wrote:
> 
> >> And trying to have the kernel do the mapping based on strings like this
> >> is not ok, sorry.
> >
> > So what is the solution?  Users would find it completely crazy to have
> > to provide major/minor numbers.
> 
> Shouldn't udev take care of major/minor and alike stuff in user space?

We want speakup to get initialized before udev etc., just like the early
console.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: tty: define tty_open_by_driver when CONFIG_TTY is not defined

2017-06-17 Thread Samuel Thibault
Okash Khawaja, on sam. 17 juin 2017 10:46:41 +0100, wrote:
> This patch adds definition of tty_open_by_driver when CONFIG_TTY is not
> defined. This was supposed to have been included in commit
> 12e84c71b7d4ee38d51377fd494ac748ee4e6912 ("tty: export
> tty_open_by_driver"). The patch follows convention for other such
> functions and returns NULL.
> 
> Signed-off-by: Okash Khawaja 
> 
> ---
>  include/linux/tty.h |3 +++
>  1 file changed, 3 insertions(+)
> 
> --- a/include/linux/tty.h
> +++ b/include/linux/tty.h
> @@ -422,6 +422,9 @@ static inline int __init tty_init(void)
>  { return 0; }
>  static inline const char *tty_name(const struct tty_struct *tty)
>  { return "(none)"; }
> +static struct tty_struct *tty_open_by_driver(dev_t device, struct inode 
> *inode,
> + struct file *filp)
> +{ return NULL; }

Add inline

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch v2] tty: define tty_open_by_driver when CONFIG_TTY is not defined

2017-06-19 Thread Samuel Thibault
Okash Khawaja, on sam. 17 juin 2017 22:32:55 +0100, wrote:
> This patch adds definition of tty_open_by_driver when CONFIG_TTY is not
> defined. This was supposed to have been included in commit
> 12e84c71b7d4ee38d51377fd494ac748ee4e6912 ("tty: export
> tty_open_by_driver"). The patch follows convention for other such
> functions and returns NULL.
> 
> Signed-off-by: Okash Khawaja 

Reviewed-by: Samuel Thibault 

> 
> ---
>  include/linux/tty.h |3 +++
>  1 file changed, 3 insertions(+)
> 
> --- a/include/linux/tty.h
> +++ b/include/linux/tty.h
> @@ -422,6 +422,9 @@ static inline int __init tty_init(void)
>  { return 0; }
>  static inline const char *tty_name(const struct tty_struct *tty)
>  { return "(none)"; }
> +static inline struct tty_struct *tty_open_by_driver(dev_t device,
> + struct inode *inode, struct file *filp)
> +{ return NULL; }
>  #endif
>  
>  extern struct ktermios tty_std_termios;
> 

-- 
Samuel
 Ça peut être une madeleine à sous munitions (avec des composants,
par exemple)
 -+- #runtime -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: speakup: read scrolled-back VT

2016-01-01 Thread Samuel Thibault
Previously, speakup would always read the bottom part of the screen,
even when the VT is scrolled back with shift-page.  This patch makes
vt.c export screen_pos so that speakup can use it to properly access
the content of the scrolled-back VT.

This was tested with both vgacon and fbcon.

Signed-off-by: Samuel Thibault 

--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4250,6 +4250,7 @@ unsigned short *screen_pos(struct vc_dat
 {
return screenpos(vc, 2 * w_offset, viewed);
 }
+EXPORT_SYMBOL_GPL(screen_pos);
 
 void getconsxy(struct vc_data *vc, unsigned char *p)
 {
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -264,8 +264,9 @@ static struct notifier_block vt_notifier
.notifier_call = vt_notifier_call,
 };
 
-static unsigned char get_attributes(u16 *pos)
+static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 {
+   pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
return (u_char) (scr_readw(pos) >> 8);
 }
 
@@ -275,7 +276,7 @@ static void speakup_date(struct vc_data
spk_y = spk_cy = vc->vc_y;
spk_pos = spk_cp = vc->vc_pos;
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) spk_pos);
+   spk_attr = get_attributes(vc, (u_short *)spk_pos);
 }
 
 static void bleep(u_short val)
@@ -469,8 +470,12 @@ static u16 get_char(struct vc_data *vc,
u16 ch = ' ';
 
if (vc && pos) {
-   u16 w = scr_readw(pos);
-   u16 c = w & 0xff;
+   u16 w;
+   u16 c;
+
+   pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
+   w = scr_readw(pos);
+   c = w & 0xff;
 
if (w & vc->vc_hi_font_mask)
c |= 0x100;
@@ -746,7 +751,7 @@ static int get_line(struct vc_data *vc)
u_char tmp2;
 
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) spk_pos);
+   spk_attr = get_attributes(vc, (u_short *)spk_pos);
for (i = 0; i < vc->vc_cols; i++) {
buf[i] = (u_char) get_char(vc, (u_short *) tmp, &tmp2);
tmp += 2;
@@ -811,7 +816,7 @@ static int say_from_to(struct vc_data *v
u_short saved_punc_mask = spk_punc_mask;
 
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) from);
+   spk_attr = get_attributes(vc, (u_short *)from);
while (from < to) {
buf[i++] = (char)get_char(vc, (u_short *) from, &tmp);
from += 2;
@@ -886,7 +891,7 @@ static int get_sentence_buf(struct vc_da
sentmarks[bn][0] = &sentbuf[bn][0];
i = 0;
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) start);
+   spk_attr = get_attributes(vc, (u_short *)start);
 
while (start < end) {
sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp);
@@ -1585,7 +1590,7 @@ static int count_highlight_color(struct
u16 *ptr;
 
for (ptr = start; ptr < end; ptr++) {
-   ch = get_attributes(ptr);
+   ch = get_attributes(vc, ptr);
bg = (ch & 0x70) >> 4;
speakup_console[vc_num]->ht.bgcount[bg]++;
}
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: speakup: Fix getting port information

2016-01-02 Thread Samuel Thibault
5e6dc54 broke the port information in the speakup driver:
SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.

Along the way, make sure that we do have information for the requested
serial port number (index)

Signed-off-by: Samuel Thibault 

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,9 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include 
+#include 
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
const struct old_serial_port *ser = rs_table + index;
int err;
 
+   if (index > sizeof(rs_table) / sizeof(*rs_table)) {
+   pr_info("no port info for ttyS%d\n", index);
+   return NULL;
+   }
+
/*  Divisor, bytesize and parity */
quot = ser->baud_base / baud;
cval = cflag & (CSIZE | CSTOPB);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: speakup: Fix getting port information

2016-01-02 Thread Samuel Thibault
Samuel Thibault, on Sun 03 Jan 2016 00:25:29 +0100, wrote:
> 5e6dc54 broke the port information in the speakup driver:
> SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.
> 
> Along the way, make sure that we do have information for the requested
> serial port number (index)

(It'd be good to get this into 4.4 and 4.3.4).

> Signed-off-by: Samuel Thibault 
> 
> --- a/drivers/staging/speakup/serialio.c
> +++ b/drivers/staging/speakup/serialio.c
> @@ -6,6 +6,9 @@
>  #include "spk_priv.h"
>  #include "serialio.h"
>  
> +#include 
> +#include 
> +
>  #ifndef SERIAL_PORT_DFNS
>  #define SERIAL_PORT_DFNS
>  #endif
> @@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
>   const struct old_serial_port *ser = rs_table + index;
>   int err;
>  
> + if (index > sizeof(rs_table) / sizeof(*rs_table)) {
> + pr_info("no port info for ttyS%d\n", index);
> + return NULL;
> + }
> +
>   /*  Divisor, bytesize and parity */
>   quot = ser->baud_base / baud;
>   cval = cflag & (CSIZE | CSTOPB);

-- 
Samuel
AUTHOR
 FvwmM4 is the result of a random  bit  mutation  on  a  hard
 disk,  presumably  a  result  of  a  cosmic-ray or some such
 thing.
(extrait de la page de man de FvwmM4)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: speakup: Fix getting port information

2016-01-02 Thread Samuel Thibault
cov...@ccs.covici.com, on Sat 02 Jan 2016 19:10:36 -0500, wrote:
> I had a patch which also worked, but yours may be better -- I enclose it
> here for your information.

Well, it's not up to serialio.h to include things for serialio.c. That
however makes me realize that the culprit is actually
f79b0d9 (which actually doesn't make much sense since linux/serial.h is
getting included a couple of lines above...).

I don't know what this "use  instead "
warning is about, but *no* header in include/ includes asm/serial.h, so
there is no way to get the SERIAL_PORT_DFNS definition just by including
linux/serial.h, we really need asm/serial.h, just like 8250*.c do.

So we really need serialio.c to include linux/serial_core.h then
asm/serial.h, as my patch does.

Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: speakup: Fix getting port information

2016-01-04 Thread Samuel Thibault
Mmm, sorry.  I don't submit patches often enough, so that each time I do
it, there are new things to know about it :)

Thanks for the comments,
Samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: speakup: Fix getting port information

2016-01-04 Thread Samuel Thibault
Patch f79b0d9c223c ("staging: speakup: Fixed warning 
instead of ") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included,
and no other header includes asm/serial.h.

We here make sure serialio.c does get the arch-specific definition of
SERIAL_PORT_DFNS from asm/serial.h, if any.

Along the way, this makes sure that we do have information for the
requested serial port number (index)

Signed-off-by: Samuel Thibault 
Fixes: f79b0d9c223c ("staging: speakup: Fixed warning  instead 
of ")

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,9 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include 
+#include 
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -23,9 +26,15 @@ const struct old_serial_port *spk_serial
int baud = 9600, quot = 0;
unsigned int cval = 0;
int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
-   const struct old_serial_port *ser = rs_table + index;
+   const struct old_serial_port *ser;
int err;
 
+   if (index >= ARRAY_SIZE(rs_table)) {
+   pr_info("no port info for ttyS%d\n", index);
+   return NULL;
+   }
+   ser = rs_table + index;
+
/*  Divisor, bytesize and parity */
quot = ser->baud_base / baud;
cval = cflag & (CSIZE | CSTOPB);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix type mismatch warnings

2016-03-11 Thread Samuel Thibault
Hello,

Greg KH, on Fri 11 Mar 2016 14:32:52 -0800, wrote:
> On Thu, Mar 10, 2016 at 08:21:35PM +, Okash Khawaja wrote:
> > Compiling speakup driver with sparse produces following warning:
> > 
> > drivers/staging/speakup/serialio.c:22:9: warning: incorrect type in
> > initializer (different base types)
> > drivers/staging/speakup/serialio.c:22:9:expected unsigned int
> > [unsigned] flags
> > drivers/staging/speakup/serialio.c:22:9:got restricted upf_t
> > 
> > This patch fixes it.
> > 
> > Signed-off-by: Okash Khawaja 

> > @@ -16,7 +17,7 @@ struct old_serial_port {
> > unsigned int baud_base;
> > unsigned int port;
> > unsigned int irq;
> > -   unsigned int flags; /* unused */
> > +   upf_t flags; /* unused */
> 
> I need some agreement from the speakup developers about this, I don't
> know if it's really needed or not...

It is not needed for functionality (upf_t is a typedef for unsigned
long), but in principle the field should be upf_t indeed (because it has
the __bitwise qualifier).

samuel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: ensure we do not overrun synths array

2016-05-09 Thread Samuel Thibault
Colin King, on Mon 09 May 2016 23:22:14 +0100, wrote:
> From: Colin Ian King 
> 
> synth_add allows one to add MAXSYNTHS synths to the synths array;
> however it always NULLifies the next synth in the array which
> means that on the MAXSYNTHS synth we get an out-of-bounds write of
> the NULL to the synths array.  Make the synths array MAXSYNTHS + 1
> elements in size to allow for the final NULL sentinal to avoid the
> out-of-bounds write.
> 
> Issue found wit CoverityScan, CID#744671
> 
> Signed-off-by: Colin Ian King 

Reviewed-by: Samuel Thibault 

> ---
>  drivers/staging/speakup/synth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
> index 4f462c3..810a214 100644
> --- a/drivers/staging/speakup/synth.c
> +++ b/drivers/staging/speakup/synth.c
> @@ -18,7 +18,7 @@
>  #include "serialio.h"
>  
>  #define MAXSYNTHS   16  /* Max number of synths in array. */
> -static struct spk_synth *synths[MAXSYNTHS];
> +static struct spk_synth *synths[MAXSYNTHS + 1];
>  struct spk_synth *synth;
>  char spk_pitch_buff[32] = "";
>  static int module_status;
> -- 
> 2.8.1
> 

-- 
Samuel
Actually, typing random strings in the Finder does the equivalent of
filename completion.
(Discussion in comp.os.linux.misc on the intuitiveness of commands: file
completion vs. the Mac Finder.)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: speakup: Fix getting port information

2016-01-14 Thread Samuel Thibault
Commit f79b0d9c223c ("staging: speakup: Fixed warning 
instead of ") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included,
and no other header includes asm/serial.h.

We here make sure serialio.c does get the arch-specific definition of
SERIAL_PORT_DFNS from asm/serial.h, if any.

Along the way, this makes sure that we do have information for the
requested serial port number (index)

Signed-off-by: Samuel Thibault 
Fixes: f79b0d9c223c ("staging: speakup: Fixed warning  instead 
of ")

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,11 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include 
+/* WARNING:  Do not change this to  without testing that
+ * SERIAL_PORT_DFNS does get defined to the appropriate value. */
+#include 
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -23,9 +28,15 @@ const struct old_serial_port *spk_serial
int baud = 9600, quot = 0;
unsigned int cval = 0;
int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
-   const struct old_serial_port *ser = rs_table + index;
+   const struct old_serial_port *ser;
int err;
 
+   if (index >= ARRAY_SIZE(rs_table)) {
+   pr_info("no port info for ttyS%d\n", index);
+   return NULL;
+   }
+   ser = rs_table + index;
+
/*  Divisor, bytesize and parity */
quot = ser->baud_base / baud;
cval = cflag & (CSIZE | CSTOPB);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >