Path: blob/master/drivers/accessibility/speakup/speakup_bns.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*/11#include "spk_priv.h"12#include "speakup.h"1314#define DRV_VERSION "2.11"15#define SYNTH_CLEAR 0x1816#define PROCSPEECH '\r'171819enum default_vars_id {20CAPS_START_ID = 0, CAPS_STOP_ID,21RATE_ID, PITCH_ID,22VOL_ID, TONE_ID,23DIRECT_ID, V_LAST_VAR_ID,24NB_ID25};2627static struct var_t vars[NB_ID] = {28[CAPS_START_ID] = { CAPS_START, .u.s = {"\x05\x31\x32P" } },29[CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x05\x38P" } },30[RATE_ID] = { RATE, .u.n = {"\x05%dE", 8, 1, 16, 0, 0, NULL } },31[PITCH_ID] = { PITCH, .u.n = {"\x05%dP", 8, 0, 16, 0, 0, NULL } },32[VOL_ID] = { VOL, .u.n = {"\x05%dV", 8, 0, 16, 0, 0, NULL } },33[TONE_ID] = { TONE, .u.n = {"\x05%dT", 8, 0, 16, 0, 0, NULL } },34[DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },35V_LAST_VAR36};3738/*39* These attributes will appear in /sys/accessibility/speakup/bns.40*/41static struct kobj_attribute caps_start_attribute =42__ATTR(caps_start, 0644, spk_var_show, spk_var_store);43static struct kobj_attribute caps_stop_attribute =44__ATTR(caps_stop, 0644, spk_var_show, spk_var_store);45static struct kobj_attribute pitch_attribute =46__ATTR(pitch, 0644, spk_var_show, spk_var_store);47static struct kobj_attribute rate_attribute =48__ATTR(rate, 0644, spk_var_show, spk_var_store);49static struct kobj_attribute tone_attribute =50__ATTR(tone, 0644, spk_var_show, spk_var_store);51static struct kobj_attribute vol_attribute =52__ATTR(vol, 0644, spk_var_show, spk_var_store);5354static struct kobj_attribute delay_time_attribute =55__ATTR(delay_time, 0644, spk_var_show, spk_var_store);56static struct kobj_attribute direct_attribute =57__ATTR(direct, 0644, spk_var_show, spk_var_store);58static struct kobj_attribute full_time_attribute =59__ATTR(full_time, 0644, spk_var_show, spk_var_store);60static struct kobj_attribute jiffy_delta_attribute =61__ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);62static struct kobj_attribute trigger_time_attribute =63__ATTR(trigger_time, 0644, spk_var_show, spk_var_store);6465/*66* Create a group of attributes so that we can create and destroy them all67* at once.68*/69static struct attribute *synth_attrs[] = {70&caps_start_attribute.attr,71&caps_stop_attribute.attr,72&pitch_attribute.attr,73&rate_attribute.attr,74&tone_attribute.attr,75&vol_attribute.attr,76&delay_time_attribute.attr,77&direct_attribute.attr,78&full_time_attribute.attr,79&jiffy_delta_attribute.attr,80&trigger_time_attribute.attr,81NULL, /* need to NULL terminate the list of attributes */82};8384static struct spk_synth synth_bns = {85.name = "bns",86.version = DRV_VERSION,87.long_name = "Braille 'N Speak",88.init = "\x05Z\x05\x43",89.procspeech = PROCSPEECH,90.clear = SYNTH_CLEAR,91.delay = 500,92.trigger = 50,93.jiffies = 50,94.full = 40000,95.dev_name = SYNTH_DEFAULT_DEV,96.startup = SYNTH_START,97.checkval = SYNTH_CHECK,98.vars = vars,99.io_ops = &spk_ttyio_ops,100.probe = spk_ttyio_synth_probe,101.release = spk_ttyio_release,102.synth_immediate = spk_ttyio_synth_immediate,103.catch_up = spk_do_catch_up,104.flush = spk_synth_flush,105.is_alive = spk_synth_is_alive_restart,106.synth_adjust = NULL,107.read_buff_add = NULL,108.get_index = NULL,109.indexing = {110.command = NULL,111.lowindex = 0,112.highindex = 0,113.currindex = 0,114},115.attributes = {116.attrs = synth_attrs,117.name = "bns",118},119};120121module_param_named(ser, synth_bns.ser, int, 0444);122module_param_named(dev, synth_bns.dev_name, charp, 0444);123module_param_named(start, synth_bns.startup, short, 0444);124module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444);125module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444);126module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444);127module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444);128module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444);129130131MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");132MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");133MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");134MODULE_PARM_DESC(rate, "Set the rate variable on load.");135MODULE_PARM_DESC(pitch, "Set the pitch variable on load.");136MODULE_PARM_DESC(vol, "Set the vol variable on load.");137MODULE_PARM_DESC(tone, "Set the tone variable on load.");138MODULE_PARM_DESC(direct, "Set the direct variable on load.");139140module_spk_synth(synth_bns);141142MODULE_AUTHOR("Kirk Reiser <[email protected]>");143MODULE_AUTHOR("David Borowski");144MODULE_DESCRIPTION("Speakup support for Braille 'n Speak synthesizers");145MODULE_LICENSE("GPL");146MODULE_VERSION(DRV_VERSION);147148149150