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