Greg Kroah-Hartman | 6496922 | 2018-01-11 11:08:40 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 2 | /* |
| 3 | * originally written by: Kirk Reiser <kirk@braille.uwo.ca> |
Vitali Liaukovich | d9c3b5a7 | 2017-01-28 13:02:40 +0200 | [diff] [blame] | 4 | * this version considerably modified by David Borowski, david575@rogers.com |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 5 | * |
| 6 | * Copyright (C) 1998-99 Kirk Reiser. |
| 7 | * Copyright (C) 2003 David Borowski. |
| 8 | * |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 9 | * this code is specificly written as a driver for the speakup screenreview |
| 10 | * package and is not a general device driver. |
| 11 | */ |
| 12 | #include "spk_priv.h" |
| 13 | #include "speakup.h" |
| 14 | |
| 15 | #define DRV_VERSION "2.11" |
| 16 | #define SYNTH_CLEAR 0x18 |
| 17 | #define PROCSPEECH '\r' |
| 18 | |
| 19 | static struct var_t vars[] = { |
Christopher Brannon | 64d1e5a | 2010-10-14 19:23:50 -0500 | [diff] [blame] | 20 | { CAPS_START, .u.s = {"\x05\x31\x32P" } }, |
| 21 | { CAPS_STOP, .u.s = {"\x05\x38P" } }, |
| 22 | { RATE, .u.n = {"\x05%dE", 8, 1, 16, 0, 0, NULL } }, |
| 23 | { PITCH, .u.n = {"\x05%dP", 8, 0, 16, 0, 0, NULL } }, |
| 24 | { VOL, .u.n = {"\x05%dV", 8, 0, 16, 0, 0, NULL } }, |
| 25 | { TONE, .u.n = {"\x05%dT", 8, 0, 16, 0, 0, NULL } }, |
| 26 | { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 27 | V_LAST_VAR |
| 28 | }; |
| 29 | |
| 30 | /* |
| 31 | * These attributes will appear in /sys/accessibility/speakup/bns. |
| 32 | */ |
| 33 | static struct kobj_attribute caps_start_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 34 | __ATTR(caps_start, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 35 | static struct kobj_attribute caps_stop_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 36 | __ATTR(caps_stop, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 37 | static struct kobj_attribute pitch_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 38 | __ATTR(pitch, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 39 | static struct kobj_attribute rate_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 40 | __ATTR(rate, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 41 | static struct kobj_attribute tone_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 42 | __ATTR(tone, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 43 | static struct kobj_attribute vol_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 44 | __ATTR(vol, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 45 | |
| 46 | static struct kobj_attribute delay_time_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 47 | __ATTR(delay_time, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 48 | static struct kobj_attribute direct_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 49 | __ATTR(direct, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 50 | static struct kobj_attribute full_time_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 51 | __ATTR(full_time, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 52 | static struct kobj_attribute jiffy_delta_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 53 | __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 54 | static struct kobj_attribute trigger_time_attribute = |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 55 | __ATTR(trigger_time, 0644, spk_var_show, spk_var_store); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 56 | |
| 57 | /* |
| 58 | * Create a group of attributes so that we can create and destroy them all |
| 59 | * at once. |
| 60 | */ |
| 61 | static struct attribute *synth_attrs[] = { |
| 62 | &caps_start_attribute.attr, |
| 63 | &caps_stop_attribute.attr, |
| 64 | &pitch_attribute.attr, |
| 65 | &rate_attribute.attr, |
| 66 | &tone_attribute.attr, |
| 67 | &vol_attribute.attr, |
| 68 | &delay_time_attribute.attr, |
| 69 | &direct_attribute.attr, |
| 70 | &full_time_attribute.attr, |
| 71 | &jiffy_delta_attribute.attr, |
| 72 | &trigger_time_attribute.attr, |
| 73 | NULL, /* need to NULL terminate the list of attributes */ |
| 74 | }; |
| 75 | |
| 76 | static struct spk_synth synth_bns = { |
| 77 | .name = "bns", |
| 78 | .version = DRV_VERSION, |
| 79 | .long_name = "Braille 'N Speak", |
| 80 | .init = "\x05Z\x05\x43", |
| 81 | .procspeech = PROCSPEECH, |
| 82 | .clear = SYNTH_CLEAR, |
| 83 | .delay = 500, |
| 84 | .trigger = 50, |
| 85 | .jiffies = 50, |
| 86 | .full = 40000, |
Okash Khawaja | 8a21ff7 | 2017-06-25 19:40:02 +0100 | [diff] [blame] | 87 | .dev_name = SYNTH_DEFAULT_DEV, |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 88 | .startup = SYNTH_START, |
| 89 | .checkval = SYNTH_CHECK, |
| 90 | .vars = vars, |
Okash Khawaja | bbe6fb5 | 2017-06-07 15:00:06 +0100 | [diff] [blame] | 91 | .io_ops = &spk_ttyio_ops, |
| 92 | .probe = spk_ttyio_synth_probe, |
| 93 | .release = spk_ttyio_release, |
| 94 | .synth_immediate = spk_ttyio_synth_immediate, |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 95 | .catch_up = spk_do_catch_up, |
| 96 | .flush = spk_synth_flush, |
| 97 | .is_alive = spk_synth_is_alive_restart, |
| 98 | .synth_adjust = NULL, |
| 99 | .read_buff_add = NULL, |
| 100 | .get_index = NULL, |
| 101 | .indexing = { |
| 102 | .command = NULL, |
| 103 | .lowindex = 0, |
| 104 | .highindex = 0, |
| 105 | .currindex = 0, |
| 106 | }, |
| 107 | .attributes = { |
| 108 | .attrs = synth_attrs, |
| 109 | .name = "bns", |
| 110 | }, |
| 111 | }; |
| 112 | |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 113 | module_param_named(ser, synth_bns.ser, int, 0444); |
Mihaela Muraru | b5a603d | 2017-09-24 11:49:41 +0300 | [diff] [blame] | 114 | module_param_named(dev, synth_bns.dev_name, charp, 0444); |
Derek Robson | 73c3700 | 2017-01-28 19:35:01 +1300 | [diff] [blame] | 115 | module_param_named(start, synth_bns.startup, short, 0444); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 116 | |
| 117 | MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); |
Okash Khawaja | 8a21ff7 | 2017-06-25 19:40:02 +0100 | [diff] [blame] | 118 | MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 119 | MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); |
| 120 | |
Vaishali Thakkar | ae89fac | 2015-03-18 23:13:10 +0530 | [diff] [blame] | 121 | module_spk_synth(synth_bns); |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 122 | |
William Hubbs | c6e3fd2 | 2010-10-07 13:20:02 -0500 | [diff] [blame] | 123 | MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>"); |
| 124 | MODULE_AUTHOR("David Borowski"); |
| 125 | MODULE_DESCRIPTION("Speakup support for Braille 'n Speak synthesizers"); |
| 126 | MODULE_LICENSE("GPL"); |
| 127 | MODULE_VERSION(DRV_VERSION); |
| 128 | |