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  *
0006  * Copyright (C) 1998-99  Kirk Reiser.
0007  * Copyright (C) 2003 David Borowski.
0008  *
0009  * this code is specifically written as a driver for the speakup screenreview
0010  * package and is not a general device driver.
0011  */
0012 #include "spk_priv.h"
0013 #include "speakup.h"
0014 
0015 #define DRV_VERSION "2.11"
0016 #define SYNTH_CLEAR 0x18
0017 #define PROCSPEECH '\r'
0018 
0019 static struct var_t vars[] = {
0020     { CAPS_START, .u.s = {"\x05\x31\x32P" } },
0021     { CAPS_STOP, .u.s = {"\x05\x38P" } },
0022     { RATE, .u.n = {"\x05%dE", 8, 1, 16, 0, 0, NULL } },
0023     { PITCH, .u.n = {"\x05%dP", 8, 0, 16, 0, 0, NULL } },
0024     { VOL, .u.n = {"\x05%dV", 8, 0, 16, 0, 0, NULL } },
0025     { TONE, .u.n = {"\x05%dT", 8, 0, 16, 0, 0, NULL } },
0026     { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
0027     V_LAST_VAR
0028 };
0029 
0030 /*
0031  * These attributes will appear in /sys/accessibility/speakup/bns.
0032  */
0033 static struct kobj_attribute caps_start_attribute =
0034     __ATTR(caps_start, 0644, spk_var_show, spk_var_store);
0035 static struct kobj_attribute caps_stop_attribute =
0036     __ATTR(caps_stop, 0644, spk_var_show, spk_var_store);
0037 static struct kobj_attribute pitch_attribute =
0038     __ATTR(pitch, 0644, spk_var_show, spk_var_store);
0039 static struct kobj_attribute rate_attribute =
0040     __ATTR(rate, 0644, spk_var_show, spk_var_store);
0041 static struct kobj_attribute tone_attribute =
0042     __ATTR(tone, 0644, spk_var_show, spk_var_store);
0043 static struct kobj_attribute vol_attribute =
0044     __ATTR(vol, 0644, spk_var_show, spk_var_store);
0045 
0046 static struct kobj_attribute delay_time_attribute =
0047     __ATTR(delay_time, 0644, spk_var_show, spk_var_store);
0048 static struct kobj_attribute direct_attribute =
0049     __ATTR(direct, 0644, spk_var_show, spk_var_store);
0050 static struct kobj_attribute full_time_attribute =
0051     __ATTR(full_time, 0644, spk_var_show, spk_var_store);
0052 static struct kobj_attribute jiffy_delta_attribute =
0053     __ATTR(jiffy_delta, 0644, spk_var_show, spk_var_store);
0054 static struct kobj_attribute trigger_time_attribute =
0055     __ATTR(trigger_time, 0644, spk_var_show, spk_var_store);
0056 
0057 /*
0058  * Create a group of attributes so that we can create and destroy them all
0059  * at once.
0060  */
0061 static struct attribute *synth_attrs[] = {
0062     &caps_start_attribute.attr,
0063     &caps_stop_attribute.attr,
0064     &pitch_attribute.attr,
0065     &rate_attribute.attr,
0066     &tone_attribute.attr,
0067     &vol_attribute.attr,
0068     &delay_time_attribute.attr,
0069     &direct_attribute.attr,
0070     &full_time_attribute.attr,
0071     &jiffy_delta_attribute.attr,
0072     &trigger_time_attribute.attr,
0073     NULL,   /* need to NULL terminate the list of attributes */
0074 };
0075 
0076 static struct spk_synth synth_bns = {
0077     .name = "bns",
0078     .version = DRV_VERSION,
0079     .long_name = "Braille 'N Speak",
0080     .init = "\x05Z\x05\x43",
0081     .procspeech = PROCSPEECH,
0082     .clear = SYNTH_CLEAR,
0083     .delay = 500,
0084     .trigger = 50,
0085     .jiffies = 50,
0086     .full = 40000,
0087     .dev_name = SYNTH_DEFAULT_DEV,
0088     .startup = SYNTH_START,
0089     .checkval = SYNTH_CHECK,
0090     .vars = vars,
0091     .io_ops = &spk_ttyio_ops,
0092     .probe = spk_ttyio_synth_probe,
0093     .release = spk_ttyio_release,
0094     .synth_immediate = spk_ttyio_synth_immediate,
0095     .catch_up = spk_do_catch_up,
0096     .flush = spk_synth_flush,
0097     .is_alive = spk_synth_is_alive_restart,
0098     .synth_adjust = NULL,
0099     .read_buff_add = NULL,
0100     .get_index = NULL,
0101     .indexing = {
0102         .command = NULL,
0103         .lowindex = 0,
0104         .highindex = 0,
0105         .currindex = 0,
0106     },
0107     .attributes = {
0108         .attrs = synth_attrs,
0109         .name = "bns",
0110     },
0111 };
0112 
0113 module_param_named(ser, synth_bns.ser, int, 0444);
0114 module_param_named(dev, synth_bns.dev_name, charp, 0444);
0115 module_param_named(start, synth_bns.startup, short, 0444);
0116 
0117 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
0118 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
0119 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
0120 
0121 module_spk_synth(synth_bns);
0122 
0123 MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
0124 MODULE_AUTHOR("David Borowski");
0125 MODULE_DESCRIPTION("Speakup support for Braille 'n Speak synthesizers");
0126 MODULE_LICENSE("GPL");
0127 MODULE_VERSION(DRV_VERSION);
0128