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 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * specificly written as a driver for the speakup screenreview
23 * s not a general device driver.
28 #include "speakup_dtlk.h" /* local header file for LiteTalk values */
30 #define DRV_VERSION "2.11"
31 #define synth_full( ) ( !( inb( synth_port_tts + UART_MSR ) & UART_MSR_CTS ) )
32 #define PROCSPEECH 0x0d
34 static int synth_probe(struct spk_synth
*synth
);
36 static struct var_t vars
[] = {
37 { CAPS_START
, .u
.s
= {"\x01+35p" }},
38 { CAPS_STOP
, .u
.s
= {"\x01-35p" }},
39 { RATE
, .u
.n
= {"\x01%ds", 8, 0, 9, 0, 0, NULL
}},
40 { PITCH
, .u
.n
= {"\x01%dp", 50, 0, 99, 0, 0, NULL
}},
41 { VOL
, .u
.n
= {"\x01%dv", 5, 0, 9, 0, 0, NULL
}},
42 { TONE
, .u
.n
= {"\x01%dx", 1, 0, 2, 0, 0, NULL
}},
43 { PUNCT
, .u
.n
= {"\x01%db", 7, 0, 15, 0, 0, NULL
}},
44 { VOICE
, .u
.n
= {"\x01%do", 0, 0, 7, 0, 0, NULL
}},
45 { FREQUENCY
, .u
.n
= {"\x01%df", 5, 0, 9, 0, 0, NULL
}},
46 { DIRECT
, .u
.n
= {NULL
, 0, 0, 1, 0, 0, NULL
}},
51 * These attributes will appear in /sys/accessibility/speakup/ltlk.
53 static struct kobj_attribute caps_start_attribute
=
54 __ATTR(caps_start
, USER_RW
, spk_var_show
, spk_var_store
);
55 static struct kobj_attribute caps_stop_attribute
=
56 __ATTR(caps_stop
, USER_RW
, spk_var_show
, spk_var_store
);
57 static struct kobj_attribute freq_attribute
=
58 __ATTR(freq
, USER_RW
, spk_var_show
, spk_var_store
);
59 static struct kobj_attribute pitch_attribute
=
60 __ATTR(pitch
, USER_RW
, spk_var_show
, spk_var_store
);
61 static struct kobj_attribute punct_attribute
=
62 __ATTR(punct
, USER_RW
, spk_var_show
, spk_var_store
);
63 static struct kobj_attribute rate_attribute
=
64 __ATTR(rate
, USER_RW
, spk_var_show
, spk_var_store
);
65 static struct kobj_attribute tone_attribute
=
66 __ATTR(tone
, USER_RW
, spk_var_show
, spk_var_store
);
67 static struct kobj_attribute voice_attribute
=
68 __ATTR(voice
, USER_RW
, spk_var_show
, spk_var_store
);
69 static struct kobj_attribute vol_attribute
=
70 __ATTR(vol
, USER_RW
, spk_var_show
, spk_var_store
);
72 static struct kobj_attribute delay_time_attribute
=
73 __ATTR(delay_time
, ROOT_W
, spk_var_show
, spk_var_store
);
74 static struct kobj_attribute direct_attribute
=
75 __ATTR(direct
, USER_RW
, spk_var_show
, spk_var_store
);
76 static struct kobj_attribute full_time_attribute
=
77 __ATTR(full_time
, ROOT_W
, spk_var_show
, spk_var_store
);
78 static struct kobj_attribute jiffy_delta_attribute
=
79 __ATTR(jiffy_delta
, ROOT_W
, spk_var_show
, spk_var_store
);
80 static struct kobj_attribute trigger_time_attribute
=
81 __ATTR(trigger_time
, ROOT_W
, spk_var_show
, spk_var_store
);
84 * Create a group of attributes so that we can create and destroy them all
87 static struct attribute
*synth_attrs
[] = {
88 &caps_start_attribute
.attr
,
89 &caps_stop_attribute
.attr
,
91 &pitch_attribute
.attr
,
92 &punct_attribute
.attr
,
95 &voice_attribute
.attr
,
97 &delay_time_attribute
.attr
,
98 &direct_attribute
.attr
,
99 &full_time_attribute
.attr
,
100 &jiffy_delta_attribute
.attr
,
101 &trigger_time_attribute
.attr
,
102 NULL
, /* need to NULL terminate the list of attributes */
105 static struct spk_synth synth_ltlk
= {
107 .version
= DRV_VERSION
,
108 .long_name
= "LiteTalk",
109 .init
= "\01@\x01\x31y\n\0",
110 .procspeech
= PROCSPEECH
,
111 .clear
= SYNTH_CLEAR
,
116 .startup
= SYNTH_START
,
117 .checkval
= SYNTH_CHECK
,
119 .probe
= synth_probe
,
120 .release
= spk_serial_release
,
121 .synth_immediate
= spk_synth_immediate
,
122 .catch_up
= spk_do_catch_up
,
123 .flush
= spk_synth_flush
,
124 .is_alive
= spk_synth_is_alive_restart
,
125 .synth_adjust
= NULL
,
126 .read_buff_add
= NULL
,
127 .get_index
= spk_serial_in_nowait
,
129 .command
= "\x01%di",
135 .attrs
= synth_attrs
,
140 /* interrogate the LiteTalk and print its settings */
141 static void synth_interrogate(struct spk_synth
*synth
)
144 unsigned char buf
[50], rom_v
[20];
145 spk_synth_immediate(synth
, "\x18\x01?");
146 for (i
= 0; i
< 50; i
++) {
147 buf
[i
] = spk_serial_in();
148 if (i
> 2 && buf
[i
] == 0x7f)
152 for (i
= 0; *t
!= '\r'; t
++) {
158 pr_info("%s: ROM version: %s\n", synth
->long_name
, rom_v
);
161 static int synth_probe(struct spk_synth
*synth
)
165 failed
= serial_synth_probe(synth
);
167 synth_interrogate(synth
);
168 synth
->alive
= !failed
;
172 module_param_named(ser
, synth_ltlk
.ser
, int, S_IRUGO
);
173 module_param_named(start
, synth_ltlk
.startup
, short, S_IRUGO
);
175 MODULE_PARM_DESC(ser
, "Set the serial port for the synthesizer (0-based).");
176 MODULE_PARM_DESC(start
, "Start the synthesizer once it is loaded.");
178 static int __init
ltlk_init(void)
180 return synth_add(&synth_ltlk
);
183 static void __exit
ltlk_exit(void)
185 synth_remove(&synth_ltlk
);
188 module_init(ltlk_init
);
189 module_exit(ltlk_exit
);
190 MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
191 MODULE_AUTHOR("David Borowski");
192 MODULE_DESCRIPTION("Speakup support for DoubleTalk LT/LiteTalk synthesizers");
193 MODULE_LICENSE("GPL");
194 MODULE_VERSION(DRV_VERSION
);