Path: blob/master/drivers/accessibility/speakup/speakup_dummy.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* eventually modified by Samuel Thibault <[email protected]>5*6* Copyright (C) 1998-99 Kirk Reiser.7* Copyright (C) 2003 David Borowski.8* Copyright (C) 2007 Samuel Thibault.9*10* specifically written as a driver for the speakup screenreview11* s not a general device driver.12*/13#include "spk_priv.h"14#include "speakup.h"1516#define PROCSPEECH '\n'17#define DRV_VERSION "2.11"18#define SYNTH_CLEAR '!'192021enum default_vars_id {22CAPS_START_ID = 0, CAPS_STOP_ID,23PAUSE_ID,24RATE_ID, PITCH_ID, INFLECTION_ID,25VOL_ID, TONE_ID, PUNCT_ID,26DIRECT_ID, V_LAST_VAR_ID,27NB_ID28};2930313233static struct var_t vars[NB_ID] = {34[CAPS_START_ID] = { CAPS_START, .u.s = {"CAPS_START\n" } },35[CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"CAPS_STOP\n" } },36[PAUSE_ID] = { PAUSE, .u.s = {"PAUSE\n"} },37[RATE_ID] = { RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },38[PITCH_ID] = { PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },39[INFLECTION_ID] = { INFLECTION, .u.n = {"INFLECTION %d\n", 8, 0, 16, 0, 0, NULL } },40[VOL_ID] = { VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },41[TONE_ID] = { TONE, .u.n = {"TONE %d\n", 8, 0, 16, 0, 0, NULL } },42[PUNCT_ID] = { PUNCT, .u.n = {"PUNCT %d\n", 0, 0, 3, 0, 0, NULL } },43[DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },44V_LAST_VAR45};4647/*48* These attributes will appear in /sys/accessibility/speakup/dummy.49*/50static struct kobj_attribute caps_start_attribute =51__ATTR(caps_start, 0644, spk_var_show, spk_var_store);52static struct kobj_attribute caps_stop_attribute =53__ATTR(caps_stop, 0644, spk_var_show, spk_var_store);54static struct kobj_attribute pitch_attribute =55__ATTR(pitch, 0644, spk_var_show, spk_var_store);56static struct kobj_attribute inflection_attribute =57__ATTR(inflection, 0644, spk_var_show, spk_var_store);58static struct kobj_attribute punct_attribute =59__ATTR(punct, 0644, spk_var_show, spk_var_store);60static struct kobj_attribute rate_attribute =61__ATTR(rate, 0644, spk_var_show, spk_var_store);62static struct kobj_attribute tone_attribute =63__ATTR(tone, 0644, spk_var_show, spk_var_store);64static struct kobj_attribute vol_attribute =65__ATTR(vol, 0644, spk_var_show, spk_var_store);6667static struct kobj_attribute delay_time_attribute =68__ATTR(delay_time, 0644, spk_var_show, spk_var_store);69static struct kobj_attribute direct_attribute =70__ATTR(direct, 0644, spk_var_show, spk_var_store);71static struct kobj_attribute full_time_attribute =72__ATTR(full_time, 0644, spk_var_show, spk_var_store);73static struct kobj_attribute jiffy_delta_attribute =74__ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);75static struct kobj_attribute trigger_time_attribute =76__ATTR(trigger_time, 0644, spk_var_show, spk_var_store);7778/*79* Create a group of attributes so that we can create and destroy them all80* at once.81*/82static struct attribute *synth_attrs[] = {83&caps_start_attribute.attr,84&caps_stop_attribute.attr,85&pitch_attribute.attr,86&inflection_attribute.attr,87&punct_attribute.attr,88&rate_attribute.attr,89&tone_attribute.attr,90&vol_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,96NULL, /* need to NULL terminate the list of attributes */97};9899static void read_buff_add(u_char c)100{101pr_info("speakup_dummy: got character %02x\n", c);102}103104static struct spk_synth synth_dummy = {105.name = "dummy",106.version = DRV_VERSION,107.long_name = "Dummy",108.init = "Speakup\n",109.procspeech = PROCSPEECH,110.clear = SYNTH_CLEAR,111.delay = 500,112.trigger = 50,113.jiffies = 50,114.full = 40000,115.dev_name = SYNTH_DEFAULT_DEV,116.startup = SYNTH_START,117.checkval = SYNTH_CHECK,118.vars = vars,119.io_ops = &spk_ttyio_ops,120.probe = spk_ttyio_synth_probe,121.release = spk_ttyio_release,122.synth_immediate = spk_ttyio_synth_immediate,123.catch_up = spk_do_catch_up_unicode,124.flush = spk_synth_flush,125.is_alive = spk_synth_is_alive_restart,126.synth_adjust = NULL,127.read_buff_add = read_buff_add,128.get_index = NULL,129.indexing = {130.command = NULL,131.lowindex = 0,132.highindex = 0,133.currindex = 0,134},135.attributes = {136.attrs = synth_attrs,137.name = "dummy",138},139};140141module_param_named(ser, synth_dummy.ser, int, 0444);142module_param_named(dev, synth_dummy.dev_name, charp, 0444);143module_param_named(start, synth_dummy.startup, short, 0444);144module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444);145module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444);146module_param_named(inflection, vars[INFLECTION_ID].u.n.default_val, int, 0444);147module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444);148module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444);149module_param_named(punct, vars[PUNCT_ID].u.n.default_val, int, 0444);150module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444);151152153154155MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");156MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");157MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");158MODULE_PARM_DESC(rate, "Set the rate variable on load.");159MODULE_PARM_DESC(pitch, "Set the pitch variable on load.");160MODULE_PARM_DESC(inflection, "Set the inflection variable on load.");161MODULE_PARM_DESC(vol, "Set the vol variable on load.");162MODULE_PARM_DESC(tone, "Set the tone variable on load.");163MODULE_PARM_DESC(punct, "Set the punct variable on load.");164MODULE_PARM_DESC(direct, "Set the direct variable on load.");165166167module_spk_synth(synth_dummy);168169MODULE_AUTHOR("Samuel Thibault <[email protected]>");170MODULE_DESCRIPTION("Speakup support for text console");171MODULE_LICENSE("GPL");172MODULE_VERSION(DRV_VERSION);173174175176