Linux Audio

Check our new training course

Loading...
Note: File does not exist in v5.4.
  1// SPDX-License-Identifier: GPL-2.0+
  2/*
  3 * originally written by: Kirk Reiser <kirk@braille.uwo.ca>
  4 * this version considerably modified by David Borowski, david575@rogers.com
  5 * eventually modified by Samuel Thibault <samuel.thibault@ens-lyon.org>
  6 *
  7 * Copyright (C) 1998-99  Kirk Reiser.
  8 * Copyright (C) 2003 David Borowski.
  9 * Copyright (C) 2007 Samuel Thibault.
 10 *
 11 * specifically written as a driver for the speakup screenreview
 12 * s not a general device driver.
 13 */
 14#include "spk_priv.h"
 15#include "speakup.h"
 16
 17#define PROCSPEECH '\n'
 18#define DRV_VERSION "2.11"
 19#define SYNTH_CLEAR '!'
 20
 21
 22enum default_vars_id {
 23	CAPS_START_ID = 0, CAPS_STOP_ID,
 24	PAUSE_ID,
 25	RATE_ID, PITCH_ID, INFLECTION_ID,
 26	VOL_ID, TONE_ID, PUNCT_ID,
 27	DIRECT_ID, V_LAST_VAR_ID,
 28	NB_ID
 29};
 30
 31
 32
 33
 34static struct var_t vars[NB_ID] = {
 35	[CAPS_START_ID] = { CAPS_START, .u.s = {"CAPS_START\n" } },
 36	[CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"CAPS_STOP\n" } },
 37	[PAUSE_ID] = { PAUSE, .u.s = {"PAUSE\n"} },
 38	[RATE_ID] = { RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },
 39	[PITCH_ID] = { PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },
 40	[INFLECTION_ID] = { INFLECTION, .u.n = {"INFLECTION %d\n", 8, 0, 16, 0, 0, NULL } },
 41	[VOL_ID] = { VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },
 42	[TONE_ID] = { TONE, .u.n = {"TONE %d\n", 8, 0, 16, 0, 0, NULL } },
 43	[PUNCT_ID] = { PUNCT, .u.n = {"PUNCT %d\n", 0, 0, 3, 0, 0, NULL } },
 44	[DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
 45	V_LAST_VAR
 46};
 47
 48/*
 49 * These attributes will appear in /sys/accessibility/speakup/dummy.
 50 */
 51static struct kobj_attribute caps_start_attribute =
 52	__ATTR(caps_start, 0644, spk_var_show, spk_var_store);
 53static struct kobj_attribute caps_stop_attribute =
 54	__ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
 55static struct kobj_attribute pitch_attribute =
 56	__ATTR(pitch, 0644, spk_var_show, spk_var_store);
 57static struct kobj_attribute inflection_attribute =
 58	__ATTR(inflection, 0644, spk_var_show, spk_var_store);
 59static struct kobj_attribute punct_attribute =
 60	__ATTR(punct, 0644, spk_var_show, spk_var_store);
 61static struct kobj_attribute rate_attribute =
 62	__ATTR(rate, 0644, spk_var_show, spk_var_store);
 63static struct kobj_attribute tone_attribute =
 64	__ATTR(tone, 0644, spk_var_show, spk_var_store);
 65static struct kobj_attribute vol_attribute =
 66	__ATTR(vol, 0644, spk_var_show, spk_var_store);
 67
 68static struct kobj_attribute delay_time_attribute =
 69	__ATTR(delay_time, 0644, spk_var_show, spk_var_store);
 70static struct kobj_attribute direct_attribute =
 71	__ATTR(direct, 0644, spk_var_show, spk_var_store);
 72static struct kobj_attribute full_time_attribute =
 73	__ATTR(full_time, 0644, spk_var_show, spk_var_store);
 74static struct kobj_attribute jiffy_delta_attribute =
 75	__ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
 76static struct kobj_attribute trigger_time_attribute =
 77	__ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
 78
 79/*
 80 * Create a group of attributes so that we can create and destroy them all
 81 * at once.
 82 */
 83static struct attribute *synth_attrs[] = {
 84	&caps_start_attribute.attr,
 85	&caps_stop_attribute.attr,
 86	&pitch_attribute.attr,
 87	&inflection_attribute.attr,
 88	&punct_attribute.attr,
 89	&rate_attribute.attr,
 90	&tone_attribute.attr,
 91	&vol_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 */
 98};
 99
100static void read_buff_add(u_char c)
101{
102	pr_info("speakup_dummy: got character %02x\n", c);
103}
104
105static struct spk_synth synth_dummy = {
106	.name = "dummy",
107	.version = DRV_VERSION,
108	.long_name = "Dummy",
109	.init = "Speakup\n",
110	.procspeech = PROCSPEECH,
111	.clear = SYNTH_CLEAR,
112	.delay = 500,
113	.trigger = 50,
114	.jiffies = 50,
115	.full = 40000,
116	.dev_name = SYNTH_DEFAULT_DEV,
117	.startup = SYNTH_START,
118	.checkval = SYNTH_CHECK,
119	.vars = vars,
120	.io_ops = &spk_ttyio_ops,
121	.probe = spk_ttyio_synth_probe,
122	.release = spk_ttyio_release,
123	.synth_immediate = spk_ttyio_synth_immediate,
124	.catch_up = spk_do_catch_up_unicode,
125	.flush = spk_synth_flush,
126	.is_alive = spk_synth_is_alive_restart,
127	.synth_adjust = NULL,
128	.read_buff_add = read_buff_add,
129	.get_index = NULL,
130	.indexing = {
131		.command = NULL,
132		.lowindex = 0,
133		.highindex = 0,
134		.currindex = 0,
135	},
136	.attributes = {
137		.attrs = synth_attrs,
138		.name = "dummy",
139	},
140};
141
142module_param_named(ser, synth_dummy.ser, int, 0444);
143module_param_named(dev, synth_dummy.dev_name, charp, 0444);
144module_param_named(start, synth_dummy.startup, short, 0444);
145module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444);
146module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444);
147module_param_named(inflection, vars[INFLECTION_ID].u.n.default_val, int, 0444);
148module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444);
149module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444);
150module_param_named(punct, vars[PUNCT_ID].u.n.default_val, int, 0444);
151module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444);
152
153
154
155
156MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
157MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
158MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
159MODULE_PARM_DESC(rate, "Set the rate variable on load.");
160MODULE_PARM_DESC(pitch, "Set the pitch variable on load.");
161MODULE_PARM_DESC(inflection, "Set the inflection variable on load.");
162MODULE_PARM_DESC(vol, "Set the vol variable on load.");
163MODULE_PARM_DESC(tone, "Set the tone variable on load.");
164MODULE_PARM_DESC(punct, "Set the punct variable on load.");
165MODULE_PARM_DESC(direct, "Set the direct variable on load.");
166
167
168module_spk_synth(synth_dummy);
169
170MODULE_AUTHOR("Samuel Thibault <samuel.thibault@ens-lyon.org>");
171MODULE_DESCRIPTION("Speakup support for text console");
172MODULE_LICENSE("GPL");
173MODULE_VERSION(DRV_VERSION);
174