Path: blob/master/drivers/accessibility/speakup/speakup_acntsa.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* this code is specifically written as a driver for the speakup screenreview9* package and is not a general device driver.10*/1112#include "spk_priv.h"13#include "speakup.h"14#include "speakup_acnt.h" /* local header file for Accent values */1516#define DRV_VERSION "2.11"17#define PROCSPEECH '\r'1819static int synth_probe(struct spk_synth *synth);202122enum default_vars_id {23CAPS_START_ID = 0, CAPS_STOP_ID,24RATE_ID, PITCH_ID,25VOL_ID, TONE_ID,26DIRECT_ID, V_LAST_VAR_ID,27NB_ID28};293031static struct var_t vars[NB_ID] = {32[CAPS_START_ID] = { CAPS_START, .u.s = {"\033P8" } },33[CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\033P5" } },34[RATE_ID] = { RATE, .u.n = {"\033R%c", 9, 0, 17, 0, 0, "0123456789abcdefgh" } },35[PITCH_ID] = { PITCH, .u.n = {"\033P%d", 5, 0, 9, 0, 0, NULL } },36[VOL_ID] = { VOL, .u.n = {"\033A%d", 9, 0, 9, 0, 0, NULL } },37[TONE_ID] = { TONE, .u.n = {"\033V%d", 5, 0, 9, 0, 0, NULL } },38[DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },39V_LAST_VAR40};4142/*43* These attributes will appear in /sys/accessibility/speakup/acntsa.44*/45static struct kobj_attribute caps_start_attribute =46__ATTR(caps_start, 0644, spk_var_show, spk_var_store);47static struct kobj_attribute caps_stop_attribute =48__ATTR(caps_stop, 0644, spk_var_show, spk_var_store);49static struct kobj_attribute pitch_attribute =50__ATTR(pitch, 0644, spk_var_show, spk_var_store);51static struct kobj_attribute rate_attribute =52__ATTR(rate, 0644, spk_var_show, spk_var_store);53static struct kobj_attribute tone_attribute =54__ATTR(tone, 0644, spk_var_show, spk_var_store);55static struct kobj_attribute vol_attribute =56__ATTR(vol, 0644, spk_var_show, spk_var_store);5758static struct kobj_attribute delay_time_attribute =59__ATTR(delay_time, 0644, spk_var_show, spk_var_store);60static struct kobj_attribute direct_attribute =61__ATTR(direct, 0644, spk_var_show, spk_var_store);62static struct kobj_attribute full_time_attribute =63__ATTR(full_time, 0644, spk_var_show, spk_var_store);64static struct kobj_attribute jiffy_delta_attribute =65__ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);66static struct kobj_attribute trigger_time_attribute =67__ATTR(trigger_time, 0644, spk_var_show, spk_var_store);6869/*70* Create a group of attributes so that we can create and destroy them all71* at once.72*/73static struct attribute *synth_attrs[] = {74&caps_start_attribute.attr,75&caps_stop_attribute.attr,76&pitch_attribute.attr,77&rate_attribute.attr,78&tone_attribute.attr,79&vol_attribute.attr,80&delay_time_attribute.attr,81&direct_attribute.attr,82&full_time_attribute.attr,83&jiffy_delta_attribute.attr,84&trigger_time_attribute.attr,85NULL, /* need to NULL terminate the list of attributes */86};8788static struct spk_synth synth_acntsa = {89.name = "acntsa",90.version = DRV_VERSION,91.long_name = "Accent-SA",92.init = "\033T2\033=M\033Oi\033N1\n",93.procspeech = PROCSPEECH,94.clear = SYNTH_CLEAR,95.delay = 400,96.trigger = 50,97.jiffies = 30,98.full = 40000,99.dev_name = SYNTH_DEFAULT_DEV,100.startup = SYNTH_START,101.checkval = SYNTH_CHECK,102.vars = vars,103.io_ops = &spk_ttyio_ops,104.probe = synth_probe,105.release = spk_ttyio_release,106.synth_immediate = spk_ttyio_synth_immediate,107.catch_up = spk_do_catch_up,108.flush = spk_synth_flush,109.is_alive = spk_synth_is_alive_restart,110.synth_adjust = NULL,111.read_buff_add = NULL,112.get_index = NULL,113.indexing = {114.command = NULL,115.lowindex = 0,116.highindex = 0,117.currindex = 0,118},119.attributes = {120.attrs = synth_attrs,121.name = "acntsa",122},123};124125static int synth_probe(struct spk_synth *synth)126{127int failed;128129failed = spk_ttyio_synth_probe(synth);130if (failed == 0) {131synth->synth_immediate(synth, "\033=R\r");132mdelay(100);133}134synth->alive = !failed;135return failed;136}137138module_param_named(ser, synth_acntsa.ser, int, 0444);139module_param_named(dev, synth_acntsa.dev_name, charp, 0444);140module_param_named(start, synth_acntsa.startup, short, 0444);141module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444);142module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444);143module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444);144module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444);145module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444);146147MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");148MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");149MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");150MODULE_PARM_DESC(rate, "Set the rate variable on load.");151MODULE_PARM_DESC(pitch, "Set the pitch variable on load.");152MODULE_PARM_DESC(vol, "Set the vol variable on load.");153MODULE_PARM_DESC(tone, "Set the tone variable on load.");154MODULE_PARM_DESC(direct, "Set the direct variable on load.");155156157module_spk_synth(synth_acntsa);158159MODULE_AUTHOR("Kirk Reiser <[email protected]>");160MODULE_AUTHOR("David Borowski");161MODULE_DESCRIPTION("Speakup support for Accent SA synthesizer");162MODULE_LICENSE("GPL");163MODULE_VERSION(DRV_VERSION);164165166167