0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
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 int synth_probe(struct spk_synth *synth);
0020 static void synth_flush(struct spk_synth *synth);
0021
0022 static struct var_t vars[] = {
0023 { CAPS_START, .u.s = {"\x05[f99]" } },
0024 { CAPS_STOP, .u.s = {"\x05[f80]" } },
0025 { RATE, .u.n = {"\x05[r%d]", 10, 0, 20, 100, -10, NULL } },
0026 { PITCH, .u.n = {"\x05[f%d]", 80, 39, 4500, 0, 0, NULL } },
0027 { VOL, .u.n = {"\x05[g%d]", 21, 0, 40, 0, 0, NULL } },
0028 { TONE, .u.n = {"\x05[s%d]", 9, 0, 63, 0, 0, NULL } },
0029 { PUNCT, .u.n = {"\x05[A%c]", 0, 0, 3, 0, 0, "nmsa" } },
0030 { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
0031 V_LAST_VAR
0032 };
0033
0034
0035
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 punct_attribute =
0044 __ATTR(punct, 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
0065
0066
0067 static struct attribute *synth_attrs[] = {
0068 &caps_start_attribute.attr,
0069 &caps_stop_attribute.attr,
0070 &pitch_attribute.attr,
0071 &punct_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,
0081 };
0082
0083 static struct spk_synth synth_audptr = {
0084 .name = "audptr",
0085 .version = DRV_VERSION,
0086 .long_name = "Audapter",
0087 .init = "\x05[D1]\x05[Ol]",
0088 .procspeech = PROCSPEECH,
0089 .clear = SYNTH_CLEAR,
0090 .delay = 400,
0091 .trigger = 50,
0092 .jiffies = 30,
0093 .full = 18000,
0094 .dev_name = SYNTH_DEFAULT_DEV,
0095 .startup = SYNTH_START,
0096 .checkval = SYNTH_CHECK,
0097 .vars = vars,
0098 .io_ops = &spk_ttyio_ops,
0099 .probe = synth_probe,
0100 .release = spk_ttyio_release,
0101 .synth_immediate = spk_ttyio_synth_immediate,
0102 .catch_up = spk_do_catch_up,
0103 .flush = synth_flush,
0104 .is_alive = spk_synth_is_alive_restart,
0105 .synth_adjust = NULL,
0106 .read_buff_add = NULL,
0107 .get_index = NULL,
0108 .indexing = {
0109 .command = NULL,
0110 .lowindex = 0,
0111 .highindex = 0,
0112 .currindex = 0,
0113 },
0114 .attributes = {
0115 .attrs = synth_attrs,
0116 .name = "audptr",
0117 },
0118 };
0119
0120 static void synth_flush(struct spk_synth *synth)
0121 {
0122 synth->io_ops->flush_buffer(synth);
0123 synth->io_ops->send_xchar(synth, SYNTH_CLEAR);
0124 synth->io_ops->synth_out(synth, PROCSPEECH);
0125 }
0126
0127 static void synth_version(struct spk_synth *synth)
0128 {
0129 unsigned i;
0130 char synth_id[33];
0131
0132 synth->synth_immediate(synth, "\x05[Q]");
0133 synth_id[0] = synth->io_ops->synth_in(synth);
0134 if (synth_id[0] != 'A')
0135 return;
0136
0137 for (i = 1; i < sizeof(synth_id) - 1; i++) {
0138
0139 synth_id[i] = synth->io_ops->synth_in(synth);
0140 if (synth_id[i] == '\n')
0141 break;
0142 }
0143 synth_id[i] = '\0';
0144 pr_info("%s version: %s", synth->long_name, synth_id);
0145 }
0146
0147 static int synth_probe(struct spk_synth *synth)
0148 {
0149 int failed;
0150
0151 failed = spk_ttyio_synth_probe(synth);
0152 if (failed == 0)
0153 synth_version(synth);
0154 synth->alive = !failed;
0155 return 0;
0156 }
0157
0158 module_param_named(ser, synth_audptr.ser, int, 0444);
0159 module_param_named(dev, synth_audptr.dev_name, charp, 0444);
0160 module_param_named(start, synth_audptr.startup, short, 0444);
0161
0162 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based).");
0163 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer.");
0164 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded.");
0165
0166 module_spk_synth(synth_audptr);
0167
0168 MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
0169 MODULE_AUTHOR("David Borowski");
0170 MODULE_DESCRIPTION("Speakup support for Audapter synthesizer");
0171 MODULE_LICENSE("GPL");
0172 MODULE_VERSION(DRV_VERSION);
0173