1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * originally written by: Kirk Reiser <kirk@braille.uwo.ca> 4 * this version considerably modified by David Borowski, david575@rogers.com 5 * eventually modified by Samuel Thibault <samuel.thibault@ens-lyon.org> 6 * 7 * Copyright (C) 1998-99 Kirk Reiser. 8 * Copyright (C) 2003 David Borowski. 9 * Copyright (C) 2007 Samuel Thibault. 10 * 11 * specifically written as a driver for the speakup screenreview 12 * s not a general device driver. 13 */ 14 #include "spk_priv.h" 15 #include "speakup.h" 16 17 #define PROCSPEECH '\n' 18 #define DRV_VERSION "2.11" 19 #define SYNTH_CLEAR '!' 20 21 static struct var_t vars[] = { 22 { CAPS_START, .u.s = {"CAPS_START\n" } }, 23 { CAPS_STOP, .u.s = {"CAPS_STOP\n" } }, 24 { PAUSE, .u.s = {"PAUSE\n"} }, 25 { RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } }, 26 { PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } }, 27 { INFLECTION, .u.n = {"INFLECTION %d\n", 8, 0, 16, 0, 0, NULL } }, 28 { VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } }, 29 { TONE, .u.n = {"TONE %d\n", 8, 0, 16, 0, 0, NULL } }, 30 { PUNCT, .u.n = {"PUNCT %d\n", 0, 0, 3, 0, 0, NULL } }, 31 { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 32 V_LAST_VAR 33 }; 34 35 /* 36 * These attributes will appear in /sys/accessibility/speakup/dummy. 37 */ 38 static struct kobj_attribute caps_start_attribute = 39 __ATTR(caps_start, 0644, spk_var_show, spk_var_store); 40 static struct kobj_attribute caps_stop_attribute = 41 __ATTR(caps_stop, 0644, spk_var_show, spk_var_store); 42 static struct kobj_attribute pitch_attribute = 43 __ATTR(pitch, 0644, spk_var_show, spk_var_store); 44 static struct kobj_attribute inflection_attribute = 45 __ATTR(inflection, 0644, spk_var_show, spk_var_store); 46 static struct kobj_attribute punct_attribute = 47 __ATTR(punct, 0644, spk_var_show, spk_var_store); 48 static struct kobj_attribute rate_attribute = 49 __ATTR(rate, 0644, spk_var_show, spk_var_store); 50 static struct kobj_attribute tone_attribute = 51 __ATTR(tone, 0644, spk_var_show, spk_var_store); 52 static struct kobj_attribute vol_attribute = 53 __ATTR(vol, 0644, spk_var_show, spk_var_store); 54 55 static struct kobj_attribute delay_time_attribute = 56 __ATTR(delay_time, 0644, spk_var_show, spk_var_store); 57 static struct kobj_attribute direct_attribute = 58 __ATTR(direct, 0644, spk_var_show, spk_var_store); 59 static struct kobj_attribute full_time_attribute = 60 __ATTR(full_time, 0644, spk_var_show, spk_var_store); 61 static struct kobj_attribute jiffy_delta_attribute = 62 __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store); 63 static struct kobj_attribute trigger_time_attribute = 64 __ATTR(trigger_time, 0644, spk_var_show, spk_var_store); 65 66 /* 67 * Create a group of attributes so that we can create and destroy them all 68 * at once. 69 */ 70 static struct attribute *synth_attrs[] = { 71 &caps_start_attribute.attr, 72 &caps_stop_attribute.attr, 73 &pitch_attribute.attr, 74 &inflection_attribute.attr, 75 &punct_attribute.attr, 76 &rate_attribute.attr, 77 &tone_attribute.attr, 78 &vol_attribute.attr, 79 &delay_time_attribute.attr, 80 &direct_attribute.attr, 81 &full_time_attribute.attr, 82 &jiffy_delta_attribute.attr, 83 &trigger_time_attribute.attr, 84 NULL, /* need to NULL terminate the list of attributes */ 85 }; 86 87 static void read_buff_add(u_char c) 88 { 89 pr_info("speakup_dummy: got character %02x\n", c); 90 } 91 92 static struct spk_synth synth_dummy = { 93 .name = "dummy", 94 .version = DRV_VERSION, 95 .long_name = "Dummy", 96 .init = "Speakup\n", 97 .procspeech = PROCSPEECH, 98 .clear = SYNTH_CLEAR, 99 .delay = 500, 100 .trigger = 50, 101 .jiffies = 50, 102 .full = 40000, 103 .dev_name = SYNTH_DEFAULT_DEV, 104 .startup = SYNTH_START, 105 .checkval = SYNTH_CHECK, 106 .vars = vars, 107 .io_ops = &spk_ttyio_ops, 108 .probe = spk_ttyio_synth_probe, 109 .release = spk_ttyio_release, 110 .synth_immediate = spk_ttyio_synth_immediate, 111 .catch_up = spk_do_catch_up_unicode, 112 .flush = spk_synth_flush, 113 .is_alive = spk_synth_is_alive_restart, 114 .synth_adjust = NULL, 115 .read_buff_add = read_buff_add, 116 .get_index = NULL, 117 .indexing = { 118 .command = NULL, 119 .lowindex = 0, 120 .highindex = 0, 121 .currindex = 0, 122 }, 123 .attributes = { 124 .attrs = synth_attrs, 125 .name = "dummy", 126 }, 127 }; 128 129 module_param_named(ser, synth_dummy.ser, int, 0444); 130 module_param_named(dev, synth_dummy.dev_name, charp, 0444); 131 module_param_named(start, synth_dummy.startup, short, 0444); 132 133 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); 134 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); 135 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); 136 137 module_spk_synth(synth_dummy); 138 139 MODULE_AUTHOR("Samuel Thibault <samuel.thibault@ens-lyon.org>"); 140 MODULE_DESCRIPTION("Speakup support for text console"); 141 MODULE_LICENSE("GPL"); 142 MODULE_VERSION(DRV_VERSION); 143 144