2 * originally written by: Kirk Reiser <kirk@braille.uwo.ca>
3 * this version considerably modified by David Borowski, david575@rogers.com
5 * Copyright (C) 1998-99 Kirk Reiser.
6 * Copyright (C) 2003 David Borowski.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * specificly written as a driver for the speakup screenreview
19 * s not a general device driver.
23 #include "speakup_dtlk.h" /* local header file for LiteTalk values */
25 #define DRV_VERSION "2.11"
26 #define PROCSPEECH 0x0d
28 static int synth_probe(struct spk_synth *synth);
30 static struct var_t vars[] = {
31 { CAPS_START, .u.s = {"\x01+35p" } },
32 { CAPS_STOP, .u.s = {"\x01-35p" } },
33 { RATE, .u.n = {"\x01%ds", 8, 0, 9, 0, 0, NULL } },
34 { PITCH, .u.n = {"\x01%dp", 50, 0, 99, 0, 0, NULL } },
35 { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
36 { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } },
37 { PUNCT, .u.n = {"\x01%db", 7, 0, 15, 0, 0, NULL } },
38 { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } },
39 { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } },
40 { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
45 * These attributes will appear in /sys/accessibility/speakup/ltlk.
47 static struct kobj_attribute caps_start_attribute =
48 __ATTR(caps_start, 0644, spk_var_show, spk_var_store);
49 static struct kobj_attribute caps_stop_attribute =
50 __ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
51 static struct kobj_attribute freq_attribute =
52 __ATTR(freq, 0644, spk_var_show, spk_var_store);
53 static struct kobj_attribute pitch_attribute =
54 __ATTR(pitch, 0644, spk_var_show, spk_var_store);
55 static struct kobj_attribute punct_attribute =
56 __ATTR(punct, 0644, spk_var_show, spk_var_store);
57 static struct kobj_attribute rate_attribute =
58 __ATTR(rate, 0644, spk_var_show, spk_var_store);
59 static struct kobj_attribute tone_attribute =
60 __ATTR(tone, 0644, spk_var_show, spk_var_store);
61 static struct kobj_attribute voice_attribute =
62 __ATTR(voice, 0644, spk_var_show, spk_var_store);
63 static struct kobj_attribute vol_attribute =
64 __ATTR(vol, 0644, spk_var_show, spk_var_store);
66 static struct kobj_attribute delay_time_attribute =
67 __ATTR(delay_time, 0644, spk_var_show, spk_var_store);
68 static struct kobj_attribute direct_attribute =
69 __ATTR(direct, 0644, spk_var_show, spk_var_store);
70 static struct kobj_attribute full_time_attribute =
71 __ATTR(full_time, 0644, spk_var_show, spk_var_store);
72 static struct kobj_attribute jiffy_delta_attribute =
73 __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
74 static struct kobj_attribute trigger_time_attribute =
75 __ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
78 * Create a group of attributes so that we can create and destroy them all
81 static struct attribute *synth_attrs[] = {
82 &caps_start_attribute.attr,
83 &caps_stop_attribute.attr,
85 &pitch_attribute.attr,
86 &punct_attribute.attr,
89 &voice_attribute.attr,
91 &delay_time_attribute.attr,
92 &direct_attribute.attr,
93 &full_time_attribute.attr,
94 &jiffy_delta_attribute.attr,
95 &trigger_time_attribute.attr,
96 NULL, /* need to NULL terminate the list of attributes */
99 static struct spk_synth synth_ltlk = {
101 .version = DRV_VERSION,
102 .long_name = "LiteTalk",
103 .init = "\01@\x01\x31y\n\0",
104 .procspeech = PROCSPEECH,
105 .clear = SYNTH_CLEAR,
110 .dev_name = SYNTH_DEFAULT_DEV,
111 .startup = SYNTH_START,
112 .checkval = SYNTH_CHECK,
114 .io_ops = &spk_ttyio_ops,
115 .probe = synth_probe,
116 .release = spk_ttyio_release,
117 .synth_immediate = spk_ttyio_synth_immediate,
118 .catch_up = spk_do_catch_up,
119 .flush = spk_synth_flush,
120 .is_alive = spk_synth_is_alive_restart,
121 .synth_adjust = NULL,
122 .read_buff_add = NULL,
123 .get_index = spk_synth_get_index,
125 .command = "\x01%di",
131 .attrs = synth_attrs,
136 /* interrogate the LiteTalk and print its settings */
137 static void synth_interrogate(struct spk_synth *synth)
140 unsigned char buf[50], rom_v[20];
142 synth->synth_immediate(synth, "\x18\x01?");
143 for (i = 0; i < 50; i++) {
144 buf[i] = synth->io_ops->synth_in();
145 if (i > 2 && buf[i] == 0x7f)
149 for (i = 0; *t != '\r'; t++) {
155 pr_info("%s: ROM version: %s\n", synth->long_name, rom_v);
158 static int synth_probe(struct spk_synth *synth)
162 failed = spk_ttyio_synth_probe(synth);
164 synth_interrogate(synth);
165 synth->alive = !failed;
169 module_param_named(ser, synth_ltlk.ser, int, 0444);
170 module_param_named(dev, synth_ltlk.dev_name, charp, S_IRUGO);
171 module_param_named(start, synth_ltlk.startup, short, 0444);
173 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
174 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
175 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
177 module_spk_synth(synth_ltlk);
179 MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
180 MODULE_AUTHOR("David Borowski");
181 MODULE_DESCRIPTION("Speakup support for DoubleTalk LT/LiteTalk synthesizers");
182 MODULE_LICENSE("GPL");
183 MODULE_VERSION(DRV_VERSION);