1c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs/* 2c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * originally written by: Kirk Reiser <kirk@braille.uwo.ca> 3c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs* this version considerably modified by David Borowski, david575@rogers.com 4c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * 5c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * Copyright (C) 1998-99 Kirk Reiser. 6c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * Copyright (C) 2003 David Borowski. 7c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * 8c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * This program is free software; you can redistribute it and/or modify 9c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * it under the terms of the GNU General Public License as published by 10c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * the Free Software Foundation; either version 2 of the License, or 11c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * (at your option) any later version. 12c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * 13c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * This program is distributed in the hope that it will be useful, 14c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * but WITHOUT ANY WARRANTY; without even the implied warranty of 15c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * GNU General Public License for more details. 17c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * 18c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * You should have received a copy of the GNU General Public License 19c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * along with this program; if not, write to the Free Software 20c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * 22c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * this code is specificly written as a driver for the speakup screenreview 23c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * package and is not a general device driver. 24c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs */ 25c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 26c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs#include "spk_priv.h" 27c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs#include "speakup.h" 28c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs#include "speakup_acnt.h" /* local header file for Accent values */ 29c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 30c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs#define DRV_VERSION "2.11" 31c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs#define PROCSPEECH '\r' 32c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 33c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic int synth_probe(struct spk_synth *synth); 34c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 35c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct var_t vars[] = { 3628ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { CAPS_START, .u.s = {"\033P8" } }, 3728ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { CAPS_STOP, .u.s = {"\033P5" } }, 3828ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { RATE, .u.n = {"\033R%c", 9, 0, 17, 0, 0, "0123456789abcdefgh" } }, 3928ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { PITCH, .u.n = {"\033P%d", 5, 0, 9, 0, 0, NULL } }, 4028ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { VOL, .u.n = {"\033A%d", 9, 0, 9, 0, 0, NULL } }, 4128ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { TONE, .u.n = {"\033V%d", 5, 0, 9, 0, 0, NULL } }, 4228ba8677bcbe9c0365b32d6007a344b49c8c1204Christopher Brannon { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 43c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs V_LAST_VAR 44c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs}; 45c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 46c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs/* 47c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * These attributes will appear in /sys/accessibility/speakup/acntsa. 48c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs */ 49c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute caps_start_attribute = 50c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(caps_start, USER_RW, spk_var_show, spk_var_store); 51c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute caps_stop_attribute = 52c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(caps_stop, USER_RW, spk_var_show, spk_var_store); 53c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute pitch_attribute = 54c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(pitch, USER_RW, spk_var_show, spk_var_store); 55c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute rate_attribute = 56c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(rate, USER_RW, spk_var_show, spk_var_store); 57c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute tone_attribute = 58c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(tone, USER_RW, spk_var_show, spk_var_store); 59c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute vol_attribute = 60c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(vol, USER_RW, spk_var_show, spk_var_store); 61c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 62c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute delay_time_attribute = 63c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(delay_time, ROOT_W, spk_var_show, spk_var_store); 64c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute direct_attribute = 65c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(direct, USER_RW, spk_var_show, spk_var_store); 66c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute full_time_attribute = 67c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(full_time, ROOT_W, spk_var_show, spk_var_store); 68c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute jiffy_delta_attribute = 69c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(jiffy_delta, ROOT_W, spk_var_show, spk_var_store); 70c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct kobj_attribute trigger_time_attribute = 71c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs __ATTR(trigger_time, ROOT_W, spk_var_show, spk_var_store); 72c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 73c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs/* 74c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * Create a group of attributes so that we can create and destroy them all 75c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs * at once. 76c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs */ 77c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct attribute *synth_attrs[] = { 78c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &caps_start_attribute.attr, 79c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &caps_stop_attribute.attr, 80c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &pitch_attribute.attr, 81c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &rate_attribute.attr, 82c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &tone_attribute.attr, 83c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &vol_attribute.attr, 84c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &delay_time_attribute.attr, 85c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &direct_attribute.attr, 86c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &full_time_attribute.attr, 87c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &jiffy_delta_attribute.attr, 88c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs &trigger_time_attribute.attr, 89c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs NULL, /* need to NULL terminate the list of attributes */ 90c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs}; 91c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 92c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic struct spk_synth synth_acntsa = { 93c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .name = "acntsa", 94c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .version = DRV_VERSION, 95c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .long_name = "Accent-SA", 96c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .init = "\033T2\033=M\033Oi\033N1\n", 97c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .procspeech = PROCSPEECH, 98c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .clear = SYNTH_CLEAR, 99c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .delay = 400, 100c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .trigger = 50, 101c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .jiffies = 30, 102c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .full = 40000, 103c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .startup = SYNTH_START, 104c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .checkval = SYNTH_CHECK, 105c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .vars = vars, 106c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .probe = synth_probe, 107c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .release = spk_serial_release, 108c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .synth_immediate = spk_synth_immediate, 109c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .catch_up = spk_do_catch_up, 110c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .flush = spk_synth_flush, 111c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .is_alive = spk_synth_is_alive_restart, 112c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .synth_adjust = NULL, 113c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .read_buff_add = NULL, 114c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .get_index = NULL, 115c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .indexing = { 116c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .command = NULL, 117c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .lowindex = 0, 118c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .highindex = 0, 119c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .currindex = 0, 120c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs }, 121c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .attributes = { 122c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .attrs = synth_attrs, 123c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs .name = "acntsa", 124c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs }, 125c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs}; 126c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 127c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic int synth_probe(struct spk_synth *synth) 128c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs{ 129c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs int failed; 130c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 131c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs failed = serial_synth_probe(synth); 132c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs if (failed == 0) { 133c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs spk_synth_immediate(synth, "\033=R\r"); 134c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs mdelay(100); 135c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs } 136c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs synth->alive = !failed; 137c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs return failed; 138c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs} 139c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 140c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsmodule_param_named(ser, synth_acntsa.ser, int, S_IRUGO); 141c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsmodule_param_named(start, synth_acntsa.startup, short, S_IRUGO); 142c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 143c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); 144c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); 145c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 146c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic int __init acntsa_init(void) 147c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs{ 148c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs return synth_add(&synth_acntsa); 149c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs} 150c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 151c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsstatic void __exit acntsa_exit(void) 152c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs{ 153c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs synth_remove(&synth_acntsa); 154c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs} 155c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 156c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsmodule_init(acntsa_init); 157c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbsmodule_exit(acntsa_exit); 158c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>"); 159c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_AUTHOR("David Borowski"); 160c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_DESCRIPTION("Speakup support for Accent SA synthesizer"); 161c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_LICENSE("GPL"); 162c6e3fd22cd538365bfeb82997d5b89562e077d42William HubbsMODULE_VERSION(DRV_VERSION); 163c6e3fd22cd538365bfeb82997d5b89562e077d42William Hubbs 164