Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * originally written by: Kirk Reiser <kirk@braille.uwo.ca>
0004  * this version considerably modified by David Borowski, david575@rogers.com
0005  * eventually modified by Samuel Thibault <samuel.thibault@ens-lyon.org>
0006  *
0007  * Copyright (C) 1998-99  Kirk Reiser.
0008  * Copyright (C) 2003 David Borowski.
0009  * Copyright (C) 2007 Samuel Thibault.
0010  *
0011  * specifically written as a driver for the speakup screenreview
0012  * s not a general device driver.
0013  */
0014 #include "spk_priv.h"
0015 #include "speakup.h"
0016 
0017 #define PROCSPEECH '\n'
0018 #define DRV_VERSION "2.11"
0019 #define SYNTH_CLEAR '!'
0020 
0021 static struct var_t vars[] = {
0022     { CAPS_START, .u.s = {"CAPS_START\n" } },
0023     { CAPS_STOP, .u.s = {"CAPS_STOP\n" } },
0024     { PAUSE, .u.s = {"PAUSE\n"} },
0025     { RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },
0026     { PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },
0027     { INFLECTION, .u.n = {"INFLECTION %d\n", 8, 0, 16, 0, 0, NULL } },
0028     { VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },
0029     { TONE, .u.n = {"TONE %d\n", 8, 0, 16, 0, 0, NULL } },
0030     { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
0031     V_LAST_VAR
0032 };
0033 
0034 /*
0035  * These attributes will appear in /sys/accessibility/speakup/dummy.
0036  */
0037 static struct kobj_attribute caps_start_attribute =
0038     __ATTR(caps_start, 0644, spk_var_show, spk_var_store);
0039 static struct kobj_attribute caps_stop_attribute =
0040     __ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
0041 static struct kobj_attribute pitch_attribute =
0042     __ATTR(pitch, 0644, spk_var_show, spk_var_store);
0043 static struct kobj_attribute inflection_attribute =
0044     __ATTR(inflection, 0644, spk_var_show, spk_var_store);
0045 static struct kobj_attribute rate_attribute =
0046     __ATTR(rate, 0644, spk_var_show, spk_var_store);
0047 static struct kobj_attribute tone_attribute =
0048     __ATTR(tone, 0644, spk_var_show, spk_var_store);
0049 static struct kobj_attribute vol_attribute =
0050     __ATTR(vol, 0644, spk_var_show, spk_var_store);
0051 
0052 static struct kobj_attribute delay_time_attribute =
0053     __ATTR(delay_time, 0644, spk_var_show, spk_var_store);
0054 static struct kobj_attribute direct_attribute =
0055     __ATTR(direct, 0644, spk_var_show, spk_var_store);
0056 static struct kobj_attribute full_time_attribute =
0057     __ATTR(full_time, 0644, spk_var_show, spk_var_store);
0058 static struct kobj_attribute jiffy_delta_attribute =
0059     __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
0060 static struct kobj_attribute trigger_time_attribute =
0061     __ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
0062 
0063 /*
0064  * Create a group of attributes so that we can create and destroy them all
0065  * at once.
0066  */
0067 static struct attribute *synth_attrs[] = {
0068     &caps_start_attribute.attr,
0069     &caps_stop_attribute.attr,
0070     &pitch_attribute.attr,
0071     &inflection_attribute.attr,
0072     &rate_attribute.attr,
0073     &tone_attribute.attr,
0074     &vol_attribute.attr,
0075     &delay_time_attribute.attr,
0076     &direct_attribute.attr,
0077     &full_time_attribute.attr,
0078     &jiffy_delta_attribute.attr,
0079     &trigger_time_attribute.attr,
0080     NULL,   /* need to NULL terminate the list of attributes */
0081 };
0082 
0083 static void read_buff_add(u_char c)
0084 {
0085     pr_info("speakup_dummy: got character %02x\n", c);
0086 }
0087 
0088 static struct spk_synth synth_dummy = {
0089     .name = "dummy",
0090     .version = DRV_VERSION,
0091     .long_name = "Dummy",
0092     .init = "Speakup\n",
0093     .procspeech = PROCSPEECH,
0094     .clear = SYNTH_CLEAR,
0095     .delay = 500,
0096     .trigger = 50,
0097     .jiffies = 50,
0098     .full = 40000,
0099     .dev_name = SYNTH_DEFAULT_DEV,
0100     .startup = SYNTH_START,
0101     .checkval = SYNTH_CHECK,
0102     .vars = vars,
0103     .io_ops = &spk_ttyio_ops,
0104     .probe = spk_ttyio_synth_probe,
0105     .release = spk_ttyio_release,
0106     .synth_immediate = spk_ttyio_synth_immediate,
0107     .catch_up = spk_do_catch_up_unicode,
0108     .flush = spk_synth_flush,
0109     .is_alive = spk_synth_is_alive_restart,
0110     .synth_adjust = NULL,
0111     .read_buff_add = read_buff_add,
0112     .get_index = NULL,
0113     .indexing = {
0114         .command = NULL,
0115         .lowindex = 0,
0116         .highindex = 0,
0117         .currindex = 0,
0118     },
0119     .attributes = {
0120         .attrs = synth_attrs,
0121         .name = "dummy",
0122     },
0123 };
0124 
0125 module_param_named(ser, synth_dummy.ser, int, 0444);
0126 module_param_named(dev, synth_dummy.dev_name, charp, 0444);
0127 module_param_named(start, synth_dummy.startup, short, 0444);
0128 
0129 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
0130 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
0131 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
0132 
0133 module_spk_synth(synth_dummy);
0134 
0135 MODULE_AUTHOR("Samuel Thibault <samuel.thibault@ens-lyon.org>");
0136 MODULE_DESCRIPTION("Speakup support for text console");
0137 MODULE_LICENSE("GPL");
0138 MODULE_VERSION(DRV_VERSION);
0139