aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup/synth.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-03-18staging: speakup_soft: Fix alternate speech with other synthsSamuel Thibault1-0/+6
When switching from speakup_soft to another synth, speakup_soft would keep calling synth_buffer_getc() from softsynthx_read. Let's thus make synth.c export the knowledge of the current synth, so that speakup_soft can determine whether it should be running. speakup_soft also needs to set itself alive, otherwise the switch would let it remain silent. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-17staging: speakup: refactor synths array to use a listJustin Skists1-27/+13
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 <justin.skists@juzza.co.uk> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14staging: speakup: Add unicode support to the speakup_dummy driverSamuel Thibault1-4/+21
This extends spk_io_ops with a synth_out_unicode which takes a u16 character instead of just a byte, and extends spk_ttyio to implement it to emit utf-8. spk_do_catch_up_unicode can then be introduced to benefit from synth_out_unicode, and speakup_dummy made to use spk_do_catch_up_unicode instead of spk_do_catch_up. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-15staging: speakup: add SPDX identifier.Greg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Fix up the remaining staging speakup files to have a proper SPDX identifier, based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: William Hubbs <w.d.hubbs@gmail.com> Cc: Chris Brannon <chris@the-brannons.com> Cc: Kirk Reiser <kirk@reisers.ca> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-21treewide: Switch DEFINE_TIMER callbacks to struct timer_list *Kees Cook1-1/+1
This changes all DEFINE_TIMER() callbacks to use a struct timer_list pointer instead of unsigned long. Since the data argument has already been removed, none of these callbacks are using their argument currently, so this renames the argument to "unused". Done using the following semantic patch: @match_define_timer@ declarer name DEFINE_TIMER; identifier _timer, _callback; @@ DEFINE_TIMER(_timer, _callback); @change_callback depends on match_define_timer@ identifier match_define_timer._callback; type _origtype; identifier _origarg; @@ void -_callback(_origtype _origarg) +_callback(struct timer_list *unused) { ... } Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-05timer: Remove expires and data arguments from DEFINE_TIMERKees Cook1-1/+1
Drop the arguments from the macro and adjust all callers with the following script: perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \ $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h) Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts Acked-by: Guenter Roeck <linux@roeck-us.net> # for watchdog parts Acked-by: David S. Miller <davem@davemloft.net> # for networking parts Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Kalle Valo <kvalo@codeaurora.org> # for wireless parts Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: linux-mips@linux-mips.org Cc: Petr Mladek <pmladek@suse.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: Kalle Valo <kvalo@qca.qualcomm.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: linux1394-devel@lists.sourceforge.net Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: linux-s390@vger.kernel.org Cc: linux-wireless@vger.kernel.org Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Ursula Braun <ubraun@linux.vnet.ibm.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Harish Patil <harish.patil@cavium.com> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Michael Reed <mdr@sgi.com> Cc: Manish Chopra <manish.chopra@cavium.com> Cc: Len Brown <len.brown@intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux-pm@vger.kernel.org Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Tejun Heo <tj@kernel.org> Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Mark Gross <mark.gross@intel.com> Cc: linux-watchdog@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: Guenter Roeck <linux@roeck-us.net> Cc: netdev@vger.kernel.org Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: linuxppc-dev@lists.ozlabs.org Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Link: https://lkml.kernel.org/r/1507159627-127660-11-git-send-email-keescook@chromium.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-06-25staging: speakup: fix synth caching when synth init failsOkash Khawaja1-2/+7
synths[] array caches currently loaded synths. synth_add checks synths[] before adding a new one. It however ignores the result of do_synth_init. So when do_synth_init fails, the failed synth is still cached. Since, as a result module loading fails too, synth_remove - which is responsible for removing the cached synth - is never called. Next time the failing synth is added again it succeeds because synth_add finds it cached inside synths[]. This patch fixes this by caching a synth only after do_synth_init succeeds. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-16staging: speakup: flush tty buffers and ensure hardware flow controlOkash Khawaja1-0/+1
This patch fixes the issue where TTY-migrated synths would take a while to shut up after hitting numpad enter key. When calling synth_flush, even though XOFF character is sent as high priority, data buffered in TTY layer is still sent to the synth. This patch flushes that buffered data when synth_flush is called. It also tries to ensure that hardware flow control is enabled, by setting CRTSCTS using tty's termios. Reported-by: John Covici <covici@ccs.covici.com> Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: speakup: make input functionality swappableOkash Khawaja1-2/+8
This moves functions which take input from external synth, into struct spk_io_ops. The calling code then uses serial implementation of those methods through spk_io_ops. That way we can add a parallel TTY-based implementation and simply replace serial with TTY. That is what the next patch in this series does. speakup_decext.c has get_last_char function which reads the most recent available character from the synth. This patch changes that by defining read_buff_add callback method of spk_syth and letting that update the last_char global character read from the synth. read_buff_add is called from ISR, so there is a possibility for last_char to be stale. Therefore it is marked as volatile. It also pulls a repeated get_index implementation into synth.c, to be used as a utility function. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-17staging: speakup: move those functions which do outgoing serial comms, into serialio.cOkash Khawaja1-46/+0
This moves spk_synth_immediate and spk_serial_synth_probe functions into serialio.c. These functions do outgoing serial comms. The move is a step towards collecting all serial comms in serialio.c. This also renames spk_synth_immediate to spk_serial_synth_immediate. Code inside those functions has not been changed. Along the way, this patch also fixes a couple of spots which were calling spk_synth_immediate directly, so that the calls now happen via the spk_syth struct. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: speakup: move spk_stop_serial_interrupt into synth-specific release functionOkash Khawaja1-1/+0
This moves call to spk_stop_serial_interrupt() function out of synth_release() and into release() method of specific spk_synth instances. This is because the spk_stop_serial_interrupt() call is specific to current serial i/o implementation. Moving it into each synth's release() method gives the decision of calling spk_stop_serial_interrupt() to that synth. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: speakup: add spk_io_ops struct to spk_synthOkash Khawaja1-4/+4
This patch adds spk_io_ops struct which contain those methods whose job is to communicate with synth device. Currently, all comms with external synth device use raw serial i/o. The idea is to group all methods which do the actual communication with external device into this new struct. Then migrating a serial-based synth over to an alternative to raw serial i/o will mean swapping serial spk_io_ops instance with the io_ops instance of the new method, making the migration simpler. At the moment, this struct only contains one method, synth_out but more will be added in future when migrating synths which require input functionality. Also at the moment, synth_out method has one implementation which uses serial i/o. Plan is to add an alternative. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: speakup: spk_serial_out and spk_wait_for_xmitr to take synth argOkash Khawaja1-6/+6
These two functions are always called from a context where spk_synth instance is available. They also use the spk_synth instance but instead of taking it as an argument, they rely on a global spk_synth instance inside synth.c which points to the same synth as the one being passed in as argument. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09speakup: extend synth buffer to 16bit unicode charactersSamuel Thibault1-0/+30
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 <samuel.thibault@ens-lyon.org> Reviewed-by: Chris Brannon <chris@the-brannons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: speakup: (coding style) Limit line to 80 charsOlav Haugan1-2/+2
Fix checkpatch warning about line being over 80 characters. Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: speakup: (coding style) Simplify comparisons to NULLOlav Haugan1-8/+8
Fix checkpatch check notices by simplifying comparisons to NULL. Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: speakup: synth.c Align parenthesisWalt Feasel1-1/+1
Make suggested checkpatch modification for CHECK: Alignment should match open parenthesis Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: speakup: synth.c Comment modificationsWalt Feasel1-2/+3
Make modifications to comment style Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: speakup: synth.c Logical continuationWalt Feasel1-2/+2
Make suggested checkpatch modification for CHECK: Logical continuations should be on the previous line Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: speakup: synth.c Blank line before }Walt Feasel1-1/+0
Make suggested checkpatch modification for CHECK: Blank lines aren't necessary before a close brace '}' Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: speakup: synth.c Spaces around operatorsWalt Feasel1-5/+5
Make suggested checkpatch modification for CHECK: spaces preferred around that '|,+,-,/' Signed-off-by: Walt Feasel <waltfeasel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22staging: speakup: Remove unnecessary parenthesesKatie Dunne1-2/+2
Issue found by checkpatch. Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15staging: speakup: ensure we do not overrun synths arrayColin Ian King1-1/+1
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 <colin.king@canonical.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-05staging: speakup: Remove unnecessary test in if conditionAmitoj Kaur Chawla1-1/+1
Remove unnecessary test on synth->alive since it has already been tested previously. This fixes the following smatch warning: drivers/staging/speakup/synth.c:182 spk_synth_is_alive_restart() warn: we tested 'synth->alive' before and it was 'false' Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17staging: speakup: Split the comment to fit the lengthPanir.Nyan1-3/+3
Split the comment to fit the length. Signed-off-by: Panir Nyan <Panir.Nyan@gmail.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23staging: speakup: remove jiffies comparison using time_after_eq()Tapasweni Pathak1-1/+1
This patch fixes checkpatch.pl warning in files of speakup WARNING : Comparing jiffies is almost always wrong; prefer time_after, time_before and friends Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-11staging: speakup: fix missing blank lines after declarationsDomagoj Trsan1-0/+7
Signed-off-by: Domagoj Trsan <domagoj.trsan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27Staging: speakup: don't die if accessing sysfs without synthSasha Levin1-0/+3
Setting a 'silent' parameter without a synth would crash the kernel. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16Staging: speakup: Fix return value in synth.cSachin Kamat1-1/+1
The function return type is a pointer. Hence return NULL instead of 0. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16staging: speakup: remove custom locking macro definitionsWilliam Hubbs1-0/+12
Signed-off-by: William Hubbs <w.d.hubbs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16staging: speakup: synth: remove custom locking macrosWilliam Hubbs1-12/+12
Signed-off-by: William Hubbs <w.d.hubbs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07Merge branch 'staging-linus' into staging-nextGreg Kroah-Hartman1-2/+2
This is to get the comedi fixes, and resolve the issue in comdi_test.c and comedi_fops.c that were caused by changes in both branches. It also allows the fwserial driver changes to be applied, as they required the fixes that are in staging-linus. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07staging: speakup: Prefix externally-visible symbolsSamuel Thibault1-19/+19
This prefixes all externally-visible symbols of speakup with "spk_". Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07staging: speakup: avoid out-of-range access in synth_add()Samuel Thibault1-1/+1
Check that array index is in-bounds before accessing the synths[] array. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: stable <stable@vger.kernel.org> Cc: Nickolai Zeldovich <nickolai@csail.mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07staging: speakup: avoid out-of-range access in synth_init()Nickolai Zeldovich1-1/+1
Check that array index is in-bounds before accessing the synths[] array. Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu> Cc: stable <stable@vger.kernel.org> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09staging "speakup" Fix typos.Justin P. Mattock1-1/+1
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-08TTY: speakup, do not use serialPJiri Slaby1-1/+1
The structures there are going away. And speakup has enough troubles already. So define a structure similar to what 8250 does: old_serial_port. There define an array of speed, port base and so on needed for configuration. Then use this structure instead of serial_state defined in serialP.h. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: William Hubbs <w.d.hubbs@gmail.com> Cc: Chris Brannon <chris@the-brannons.com> Cc: Kirk Reiser <kirk@braille.uwo.ca> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-01-13module_param: make bool parameters really bool (drivers & misc)Rusty Russell1-1/+1
module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-10-19staging: speakup: synth.c style fixesWilliam Hubbs1-13/+18
fix issues reported by checkpatch.pl Signed-off-by: William Hubbs <w.d.hubbs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-07Staging: add speakup to the staging directoryWilliam Hubbs1-0/+458
Speakup is a kernel based screen review package for the linux operating system. It allows blind users to interact with applications on the linux console by means of synthetic speech. The authors and maintainers of this code include the following: Kirk Reiser, Andy Berdan, John Covici, Brian and David Borowski, Christopher Brannon, Samuel Thibault and William Hubbs. Signed-off-by: William Hubbs <w.d.hubbs@gmail.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>