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.
24 #include "speakup_dtlk.h" /* local header file for LiteTalk values */
26 #define DRV_VERSION "2.11"
27 #define PROCSPEECH 0x0d
29 static int synth_probe(struct spk_synth *synth);
31 static struct var_t vars[] = {
32 { CAPS_START, .u.s = {"\x01+35p" } },
33 { CAPS_STOP, .u.s = {"\x01-35p" } },
34 { RATE, .u.n = {"\x01%ds", 8, 0, 9, 0, 0, NULL } },
35 { PITCH, .u.n = {"\x01%dp", 50, 0, 99, 0, 0, NULL } },
36 { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
37 { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } },
38 { PUNCT, .u.n = {"\x01%db", 7, 0, 15, 0, 0, NULL } },
39 { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } },
40 { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } },
41 { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
46 * These attributes will appear in /sys/accessibility/speakup/ltlk.
48 static struct kobj_attribute caps_start_attribute =
49 __ATTR(caps_start, 0644, spk_var_show, spk_var_store);
50 static struct kobj_attribute caps_stop_attribute =
51 __ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
52 static struct kobj_attribute freq_attribute =
53 __ATTR(freq, 0644, spk_var_show, spk_var_store);
54 static struct kobj_attribute pitch_attribute =
55 __ATTR(pitch, 0644, spk_var_show, spk_var_store);
56 static struct kobj_attribute punct_attribute =
57 __ATTR(punct, 0644, spk_var_show, spk_var_store);
58 static struct kobj_attribute rate_attribute =
59 __ATTR(rate, 0644, spk_var_show, spk_var_store);
60 static struct kobj_attribute tone_attribute =
61 __ATTR(tone, 0644, spk_var_show, spk_var_store);
62 static struct kobj_attribute voice_attribute =
63 __ATTR(voice, 0644, spk_var_show, spk_var_store);
64 static struct kobj_attribute vol_attribute =
65 __ATTR(vol, 0644, spk_var_show, spk_var_store);
67 static struct kobj_attribute delay_time_attribute =
68 __ATTR(delay_time, 0644, spk_var_show, spk_var_store);
69 static struct kobj_attribute direct_attribute =
70 __ATTR(direct, 0644, spk_var_show, spk_var_store);
71 static struct kobj_attribute full_time_attribute =
72 __ATTR(full_time, 0644, spk_var_show, spk_var_store);
73 static struct kobj_attribute jiffy_delta_attribute =
74 __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
75 static struct kobj_attribute trigger_time_attribute =
76 __ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
79 * Create a group of attributes so that we can create and destroy them all
82 static struct attribute *synth_attrs[] = {
83 &caps_start_attribute.attr,
84 &caps_stop_attribute.attr,
86 &pitch_attribute.attr,
87 &punct_attribute.attr,
90 &voice_attribute.attr,
92 &delay_time_attribute.attr,
93 &direct_attribute.attr,
94 &full_time_attribute.attr,
95 &jiffy_delta_attribute.attr,
96 &trigger_time_attribute.attr,
97 NULL, /* need to NULL terminate the list of attributes */
100 static struct spk_synth synth_ltlk = {
102 .version = DRV_VERSION,
103 .long_name = "LiteTalk",
104 .init = "\01@\x01\x31y\n\0",
105 .procspeech = PROCSPEECH,
106 .clear = SYNTH_CLEAR,
111 .startup = SYNTH_START,
112 .checkval = SYNTH_CHECK,
114 .probe = synth_probe,
115 .release = spk_serial_release,
116 .synth_immediate = spk_synth_immediate,
117 .catch_up = spk_do_catch_up,
118 .flush = spk_synth_flush,
119 .is_alive = spk_synth_is_alive_restart,
120 .synth_adjust = NULL,
121 .read_buff_add = NULL,
122 .get_index = spk_serial_in_nowait,
124 .command = "\x01%di",
130 .attrs = synth_attrs,
135 /* interrogate the LiteTalk and print its settings */
136 static void synth_interrogate(struct spk_synth *synth)
139 unsigned char buf[50], rom_v[20];
141 spk_synth_immediate(synth, "\x18\x01?");
142 for (i = 0; i < 50; i++) {
143 buf[i] = spk_serial_in();
144 if (i > 2 && buf[i] == 0x7f)
148 for (i = 0; *t != '\r'; t++) {
154 pr_info("%s: ROM version: %s\n", synth->long_name, rom_v);
157 static int synth_probe(struct spk_synth *synth)
161 failed = spk_serial_synth_probe(synth);
163 synth_interrogate(synth);
164 synth->alive = !failed;
168 module_param_named(ser, synth_ltlk.ser, int, 0444);
169 module_param_named(start, synth_ltlk.startup, short, 0444);
171 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
172 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
174 module_spk_synth(synth_ltlk);
176 MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
177 MODULE_AUTHOR("David Borowski");
178 MODULE_DESCRIPTION("Speakup support for DoubleTalk LT/LiteTalk synthesizers");
179 MODULE_LICENSE("GPL");
180 MODULE_VERSION(DRV_VERSION);