Path: blob/master/drivers/accessibility/speakup/speakup_txprt.c
26282 views
// SPDX-License-Identifier: GPL-2.0+1/*2* originally written by: Kirk Reiser <[email protected]>3* this version considerably modified by David Borowski, [email protected]4*5* Copyright (C) 1998-99 Kirk Reiser.6* Copyright (C) 2003 David Borowski.7*8* specifically written as a driver for the speakup screenreview9* s not a general device driver.10*/11#include "spk_priv.h"12#include "speakup.h"1314#define DRV_VERSION "2.11"15#define SYNTH_CLEAR 0x1816#define PROCSPEECH '\r' /* process speech char */1718192021enum default_vars_id {22CAPS_START_ID = 0, CAPS_STOP_ID,23RATE_ID, PITCH_ID,24VOL_ID, TONE_ID,25DIRECT_ID, V_LAST_VAR_ID,26NB_ID27};282930313233static struct var_t vars[NB_ID] = {34[CAPS_START_ID] = { CAPS_START, .u.s = {"\x05P8" } },35[CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x05P5" } },36[RATE_ID] = { RATE, .u.n = {"\x05R%d", 5, 0, 9, 0, 0, NULL } },37[PITCH_ID] = { PITCH, .u.n = {"\x05P%d", 5, 0, 9, 0, 0, NULL } },38[VOL_ID] = { VOL, .u.n = {"\x05V%d", 5, 0, 9, 0, 0, NULL } },39[TONE_ID] = { TONE, .u.n = {"\x05T%c", 12, 0, 25, 61, 0, NULL } },40[DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },41V_LAST_VAR42};4344/* These attributes will appear in /sys/accessibility/speakup/txprt. */4546static struct kobj_attribute caps_start_attribute =47__ATTR(caps_start, 0644, spk_var_show, spk_var_store);48static struct kobj_attribute caps_stop_attribute =49__ATTR(caps_stop, 0644, spk_var_show, spk_var_store);50static struct kobj_attribute pitch_attribute =51__ATTR(pitch, 0644, spk_var_show, spk_var_store);52static struct kobj_attribute rate_attribute =53__ATTR(rate, 0644, spk_var_show, spk_var_store);54static struct kobj_attribute tone_attribute =55__ATTR(tone, 0644, spk_var_show, spk_var_store);56static struct kobj_attribute vol_attribute =57__ATTR(vol, 0644, spk_var_show, spk_var_store);5859static struct kobj_attribute delay_time_attribute =60__ATTR(delay_time, 0644, spk_var_show, spk_var_store);61static struct kobj_attribute direct_attribute =62__ATTR(direct, 0644, spk_var_show, spk_var_store);63static struct kobj_attribute full_time_attribute =64__ATTR(full_time, 0644, spk_var_show, spk_var_store);65static struct kobj_attribute jiffy_delta_attribute =66__ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);67static struct kobj_attribute trigger_time_attribute =68__ATTR(trigger_time, 0644, spk_var_show, spk_var_store);6970/*71* Create a group of attributes so that we can create and destroy them all72* at once.73*/74static struct attribute *synth_attrs[] = {75&caps_start_attribute.attr,76&caps_stop_attribute.attr,77&pitch_attribute.attr,78&rate_attribute.attr,79&tone_attribute.attr,80&vol_attribute.attr,81&delay_time_attribute.attr,82&direct_attribute.attr,83&full_time_attribute.attr,84&jiffy_delta_attribute.attr,85&trigger_time_attribute.attr,86NULL, /* need to NULL terminate the list of attributes */87};8889static struct spk_synth synth_txprt = {90.name = "txprt",91.version = DRV_VERSION,92.long_name = "Transport",93.init = "\x05N1",94.procspeech = PROCSPEECH,95.clear = SYNTH_CLEAR,96.delay = 500,97.trigger = 50,98.jiffies = 50,99.full = 40000,100.dev_name = SYNTH_DEFAULT_DEV,101.startup = SYNTH_START,102.checkval = SYNTH_CHECK,103.vars = vars,104.io_ops = &spk_ttyio_ops,105.probe = spk_ttyio_synth_probe,106.release = spk_ttyio_release,107.synth_immediate = spk_ttyio_synth_immediate,108.catch_up = spk_do_catch_up,109.flush = spk_synth_flush,110.is_alive = spk_synth_is_alive_restart,111.synth_adjust = NULL,112.read_buff_add = NULL,113.get_index = NULL,114.indexing = {115.command = NULL,116.lowindex = 0,117.highindex = 0,118.currindex = 0,119},120.attributes = {121.attrs = synth_attrs,122.name = "txprt",123},124};125126module_param_named(ser, synth_txprt.ser, int, 0444);127module_param_named(dev, synth_txprt.dev_name, charp, 0444);128module_param_named(start, synth_txprt.startup, short, 0444);129module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444);130module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444);131module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444);132module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444);133module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444);134135136137MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");138MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");139MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");140MODULE_PARM_DESC(rate, "Set the rate variable on load.");141MODULE_PARM_DESC(pitch, "Set the pitch variable on load.");142MODULE_PARM_DESC(vol, "Set the vol variable on load.");143MODULE_PARM_DESC(tone, "Set the tone variable on load.");144MODULE_PARM_DESC(direct, "Set the direct variable on load.");145146147148module_spk_synth(synth_txprt);149150MODULE_AUTHOR("Kirk Reiser <[email protected]>");151MODULE_AUTHOR("David Borowski");152MODULE_DESCRIPTION("Speakup support for Transport synthesizers");153MODULE_LICENSE("GPL");154MODULE_VERSION(DRV_VERSION);155156157158