Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * originally written by: Kirk Reiser <kirk@braille.uwo.ca>
0004  * this version considerably modified by David Borowski, david575@rogers.com
0005  *
0006  * Copyright (C) 1998-99  Kirk Reiser.
0007  * Copyright (C) 2003 David Borowski.
0008  *
0009  * this code is specifically written as a driver for the speakup screenreview
0010  * package and is not a general device driver.
0011  */
0012 
0013 #include "spk_priv.h"
0014 #include "speakup.h"
0015 #include "speakup_acnt.h" /* local header file for Accent values */
0016 
0017 #define DRV_VERSION "2.11"
0018 #define PROCSPEECH '\r'
0019 
0020 static int synth_probe(struct spk_synth *synth);
0021 
0022 static struct var_t vars[] = {
0023     { CAPS_START, .u.s = {"\033P8" } },
0024     { CAPS_STOP, .u.s = {"\033P5" } },
0025     { RATE, .u.n = {"\033R%c", 9, 0, 17, 0, 0, "0123456789abcdefgh" } },
0026     { PITCH, .u.n = {"\033P%d", 5, 0, 9, 0, 0, NULL } },
0027     { VOL, .u.n = {"\033A%d", 9, 0, 9, 0, 0, NULL } },
0028     { TONE, .u.n = {"\033V%d", 5, 0, 9, 0, 0, NULL } },
0029     { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
0030     V_LAST_VAR
0031 };
0032 
0033 /*
0034  * These attributes will appear in /sys/accessibility/speakup/acntsa.
0035  */
0036 static struct kobj_attribute caps_start_attribute =
0037     __ATTR(caps_start, 0644, spk_var_show, spk_var_store);
0038 static struct kobj_attribute caps_stop_attribute =
0039     __ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
0040 static struct kobj_attribute pitch_attribute =
0041     __ATTR(pitch, 0644, spk_var_show, spk_var_store);
0042 static struct kobj_attribute rate_attribute =
0043     __ATTR(rate, 0644, spk_var_show, spk_var_store);
0044 static struct kobj_attribute tone_attribute =
0045     __ATTR(tone, 0644, spk_var_show, spk_var_store);
0046 static struct kobj_attribute vol_attribute =
0047     __ATTR(vol, 0644, spk_var_show, spk_var_store);
0048 
0049 static struct kobj_attribute delay_time_attribute =
0050     __ATTR(delay_time, 0644, spk_var_show, spk_var_store);
0051 static struct kobj_attribute direct_attribute =
0052     __ATTR(direct, 0644, spk_var_show, spk_var_store);
0053 static struct kobj_attribute full_time_attribute =
0054     __ATTR(full_time, 0644, spk_var_show, spk_var_store);
0055 static struct kobj_attribute jiffy_delta_attribute =
0056     __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
0057 static struct kobj_attribute trigger_time_attribute =
0058     __ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
0059 
0060 /*
0061  * Create a group of attributes so that we can create and destroy them all
0062  * at once.
0063  */
0064 static struct attribute *synth_attrs[] = {
0065     &caps_start_attribute.attr,
0066     &caps_stop_attribute.attr,
0067     &pitch_attribute.attr,
0068     &rate_attribute.attr,
0069     &tone_attribute.attr,
0070     &vol_attribute.attr,
0071     &delay_time_attribute.attr,
0072     &direct_attribute.attr,
0073     &full_time_attribute.attr,
0074     &jiffy_delta_attribute.attr,
0075     &trigger_time_attribute.attr,
0076     NULL,   /* need to NULL terminate the list of attributes */
0077 };
0078 
0079 static struct spk_synth synth_acntsa = {
0080     .name = "acntsa",
0081     .version = DRV_VERSION,
0082     .long_name = "Accent-SA",
0083     .init = "\033T2\033=M\033Oi\033N1\n",
0084     .procspeech = PROCSPEECH,
0085     .clear = SYNTH_CLEAR,
0086     .delay = 400,
0087     .trigger = 50,
0088     .jiffies = 30,
0089     .full = 40000,
0090     .dev_name = SYNTH_DEFAULT_DEV,
0091     .startup = SYNTH_START,
0092     .checkval = SYNTH_CHECK,
0093     .vars = vars,
0094     .io_ops = &spk_ttyio_ops,
0095     .probe = synth_probe,
0096     .release = spk_ttyio_release,
0097     .synth_immediate = spk_ttyio_synth_immediate,
0098     .catch_up = spk_do_catch_up,
0099     .flush = spk_synth_flush,
0100     .is_alive = spk_synth_is_alive_restart,
0101     .synth_adjust = NULL,
0102     .read_buff_add = NULL,
0103     .get_index = NULL,
0104     .indexing = {
0105         .command = NULL,
0106         .lowindex = 0,
0107         .highindex = 0,
0108         .currindex = 0,
0109     },
0110     .attributes = {
0111         .attrs = synth_attrs,
0112         .name = "acntsa",
0113     },
0114 };
0115 
0116 static int synth_probe(struct spk_synth *synth)
0117 {
0118     int failed;
0119 
0120     failed = spk_ttyio_synth_probe(synth);
0121     if (failed == 0) {
0122         synth->synth_immediate(synth, "\033=R\r");
0123         mdelay(100);
0124     }
0125     synth->alive = !failed;
0126     return failed;
0127 }
0128 
0129 module_param_named(ser, synth_acntsa.ser, int, 0444);
0130 module_param_named(dev, synth_acntsa.dev_name, charp, 0444);
0131 module_param_named(start, synth_acntsa.startup, short, 0444);
0132 
0133 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
0134 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
0135 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
0136 
0137 module_spk_synth(synth_acntsa);
0138 
0139 MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
0140 MODULE_AUTHOR("David Borowski");
0141 MODULE_DESCRIPTION("Speakup support for Accent SA synthesizer");
0142 MODULE_LICENSE("GPL");
0143 MODULE_VERSION(DRV_VERSION);
0144