cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

speakup_txprt.c (4034B)


      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 *
      6 * Copyright (C) 1998-99  Kirk Reiser.
      7 * Copyright (C) 2003 David Borowski.
      8 *
      9 * specifically written as a driver for the speakup screenreview
     10 * s not a general device driver.
     11 */
     12#include "spk_priv.h"
     13#include "speakup.h"
     14
     15#define DRV_VERSION "2.11"
     16#define SYNTH_CLEAR 0x18
     17#define PROCSPEECH '\r' /* process speech char */
     18
     19static struct var_t vars[] = {
     20	{ CAPS_START, .u.s = {"\x05P8" } },
     21	{ CAPS_STOP, .u.s = {"\x05P5" } },
     22	{ RATE, .u.n = {"\x05R%d", 5, 0, 9, 0, 0, NULL } },
     23	{ PITCH, .u.n = {"\x05P%d", 5, 0, 9, 0, 0, NULL } },
     24	{ VOL, .u.n = {"\x05V%d", 5, 0, 9, 0, 0, NULL } },
     25	{ TONE, .u.n = {"\x05T%c", 12, 0, 25, 61, 0, NULL } },
     26	{ DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
     27	V_LAST_VAR
     28	 };
     29
     30/* These attributes will appear in /sys/accessibility/speakup/txprt. */
     31
     32static struct kobj_attribute caps_start_attribute =
     33	__ATTR(caps_start, 0644, spk_var_show, spk_var_store);
     34static struct kobj_attribute caps_stop_attribute =
     35	__ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
     36static struct kobj_attribute pitch_attribute =
     37	__ATTR(pitch, 0644, spk_var_show, spk_var_store);
     38static struct kobj_attribute rate_attribute =
     39	__ATTR(rate, 0644, spk_var_show, spk_var_store);
     40static struct kobj_attribute tone_attribute =
     41	__ATTR(tone, 0644, spk_var_show, spk_var_store);
     42static struct kobj_attribute vol_attribute =
     43	__ATTR(vol, 0644, spk_var_show, spk_var_store);
     44
     45static struct kobj_attribute delay_time_attribute =
     46	__ATTR(delay_time, 0644, spk_var_show, spk_var_store);
     47static struct kobj_attribute direct_attribute =
     48	__ATTR(direct, 0644, spk_var_show, spk_var_store);
     49static struct kobj_attribute full_time_attribute =
     50	__ATTR(full_time, 0644, spk_var_show, spk_var_store);
     51static struct kobj_attribute jiffy_delta_attribute =
     52	__ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
     53static struct kobj_attribute trigger_time_attribute =
     54	__ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
     55
     56/*
     57 * Create a group of attributes so that we can create and destroy them all
     58 * at once.
     59 */
     60static struct attribute *synth_attrs[] = {
     61	&caps_start_attribute.attr,
     62	&caps_stop_attribute.attr,
     63	&pitch_attribute.attr,
     64	&rate_attribute.attr,
     65	&tone_attribute.attr,
     66	&vol_attribute.attr,
     67	&delay_time_attribute.attr,
     68	&direct_attribute.attr,
     69	&full_time_attribute.attr,
     70	&jiffy_delta_attribute.attr,
     71	&trigger_time_attribute.attr,
     72	NULL,	/* need to NULL terminate the list of attributes */
     73};
     74
     75static struct spk_synth synth_txprt = {
     76	.name = "txprt",
     77	.version = DRV_VERSION,
     78	.long_name = "Transport",
     79	.init = "\x05N1",
     80	.procspeech = PROCSPEECH,
     81	.clear = SYNTH_CLEAR,
     82	.delay = 500,
     83	.trigger = 50,
     84	.jiffies = 50,
     85	.full = 40000,
     86	.dev_name = SYNTH_DEFAULT_DEV,
     87	.startup = SYNTH_START,
     88	.checkval = SYNTH_CHECK,
     89	.vars = vars,
     90	.io_ops = &spk_ttyio_ops,
     91	.probe = spk_ttyio_synth_probe,
     92	.release = spk_ttyio_release,
     93	.synth_immediate = spk_ttyio_synth_immediate,
     94	.catch_up = spk_do_catch_up,
     95	.flush = spk_synth_flush,
     96	.is_alive = spk_synth_is_alive_restart,
     97	.synth_adjust = NULL,
     98	.read_buff_add = NULL,
     99	.get_index = NULL,
    100	.indexing = {
    101		.command = NULL,
    102		.lowindex = 0,
    103		.highindex = 0,
    104		.currindex = 0,
    105	},
    106	.attributes = {
    107		.attrs = synth_attrs,
    108		.name = "txprt",
    109	},
    110};
    111
    112module_param_named(ser, synth_txprt.ser, int, 0444);
    113module_param_named(dev, synth_txprt.dev_name, charp, 0444);
    114module_param_named(start, synth_txprt.startup, short, 0444);
    115
    116MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
    117MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
    118MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
    119
    120module_spk_synth(synth_txprt);
    121
    122MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
    123MODULE_AUTHOR("David Borowski");
    124MODULE_DESCRIPTION("Speakup support for Transport synthesizers");
    125MODULE_LICENSE("GPL");
    126MODULE_VERSION(DRV_VERSION);
    127