/[linux-patches]/genpatches-2.6/tags/2.6.19-3/4400_speakup-20061129.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.19-3/4400_speakup-20061129.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 764 - (show annotations) (download)
Wed Dec 13 00:23:17 2006 UTC (11 years, 9 months ago) by dsd
File size: 368269 byte(s)
2.6.19-3 release
1 speakup CVS for Linux 2.6.19
2 Generated by dsd on Fri Dec 1 18:28:15 EST 2006
3 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/Documentation/speakup/DefaultKeyAssignments linux-2.6.19-spk/Documentation/speakup/DefaultKeyAssignments
4 --- linux-2.6.19/Documentation/speakup/DefaultKeyAssignments 1969-12-31 19:00:00.000000000 -0500
5 +++ linux-2.6.19-spk/Documentation/speakup/DefaultKeyAssignments 2006-12-01 18:28:15.000000000 -0500
6 @@ -0,0 +1,46 @@
7 +This file is intended to give you an overview of the default keys used
8 +by speakup for it's review functions. You may change them to be
9 +anything you want but that will take some familiarity with key
10 +mapping.
11 +
12 +We have remapped the insert or zero key on the keypad to act as a
13 +shift key. Well, actually as an altgr key. So in the following list
14 +InsKeyPad-period means hold down the insert key like a shift key and
15 +hit the keypad period.
16 +
17 +KeyPad-8 Say current Line
18 +InsKeyPad-8 say from top of screen to reading cursor.
19 +KeyPad-7 Say Previous Line (UP one line)
20 +KeyPad-9 Say Next Line (down one line)
21 +KeyPad-5 Say Current Word
22 +InsKeyPad-5 Spell Current Word
23 +KeyPad-4 Say Previous Word (left one word)
24 +InsKeyPad-4 say from left edge of line to reading cursor.
25 +KeyPad-6 Say Next Word (right one word)
26 +InsKeyPad-6 Say from reading cursor to right edge of line.
27 +KeyPad-2 Say Current Letter
28 +InsKeyPad-2 say current letter phonetically
29 +KeyPad-1 Say Previous Character (left one letter)
30 +KeyPad-3 Say Next Character (right one letter)
31 +KeyPad-plus Say Entire Screen
32 +InsKeyPad-plus Say from reading cursor line to bottom of screen.
33 +KeyPad-Minus Park reading cursor (toggle)
34 +InsKeyPad-minus Say character hex and decimal value.
35 +KeyPad-period Say Position (current line, position and console)
36 +InsKeyPad-period say colour attributes of current position.
37 +InsKeyPad-9 Move reading cursor to top of screen (insert pgup)
38 +InsKeyPad-3 Move reading cursor to bottom of screen (insert pgdn)
39 +InsKeyPad-7 Move reading cursor to left edge of screen (insert home)
40 +InsKeyPad-1 Move reading cursor to right edge of screen (insert end)
41 +ControlKeyPad-1 Move reading cursor to last character on current line.
42 +KeyPad-Enter Shut Up (until another key is hit) and sync reading cursor
43 +InsKeyPad-Enter Shut Up (until toggled back on).
44 +InsKeyPad-star n<x|y> go to line (y) or column (x). Where 'n' is any
45 + allowed value for the row or column for your current screen.
46 +KeyPad-/ Mark and Cut screen region.
47 +InsKeyPad-/ Paste screen region into any console.
48 +
49 +Hitting any key while speakup is outputting speech will quiet the
50 +synth until it has caught up with what is being printed on the
51 +console.
52 +
53 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/Documentation/speakup/INSTALLATION linux-2.6.19-spk/Documentation/speakup/INSTALLATION
54 --- linux-2.6.19/Documentation/speakup/INSTALLATION 1969-12-31 19:00:00.000000000 -0500
55 +++ linux-2.6.19-spk/Documentation/speakup/INSTALLATION 2006-12-01 18:28:15.000000000 -0500
56 @@ -0,0 +1,108 @@
57 +This document assumes you have had some experience with kernel
58 +compilation and installation. If you have not, I recommend you get
59 +the kernel source and read the README and various documents in the
60 +linux/Documentation directory. In particular the Changes file to make
61 +sure you have the appropriate utilities needed for installing a 2.2.xx
62 +or 2.4xx kernel. It isn't as difficult as you might think. The
63 +kernel README is intimidating the first time but once you get the
64 +steps down, it's really pretty easy. Getting through the "make
65 +config" is the tedious bit.
66 +
67 +The first thing to do is to place a copy of the tarball in the /usr/src
68 +directory which is the directory the linux tree is located in as well.
69 +Next untar speakup by typing:
70 +
71 +tar zxf speakup-1.00.tar.gz
72 +cd speakup-1.00
73 +./install
74 +
75 +Note the dot-slash before the install. This will copy the speakup
76 +directory to the kernel tree and apply the various patches and
77 +components to the appropriate kernel files. Depending on how
78 +experienced you are with kernel compiling and hacking will determine
79 +whether you should bother looking at any failed patches. If this
80 +happens, you should probably write to the speakup mailing list for
81 +help or myself.
82 +
83 +If all of the patch hunks apply successfully then just continue with
84 +the standard steps to compile the kernel with:
85 +
86 +make mrproper
87 +make config
88 +
89 +When you get to the section console speech output, answer 'y' to the
90 +CONFIG_SPEAKUP prompt. You will be given a submenu with the list of
91 +synthesizers which are currently supported. You can include as many
92 +synths in the kernel as you wish but remember each one takes up kernel
93 +space. You can only choose one of the synths as the default or none,
94 +so just type dtlk or whatever is the correct string for the
95 +synthesizer you have. You will also be asked if you wish to build-in
96 +a speakup key map. If you do not say 'y' to this option you will need
97 +to load a speakup map at boot time with whichever mechanism your
98 +distribution uses for loading key maps.
99 +
100 +We have placed the speakup configuration options in make config just
101 +after the vga console choice. For the DoubleTalk PC driver included
102 +by Jim Van Zandt. I recommend you say no to that option. I have not
103 +tried configuring them both in, but I wouldn't be at all surprised if
104 +it didn't work.
105 +
106 +If all goes well up to this point you can continue with the compiling
107 +process by doing:
108 +
109 +make dep >dep.file 2>&1 &
110 +make bzImage >cc.file 2>&1 &
111 +make modules >mod.file 2>&1 &
112 +
113 +I always redirect output to the files dep.file and cc.file so I can
114 +look over the compilation record to make sure there are no errors and
115 +warnings.
116 +
117 +Okay, you are ready to install the newly compiled kernel. Make sure
118 +you make an linux.old entry in your lilo.conf file so you can recover
119 +if it blows up. next as root run "make modules_install" to install
120 +whatever modules you compiled and move the bzImage from
121 +/usr/src/linux/arch/i386/boot to wherever your kernel lives. Also
122 +move the System.map from /usr/src/linux to where your System.map
123 +lives. On our systems we use debian so we create an vmlinuz-speakup
124 +and System.map-speakup in our /boot directory and set the symbolic
125 +links vmlinuz and System.map in the root (/) directory to point to the
126 +images. Now type lilo to tell lilo to build the new booter file and
127 +install it.
128 +
129 +As of version 0.07, the keymap for speakup is automatically built in
130 +at compile time. If you have other keymaps installed at boot time,
131 +you might want to consider removing them before you reboot the system.
132 +
133 +If everything has gone OK up until now, cross your fingers and type:
134 +
135 +shutdown -r now
136 +
137 +Your system should start talking to you as soon as it starts booting.
138 +It will talk and talk and ... well, you might want to hit the
139 +keypad-enter key to tell it to shut up. You should also read the
140 +DefaultKeyAssignments file to learn the various review functions
141 +available.
142 +
143 +As of v-0.10 the speakup configuration options are in the
144 +/proc/speakup subtree. The individual options should be fairly
145 +obvious by their names such as rate, volume, punc_level and so forth.
146 +You can manipulate them by cat'ing or echoing new values to them such
147 +as:
148 +
149 +echo 9 >/proc/speakup/rate
150 +
151 +You can see what the current values are by cat'ing those files to the console:
152 +
153 +cat /proc/speakup/rate
154 +
155 +I have probably managed to overlook a whole whack of things because
156 +this is the, enter version number here, draft. Don't worry we'll get
157 +it right eventually. If you like the package you really should get on
158 +the mailing list and start participating in it's development.
159 +
160 + Kirk
161 +
162 +email: kirk@braille.uwo.ca
163 +phone: (519) 679-6845 (home)
164 +
165 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/Documentation/speakup/README linux-2.6.19-spk/Documentation/speakup/README
166 --- linux-2.6.19/Documentation/speakup/README 1969-12-31 19:00:00.000000000 -0500
167 +++ linux-2.6.19-spk/Documentation/speakup/README 2006-12-01 18:28:15.000000000 -0500
168 @@ -0,0 +1,98 @@
169 +Welcome to the speakup project for the Speakup speech package for Linux.
170 +
171 +Speakup is written by Kirk Reiser and Andy Berdan. It is licensed
172 +under the GPL. If you don't already know, the GPL stands for the GNU
173 +General Public License. Which basically states that this code is free to
174 +copy, modify and distribute to anyone interested in playing with it.
175 +The one thing you may not do is turn any part of it into proprietary
176 +or commercial code without the permission of the author. That's me.
177 +
178 +If you are interested in being involved with the development of speech
179 +output for Linux you can subscribe to the Speakup mailing list by
180 +sending a message to speakup-request@braille.uwo.ca with the line: subscribe. You can also subscribe by going to the speakup web page and following the links at http://www.linux-speakup.org.
181 +
182 +We are at a very early stage in the development of this package.
183 +Hopefully changes will happen often and many. The current files in
184 +this directory are:
185 +
186 +DefaultKeyAssignments # speakup's default review keys
187 +INSTALLATION # for installing speakup from the tar ball.
188 +README # this file
189 +keymap-tutorial # a tutorial on how to layout the keyboard
190 +
191 +Read the INSTALLATION file to learn how to apply the patches and the
192 +default.map for the keyboard. You should also read the Changes file.
193 +It really has any new things I've added since last time.
194 +
195 +There is no documentation in any of these files to instruct you what
196 +to do if something goes wrong with the patching or compilation. If
197 +you would like that information you will need to subscribe to the
198 +mailing list and ask for help, or write me kirk@braille.uwo.ca for
199 +help. I suggest the mailing list because I will probably tire quickly
200 +of answering the same questions over and over. You could always
201 +decide to dig-in and take on the task, and write documentation to help
202 +others.
203 +
204 +There also is a speakup reflector for the Speak Freely package, which
205 +many of us hang out on and discuss all sorts of topics from speakup
206 +problems to ALSA driver installation and just about anything else
207 +you'd like to talk about. The reflector is at lwl.braille.uwo.ca:4074
208 +with it's lwl page at lwl.braille.uwo.ca/speakup.html. Come and join
209 +us, it's fun!
210 +
211 +Acknowledgements:
212 +
213 +I am really very new at kernel hacking and screen review package
214 +writing, so I have depended heavily on other folks kindness to help me
215 +a long. No doubt I will continue to abuse them freely and others
216 +before this is a really good speech solution for Linux. (Oh Well!,
217 +somebody's got to do it.)
218 +
219 +Theodore Ts'o. He gave me a good discussion of unicode and UTF and
220 +the like. He doesn't even remember writing me about it.
221 +
222 +Alan Cox. He has answered many questions about scheduling and wait
223 +queues and timers along with code fragments and so on. I just wish I
224 +understood it all totally. He has also helped immensely in moving
225 +this package toward inclusion in the standard kernel tree. (Maybe next
226 +release!)
227 +
228 +Martin Mares. He pointed me in the right direction to figuring out
229 +the colour attributes and other useful tidbits.
230 +
231 +Paul McDermott. He really is the catalyst for me to actually get
232 +this all working. Besides I like seeing him bounce around and get all
233 +excited every time I have something new working.
234 +
235 +John Covici, He was the first person to actually attempt writing
236 +another synthesizer driver for speakup. It was the Speakout driver so
237 +it was also the first serial driver.
238 +
239 +Brian Borowski, he was the first person to actually write a speakup
240 +function other than Andy and I.
241 +
242 +Jim Danley, he has more or less become my main man in helping test
243 +code, add new features, bounce ideas off and generally become a good
244 +friend.
245 +
246 +Matt Campbell, he basically rewrote the drivers to be able to include
247 +all synths in the kernel at the same time. The distribution
248 +maintainers appreciate him a lot as well.
249 +
250 +Gene Collins, he was very helpful debugging the current release prior
251 +to its public showing. He has also worked hard educating others on
252 +the list and writing the ALSA mini howto.
253 +
254 +I would also like to really thank the folks that handle the
255 +distribution packages. I and many other people would not find access
256 +to speakup nearly so convenient without their efforts. They include
257 +Bill Acker, Tom Moore, Matt Campbell, Joe Norton and Joshua Lambert.
258 +
259 +There are probably many more I am forgetting right now. I guess I'll
260 +just have to add you all later.
261 +
262 +
263 +Happy Hacking!
264 +
265 + Kirk
266 +
267 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/Documentation/speakup/keymap-tutorial linux-2.6.19-spk/Documentation/speakup/keymap-tutorial
268 --- linux-2.6.19/Documentation/speakup/keymap-tutorial 1969-12-31 19:00:00.000000000 -0500
269 +++ linux-2.6.19-spk/Documentation/speakup/keymap-tutorial 2006-12-01 18:28:15.000000000 -0500
270 @@ -0,0 +1,140 @@
271 + Speakup Keymap Tutorial
272 +
273 +This is meant to be a basic tutorial on how to change the Linux keymap
274 +file to assign speakup review functions to desired keys. It is not
275 +intended to be a replacement for the loadkeys(8) or keymap(5) man
276 +pages.
277 +
278 +The basic lay-out of the keymap file is a series of lines with the
279 +following fields. The keyword keycode indicates this is the start of
280 +a new key assignment. It is then followed by a number which
281 +represents the actual key on the keyboard. That number is followed by
282 +the equals '=' operator and finally a list of keywords representing
283 +key names such as keypad5. Each line can have quite a few key
284 +functions on it. They are interpreted by loadkeys in order and
285 +assigned to key shift states depending on the order they are
286 +encountered. So for example, the first value after the equals is the
287 +keys unshifted state, while the second is the keys shifted state. If
288 +you wish to learn the order they are interpreted in read the
289 +loadkeys(8) and keymap(5) man pages.
290 +
291 +You can have subsequent lines which are indented and start with
292 +another keyword for the various shifted states. This way you can
293 +assign some of the states without having to specify them all in order
294 +up until you get to the one you want to assign.
295 +
296 +In speakup, we have assigned the insert key on the number pad to the
297 +altgr keyword. This is not required; you could choose any other
298 +shifted state keyword. We used altgr because it typically represents
299 +the right hand alt key. In Linux each shift key is separate and
300 +independent, so the left shift and the right shift keys are not
301 +necessarily the same. The altgr key is not really used for anything
302 +important, so we steel it.
303 +
304 +Here are the default key assignments for the number eight on the
305 +keypad:
306 +
307 +keycode 72 = KP_8
308 + alt keycode 72 = Ascii_8
309 +
310 +As you can see, the first line starts with keycode followed by 72
311 +which is the actual number assigned to the key when the keyboard port
312 +is read. The KP_8 after the equal sign, is the symbolic representation
313 +of the function called when that key is hit.
314 +
315 +The second line is the same format except it starts with the keyword
316 +alt which is indented. That means that the function at the end of
317 +that line Ascii_8 is applied to the alt-shifted eight key.
318 +
319 +Now here are the speakup assignments for that key:
320 +
321 +keycode 72 = 0x0d0a
322 + altgr keycode 72 = 0x0d20
323 +#keycode 72 = KP_8
324 + alt keycode 72 = Ascii_8
325 +
326 +Notice that the only thing which has changed on the first line is the
327 +function called when the key is struck. It is a hexadecimal number
328 +identifying the function called in a look up table. It is not a
329 +symbolic representation yet because that means we need to change the
330 +loadkeys program to understand our symbolic names. We will do this in
331 +the future but for now it is more expedient to just use the table
332 +indices. You will find a table at the bottom of this document
333 +listing the review functions and their corresponding hex lookups.
334 +
335 +The 0x0d0a in the first line above is speakup's say line function.
336 +The second line ends with 0x0d20 which is speakup's read from top of
337 +screen to reading cursor line.
338 +
339 +The third line is the original key assignment commented out with a
340 +number-sign '#' at the beginning. I do that so I can easily find the
341 +keys I want to affect by symbolic name. Otherwise I would need to
342 +keep a look up table for all the keycodes. I recommend you do this as
343 +well or you'll be very sorry at some point in the future.
344 +
345 +The forth line is just the standard key assignment for the left hand
346 +alt key.
347 +
348 +Now let's say we want to design a different keyboard layout. I'll use
349 +an example for the JAWS style keypad because I've specifically been
350 +asked to help with that. JAWS uses the eight on the keypad to move up
351 +a line or the speakup function to read previous line. JAWS also uses
352 +the keypad_8 key in a shifted mode to read the current line. I
353 +apologize if these are not quite right. It has been a long time since
354 +I used JAWS. So we would have the following two lines:
355 +
356 +keycode 72 = 0x0d0b
357 + altgr keycode 72 = 0x0d0a
358 +
359 +The hex value 0x0d0b in the first line is speakup's SAY_PREVIOUS_LINE
360 +function. The 0x0d0a in the second line is the same say_line function
361 +as we had earlier. So when the number eight is hit on the keypad
362 +speakup will read the previous line and when the number eight is
363 +shifted with the insert key on the keypad it will read the current
364 +line.
365 +
366 +As you can tell, it is not really very difficult to reassign the keys
367 +to different review functions.
368 +
369 +Once you have carefully edited the keymap file, called default.map in
370 +the speakup distribution, you copy it into the /etc/kbd directory.
371 +Make sure you back up the original default.map from that directory
372 +first, if there is one. Then you run loadkeys to load the new map
373 +into the kernel:
374 +
375 +loadkeys /etc/kbd/default.map
376 +
377 +If you wish to build your new keyboard lay-out into the kernel, after
378 +testing it, copy the default.map file into the drivers/char directory,
379 +with the name defkeymap.map, of your Linux source tree. Then rm the
380 +defkeymap.c file and recompile the kernel. Because there is no
381 +defkeymap.c `make' will rebuild it on the next compile.
382 +
383 +Here is a list of the available speakup review functions at this point
384 +in time.
385 +
386 +SAY_CHAR 0x0d04 /* say this character */
387 +SAY_PREV_CHAR 0x0d05 /* say character left of this char */
388 +SAY_NEXT_CHAR 0x0d06 /* say char right of this char */
389 +SAY_WORD 0x0d07 /* say this word under reading cursor */
390 +SAY_PREV_WORD 0x0d08
391 +SAY_NEXT_WORD 0x0d09
392 +SAY_LINE 0x0d0a /* say this line */
393 +SAY_PREV_LINE 0x0d0b /* say line above this line */
394 +SAY_NEXT_LINE 0x0d0c
395 +TOP_EDGE 0x0d0d /* move to top edge of screen */
396 +BOTTOM_EDGE 0x0d0e
397 +LEFT_EDGE 0x0d0f
398 +RIGHT_EDGE 0x0d10
399 +SAY_PHONETIC_CHAR 0x0d11 /* say this character phonetically */
400 +SPELL_WORD 0x0d12 /* spell this word letter by letter */
401 +SAY_SCREEN 0x0d14
402 +SAY_POSITION 0x0d1b
403 +SPEECH_OFF 0x0d1c
404 +SAY_ATTRIBUTES 0x0d1d
405 +SPEAKUP_PARKED 0x0d1e
406 +SAY_FROM_TOP 0x0d20
407 +SAY_TO_BOTTOM 0x0d21
408 +SAY_FROM_LEFT 0x0d22
409 +SAY_TO_RIGHT 0x0d23
410 +
411 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/Documentation/speakup/spkguide.txt linux-2.6.19-spk/Documentation/speakup/spkguide.txt
412 --- linux-2.6.19/Documentation/speakup/spkguide.txt 1969-12-31 19:00:00.000000000 -0500
413 +++ linux-2.6.19-spk/Documentation/speakup/spkguide.txt 2006-12-01 18:28:15.000000000 -0500
414 @@ -0,0 +1,1279 @@
415 +
416 +The Speakup User's Guide
417 +For Speakup 2.0 and Later
418 +By Gene Collins
419 +Last modified on Tue Mar 29 10:54:19 2005
420 +Document version 1.0
421 +
422 +Copyright (c) 2005 Gene Collins
423 +
424 +Permission is granted to copy, distribute and/or modify this document
425 +under the terms of the GNU Free Documentation License, Version 1.2 or
426 +any later version published by the Free Software Foundation; with no
427 +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
428 +copy of the license is included in the section entitled "GNU Free
429 +Documentation License".
430 +
431 +Preface
432 +
433 +The purpose of this document is to familiarize users with the user
434 +interface to Speakup, a Linux Screen Reader. If you need instructions
435 +for installing or obtaining Speakup, visit the web site at
436 +http://linux-speakup.org/. Speakup is a set of patches to the standard
437 +Linux kernel source tree. It can be built as a series of modules, or as
438 +a part of a monolithic kernel. These details are beyond the scope of
439 +this manual, but the user may need to be aware of the module
440 +capabilities, depending on how your system administrator has installed
441 +Speakup. If Speakup is built as a part of a monolithic kernel, and the
442 +user is using a hardware synthesizer, then Speakup will be able to
443 +provide speech access from the time the kernel is loaded, until the time
444 +the system is shutdown. This means that if you have obtained Linux
445 +installation media for a distribution which includes Speakup as a part
446 +of its kernel, you will be able, as a blind person, to install Linux
447 +with speech access unaided by a sighted person. Again, these details
448 +are beyond the scope of this manual, but the user should be aware of
449 +them. See the web site mentioned above for further details.
450 +
451 +1. Starting Speakup
452 +
453 +If your system administrator has installed Speakup to work with your
454 +specific synthesizer by default, then all you need to do to use Speakup
455 +is to boot your system, and Speakup should come up talking. This
456 +assumes of course that your synthesizer is a supported hardware
457 +synthesizer, and that it is either installed in or connected to your
458 +system, and is if necessary powered on.
459 +
460 +It is possible, however, that Speakup may have been compiled into the
461 +kernel with no default synthesizer. It is even possible that your
462 +kernel has been compiled with support for some of the supported
463 +synthesizers and not others. If you find that this is the case, and
464 +your synthesizer is supported but not available, complain to the person
465 +who compiled and installed your kernel. Or better yet, go to the web
466 +site, and learn how to patch Speakup into your own kernel source, and
467 +build and install your own kernel.
468 +
469 +If your kernel has been compiled with Speakup, and has no default
470 +synthesizer set, or you would like to use a different synthesizer than
471 +the default one, then you may issue the following command at the boot
472 +prompt of your boot loader.
473 +
474 +linux speakup_synth=ltlk
475 +
476 +This command would tell Speakup to look for and use a LiteTalk or
477 +DoubleTalk LT at boot up. You may replace the ltlk synthesizer keyword
478 +with the keyword for whatever synthesizer you wish to use. The
479 +speakup_synth parameter will accept the following keywords, provided
480 +that support for the related synthesizers has been built into the
481 +kernel.
482 +
483 +acntsa -- Accent SA
484 +acntpc -- Accent PC
485 +apolo -- Apolo
486 +audptr -- Audapter
487 +bns -- Braille 'n Speak
488 +dectlk -- DecTalk Express (old and new, db9 serial only)
489 +decext -- DecTalk (old) External
490 +dtlk -- DoubleTalk PC
491 +keypc -- Keynote Gold PC
492 +ltlk -- DoubleTalk LT, LiteTalk, or external Tripletalk (db9 serial only)
493 +spkout -- Speak Out
494 +txprt -- Transport
495 +
496 +Note: Speakup does * NOT * support usb connections! Speakup also does *
497 +NOT * support the internal Tripletalk!
498 +
499 +Speakup does support two other synthesizers, but because they work in
500 +conjunction with other software, they must be loaded as modules after
501 +their related software is loaded, and so are not available at boot up.
502 +These are as follows:
503 +
504 +decpc -- DecTalk PC (not available at boot up)
505 +sftsyn -- One of several software synthesizers (not available at boot up)
506 +
507 +See the sections on loading modules and software synthesizers later in
508 +this manual for further details. It should be noted here that the
509 +speakup_synth boot parameter will have no effect if Speakup has been
510 +compiled as modules. In order for Speakup modules to be loaded during
511 +the boot process, such action must be configured by your system
512 +administrator. This will mean that you will hear some, but not all, of
513 +the bootup messages.
514 +
515 +2. Basic operation
516 +
517 +Once you have booted the system, and if necessary, have supplied the
518 +proper bootup parameter for your synthesizer, Speakup will begin
519 +talking as soon as the kernel is loaded. In fact, it will talk a lot!
520 +It will speak all the boot up messages that the kernel prints on the
521 +screen during the boot process. This is because Speakup is not a
522 +separate screen reader, but is actually built into the operating
523 +system. Since almost all console applications must print text on the
524 +screen using the kernel, and must get their keyboard input through the
525 +kernel, they are automatically handled properly by Speakup. There are a
526 +few exceptions, but we'll come to those later.
527 +
528 +Note: In this guide I will refer to the numeric keypad as the keypad.
529 +This is done because the speakupmap.map file referred to later in this
530 +manual uses the term keypad instead of numeric keypad. Also I'm lazy
531 +and would rather only type one word. So keypad it is. Got it? Good.
532 +
533 +Most of the Speakup review keys are located on the keypad at the far
534 +right of the keyboard. The numlock key should be off, in order for these
535 +to work. If you toggle the numlock on, the keypad will produce numbers,
536 +which is exactly what you want for spreadsheets and such. For the
537 +purposes of this guide, you should have the numlock turned off, which is
538 +its default state at bootup.
539 +
540 +You probably won't want to listen to all the bootup messages every time
541 +you start your system, though it's a good idea to listen to them at
542 +least once, just so you'll know what kind of information is available to
543 +you during the boot process. You can always review these messages after
544 +bootup with the command:
545 +
546 +dmesg | more
547 +
548 +In order to speed the boot process, and to silence the speaking of the
549 +bootup messages, just press the keypad enter key. This key is located
550 +in the bottom right corner of the keypad. Speakup will shut up and stay
551 +that way, until you press another key.
552 +
553 +You can check to see if the boot process has completed by pressing the 8
554 +key on the keypad, which reads the current line. This also has the
555 +effect of starting Speakup talking again, so you can press keypad enter
556 +to silence it again if the boot process has not completed.
557 +
558 +When the boot process is complete, you will arrive at a "login" prompt.
559 +At this point, you'll need to type in your user id and password, as
560 +provided by your system administrator. You will hear Speakup speak the
561 +letters of your user id as you type it, but not the password. This is
562 +because the password is not displayed on the screen for security
563 +reasons. This has nothing to do with Speakup, it's a Linux security
564 +feature.
565 +
566 +Once you've logged in, you can run any Linux command or program which is
567 +allowed by your user id. Normal users will not be able to run programs
568 +which require root privileges.
569 +
570 +When you are running a program or command, Speakup will automatically
571 +speak new text as it arrives on the screen. You can at any time silence
572 +the speech with keypad enter, or use any of the Speakup review keys.
573 +
574 +Here are some basic Speakup review keys, and a short description of what
575 +they do.
576 +
577 +keypad 1 -- read previous character
578 +keypad 2 -- read current character (pressing keypad 2 twice rapidly will speak
579 + the current character phonetically)
580 +keypad 3 -- read next character
581 +keypad 4 -- read previous word
582 +keypad 5 -- read current word (press twice rapidly to spell the current word)
583 +keypad 6 -- read next word
584 +keypad 7 -- read previous line
585 +keypad 8 -- read current line (press twice rapidly to hear how much the
586 + text on the current line is indented)
587 +keypad 9 -- read next line
588 +keypad period -- speak current cursor position and announce current
589 + virtual console
590 +
591 +It's also worth noting that the insert key on the keypad is mapped
592 +as the speakup key. Instead of pressing and releasing this key, as you
593 +do under DOS or Windows, you hold it like a shift key, and press other
594 +keys in combination with it. For example, repeatedly holding keypad
595 +insert, from now on called speakup, and keypad enter will toggle the
596 +speaking of new text on the screen on and off. This is not the same as
597 +just pressing keypad enter by itself, which just silences the speech
598 +until you hit another key. When you hit speakup plus keypad enter,
599 +Speakup will say, "You turned me off.", or "Hey, that's better." When
600 +Speakup is turned off, no new text on the screen will be spoken. You
601 +can still use the reading controls to review the screen however.
602 +
603 +3. Using the Speakup Help System
604 +
605 +Speakup has a help system, which is compiled as a module. It is loaded
606 +automatically whenever the Speakup help system is invoked for the first
607 +time, and remains loaded after that, until speakup is unloaded. Note
608 +that if speakup was compiled into a monolithic kernel on your system,
609 +you will not be able to unload Speakup from your kernel. If you try to
610 +use the help system, and find that it is unavailable, then your system
611 +administrator has not installed the Speakup help module, which is called
612 +speakup_help. Complain to your system administrator about this.
613 +
614 +In order to enter the Speakup help system, press and hold the speakup
615 +key (remember that this is the keypad insert key), and press the f1 key.
616 +You will hear the message:
617 +
618 +"Press space to leave help, cursor up or down to scroll, or a letter to
619 +go to commands in list."
620 +
621 +When you press the spacebar to leave the help system, you will hear:
622 +
623 +"Leaving help."
624 +
625 +While you are in the Speakup help system, you can scroll up or down
626 +through the list of available commands using the cursor keys. The list
627 +of commands is arranged in alphabetical order. If you wish to jump to
628 +commands in a specific part of the alphabet, you may press the letter of
629 +the alphabet you wish to jump to.
630 +
631 +You can also just explore by typing keyboard keys. Pressing keys will
632 +cause Speakup to speak the command associated with that key. For
633 +example, if you press the keypad 8 key, you will hear:
634 +
635 +"Keypad 8 is line, say current."
636 +
637 +You'll notice that some commands do not have keys assigned to them.
638 +This is because they are very infrequently used commands, and are also
639 +accessible through the proc system. We'll discuss the proc system later
640 +in this manual.
641 +
642 +You'll also notice that some commands have two keys assigned to them.
643 +This is because Speakup has a built in set of alternative key bindings
644 +for laptop users. The alternate speakup key is the caps lock key. You
645 +can press and hold the caps lock key, while pressing an alternate
646 +speakup command key to activate the command. On most laptops, the
647 +numeric keypad is defined as the keys in the j k l area of the keyboard.
648 +
649 +There is usually a function key which turns this keypad function on and
650 +off, and some other key which controls the numlock state. Toggling the
651 +keypad functionality on and off can become a royal pain. So, Speakup
652 +gives you a simple way to get at an alternative set of key mappings for
653 +your laptop. These are also available by default on desktop systems,
654 +because Speakup does not know whether it is running on a desktop or
655 +laptop. So you may choose which set of Speakup keys to use. Some
656 +system administrators may have chosen to compile Speakup for a desktop
657 +system without this set of alternate key bindings, but these details are
658 +beyond the scope of this manual. To use the caps lock for its normal
659 +purpose, hold the shift key while toggling the caps lock on and off. We
660 +should note here, that holding the caps lock key and pressing the z key
661 +will toggle the alternate j k l keypad on and off.
662 +
663 +4. Keys and Their Assigned Commands
664 +
665 +In this section, we'll go through a list of all the speakup keys and
666 +commands. You can also get a list of commands and assigned keys from
667 +the help system.
668 +
669 +The following list was taken from the speakupmap.map file. Key
670 +assignments are on the left of the equal sign, and the associated
671 +Speakup commands are on the right. The designation "spk" means to press
672 +and hold the speakup key, a.k.a. keypad insert, a.k.a. caps lock, while
673 +pressing the other specified key.
674 +
675 +spk key_f9 = punc_level_dec
676 +spk key_f10 = punc_level_inc
677 +spk key_f11 = reading_punc_dec
678 +spk key_f12 = reading_punc_inc
679 +spk key_1 = vol_dec
680 +spk key_2 = vol_inc
681 +spk key_3 = pitch_dec
682 +spk key_4 = pitch_inc
683 +spk key_5 = rate_dec
684 +spk key_6 = rate_inc
685 +key_kpasterisk = toggle_cursoring
686 +spk key_kpasterisk = speakup_goto
687 +spk key_f1 = speakup_help
688 +spk key_f2 = set_win
689 +spk key_f3 = clear_win
690 +spk key_f4 = enable_win
691 +spk key_f5 = edit_some
692 +spk key_f6 = edit_most
693 +spk key_f7 = edit_delim
694 +spk key_f8 = edit_repeat
695 +shift spk key_f9 = edit_exnum
696 + key_kp7 = say_prev_line
697 +spk key_kp7 = left_edge
698 + key_kp8 = say_line
699 +double key_kp8 = say_line_indent
700 +spk key_kp8 = say_from_top
701 + key_kp9 = say_next_line
702 +spk key_kp9 = top_edge
703 + key_kpminus = speakup_parked
704 +spk key_kpminus = say_char_num
705 + key_kp4 = say_prev_word
706 +spk key_kp4 = say_from_left
707 + key_kp5 = say_word
708 +double key_kp5 = spell_word
709 +spk key_kp5 = spell_phonetic
710 + key_kp6 = say_next_word
711 +spk key_kp6 = say_to_right
712 + key_kpplus = say_screen
713 +spk key_kpplus = say_win
714 + key_kp1 = say_prev_char
715 +spk key_kp1 = right_edge
716 + key_kp2 = say_char
717 +spk key_kp2 = say_to_bottom
718 +double key_kp2 = say_phonetic_char
719 + key_kp3 = say_next_char
720 +spk key_kp3 = bottom_edge
721 + key_kp0 = spk_key
722 + key_kpdot = say_position
723 +spk key_kpdot = say_attributes
724 +key_kpenter = speakup_quiet
725 +spk key_kpenter = speakup_off
726 +key_sysrq = speech_kill
727 + key_kpslash = speakup_cut
728 +spk key_kpslash = speakup_paste
729 +spk key_pageup = say_first_char
730 +spk key_pagedown = say_last_char
731 +key_capslock = spk_key
732 + spk key_z = spk_lock
733 +key_leftmeta = spk_key
734 +ctrl spk key_0 = speakup_goto
735 +spk key_u = say_prev_line
736 +spk key_i = say_line
737 +double spk key_i = say_line_indent
738 +spk key_o = say_next_line
739 +spk key_minus = speakup_parked
740 +shift spk key_minus = say_char_num
741 +spk key_j = say_prev_word
742 +spk key_k = say_word
743 +double spk key_k = spell_word
744 +spk key_l = say_next_word
745 +spk key_m = say_prev_char
746 +spk key_comma = say_char
747 +double spk key_comma = say_phonetic_char
748 +spk key_dot = say_next_char
749 +spk key_n = say_position
750 + ctrl spk key_m = left_edge
751 + ctrl spk key_y = top_edge
752 + ctrl spk key_dot = right_edge
753 +ctrl spk key_p = bottom_edge
754 +spk key_apostrophe = say_screen
755 +spk key_h = say_from_left
756 +spk key_y = say_from_top
757 +spk key_semicolon = say_to_right
758 +spk key_p = say_to_bottom
759 +spk key_slash = say_attributes
760 + spk key_enter = speakup_quiet
761 + ctrl spk key_enter = speakup_off
762 + spk key_9 = speakup_cut
763 +spk key_8 = speakup_paste
764 +shift spk key_m = say_first_char
765 + ctrl spk key_semicolon = say_last_char
766 +
767 +5. The Speakup Proc System
768 +
769 +The Speakup screen reader also creates a speakup subdirectory as a part
770 +of the proc system. You can see these entries by typing the command:
771 +
772 +ls -1 /proc/speakup/*
773 +
774 +If you issue the above ls command, you will get back something like
775 +this:
776 +
777 +/proc/speakup/attrib_bleep
778 +/proc/speakup/bell_pos
779 +/proc/speakup/bleep_time
780 +/proc/speakup/bleeps
781 +/proc/speakup/caps_start
782 +/proc/speakup/caps_stop
783 +/proc/speakup/characters
784 +/proc/speakup/cursor_time
785 +/proc/speakup/delay_time
786 +/proc/speakup/delimiters
787 +/proc/speakup/ex_num
788 +/proc/speakup/freq
789 +/proc/speakup/full_time
790 +/proc/speakup/jiffy_delta
791 +/proc/speakup/key_echo
792 +/proc/speakup/keymap
793 +/proc/speakup/no_interrupt
794 +/proc/speakup/pitch
795 +/proc/speakup/punc_all
796 +/proc/speakup/punc_level
797 +/proc/speakup/punc_most
798 +/proc/speakup/punc_some
799 +/proc/speakup/punct
800 +/proc/speakup/rate
801 +/proc/speakup/reading_punc
802 +/proc/speakup/repeats
803 +/proc/speakup/say_control
804 +/proc/speakup/say_word_ctl
805 +/proc/speakup/silent
806 +/proc/speakup/spell_delay
807 +/proc/speakup/synth_direct
808 +/proc/speakup/synth_name
809 +/proc/speakup/tone
810 +/proc/speakup/trigger_time
811 +/proc/speakup/version
812 +/proc/speakup/voice
813 +/proc/speakup/vol
814 +
815 +In addition to using the Speakup hot keys to change such things as
816 +volume, pitch, and rate, you can also echo values to the appropriate
817 +entry in the /proc/speakup directory. This is very useful, since it
818 +lets you control Speakup parameters from within a script. How you
819 +would write such scripts is somewhat beyond the scope of this manual,
820 +but I will include a couple of simple examples here to give you a
821 +general idea of what such scripts can do.
822 +
823 +Suppose for example, that you wanted to control both the punctuation
824 +level and the reading punctuation level at the same time. For
825 +simplicity, we'll call them punc0, punc1, punc2, and punc3. The scripts
826 +might look something like this:
827 +
828 +#!/bin/bash
829 +# punc0
830 +# set punc and reading punc levels to 0
831 +echo 0 >/proc/speakup/punc_level
832 +echo 0 >/proc/speakup/reading_punc
833 +echo Punctuation level set to 0.
834 +
835 +#!/bin/bash
836 +# punc1
837 +# set punc and reading punc levels to 1
838 +echo 1 >/proc/speakup/punc_level
839 +echo 1 >/proc/speakup/reading_punc
840 +echo Punctuation level set to 1.
841 +
842 +#!/bin/bash
843 +# punc2
844 +# set punc and reading punc levels to 2
845 +echo 2 >/proc/speakup/punc_level
846 +echo 2 >/proc/speakup/reading_punc
847 +echo Punctuation level set to 2.
848 +
849 +#!/bin/bash
850 +# punc3
851 +# set punc and reading punc levels to 3
852 +echo 3 >/proc/speakup/punc_level
853 +echo 3 >/proc/speakup/reading_punc
854 +echo Punctuation level set to 3.
855 +
856 +If you were to store these four small scripts in a directory in your
857 +path, perhaps /usr/local/bin, and set the permissions to 755 with the
858 +chmod command, then you could change the default reading punc and
859 +punctuation levels at the same time by issuing just one command. For
860 +example, if you were to execute the punc3 command at your shell prompt,
861 +then the reading punc and punc level would both get set to 3.
862 +
863 +I should note that the above scripts were written to work with bash, but
864 +regardless of which shell you use, you should be able to do something
865 +similar.
866 +
867 +The Speakup proc system also has another interesting use. You can echo
868 +Speakup parameters into the proc system in a script during system
869 +startup, and speakup will return to your preferred parameters every time
870 +the system is rebooted.
871 +
872 +Most of the Speakup proc parameters can be manipulated by a regular user
873 +on the system. However, there are a few parameters that are dangerous
874 +enough that they should only be manipulated by the root user on your
875 +system. There are even some parameters that are read only, and cannot
876 +be written to at all. For example, the version entry in the Speakup
877 +proc system is read only. This is because there is no reason for a user
878 +to tamper with the version number which is reported by Speakup. Doing
879 +an ls -l on /proc/speakup/version will return this:
880 +
881 +-r--r--r-- 1 root root 0 Mar 21 13:46 /proc/speakup/version
882 +
883 +As you can see, the version entry in the Speakup proc system is read
884 +only, is owned by root, and belongs to the root group. Doing a cat of
885 +/proc/speakup/version will display the Speakup version number, like
886 +this:
887 +
888 +cat /proc/speakup/version
889 +Speakup v-2.00 CVS: Thu Oct 21 10:38:21 EDT 2004
890 +synth dtlk version 1.1
891 +
892 +The display shows the Speakup version number, along with the version
893 +number of the driver for the current synthesizer.
894 +
895 +Looking at entries in the Speakup proc system can be useful in many
896 +ways. For example, you might wish to know what level your volume is set
897 +at. You could type:
898 +
899 +cat /proc/speakup/vol
900 +5
901 +
902 +The number five which comes back is the level at which the synthesizer
903 +volume is set at.
904 +
905 +All the entries in the Speakup proc system are readable, some are
906 +writable by root only, and some are writable by everyone. Unless you
907 +know what you are doing, you should probably leave the ones that are
908 +writable by root only alone. Most of the names are self explanatory.
909 +Vol for controlling volume, pitch for pitch, rate for controlling speaking
910 +rate, etc. If you find one you aren't sure about, you can post a query
911 +on the Speakup list.
912 +
913 +6. Changing Synthesizers
914 +
915 +It is possible to change to a different synthesizer while speakup is
916 +running. In other words, it is not necessary to reboot the system
917 +in order to use a different synthesizer. You can simply echo the
918 +synthesizer keyword to the /proc/speakup/synth_name proc entry.
919 +Depending on your situation, you may wish to echo none to the synth_name
920 +proc entry, to disable speech while one synthesizer is disconnected and
921 +a second one is connected in its place. Then echo the keyword for the
922 +new synthesizer into the synth_name proc entry in order to start speech
923 +with the newly connected synthesizer. See the list of synthesizer
924 +keywords in section 1 to find the keyword which matches your synth.
925 +
926 +7. Loading modules
927 +
928 +As mentioned earlier, Speakup can either be completely compiled into the
929 +kernel, with the exception of the help module, or it can be compiled as
930 +a series of modules. When compiled as modules, Speakup will only be
931 +able to speak some of the bootup messages if your system administrator
932 +has configured the system to load the modules at boo time. The modules
933 +can be loaded after the file systems have been checked and mounted, or
934 +from an initrd. There is a third possibility. Speakup can be compiled
935 +with some components built into the kernel, and others as modules. As
936 +we'll see in the next section, this is particularly useful when you are
937 +working with software synthesizers.
938 +
939 +If Speakup is completely compiled as modules, then you must use the
940 +modprobe command to load Speakup. You do this by loading the module for
941 +the synthesizer driver you wish to use. The driver modules are all
942 +named speakup_<keyword>, where <keyword> is the keyword for the
943 +synthesizer you want. So, in order to load the driver for the DecTalk
944 +Express, you would type the following command:
945 +
946 +modprobe speakup_dectlk
947 +
948 +Issuing this command would load the DecTalk Express driver and all other
949 +related Speakup modules necessary to get Speakup up and running.
950 +
951 +To completely unload Speakup, again presuming that it is entirely built
952 +as modules, you would give the command:
953 +
954 +modprobe -r speakup_dectlk
955 +
956 +The above command assumes you were running a DecTalk Express. If you
957 +were using a different synth, then you would substitute its keyword in
958 +place of dectlk.
959 +
960 +But now, suppose we have a situation where the main Speakup component
961 +is built into the kernel, and some or all of the drivers are built as
962 +modules. Since the main part of Speakup is compiled into the kernel, a
963 +partial Speakup proc system has been created which we can take advantage
964 +of by simply echoing the synthesizer keyword into the
965 +/proc/speakup/synth_name proc entry. This will cause the kernel to
966 +automatically load the appropriate driver module, and start Speakup
967 +talking. To switch to another synth, just echo a new keyword to the
968 +synth_name proc entry. For example, to load the DoubleTalk LT driver,
969 +you would type:
970 +
971 +echo ltlk >/proc/speakup/synth_name
972 +
973 +You can use the modprobe -r command to unload driver modules, regardless
974 +of whether the main part of Speakup has been built into the kernel or
975 +not.
976 +
977 +8. Using Software Synthesizers
978 +
979 +Using a software synthesizer requires that some other software be
980 +installed and running on your system. For this reason, software
981 +synthesizers are not available for use at bootup, or during a system
982 +installation process.
983 +
984 +In order to use a software synthesizer, you must have a package called
985 +Speech Dispatcher running on your system, and it must be configured to
986 +work with one of its supported software synthesizers.
987 +
988 +Two open source synthesizers you might use are Flite and Festival. You
989 +might also choose to purchase the Software DecTalk from Fonix Sales Inc.
990 +If you run a google search for Fonix, you'll find their web site.
991 +
992 +You can obtain a copy of Speech Dispatcher from free(b)soft at
993 +http://www.freebsoft.org/. Follow the installation instructions that
994 +come with Speech Dispatcher in order to install and configure Speech
995 +Dispatcher. You can check out the web site for your Linux distribution
996 +in order to get a copy of either Flite or Festival. Your Linux
997 +distribution may also have a precompiled Speech Dispatcher package.
998 +
999 +Once you've installed, configured, and tested Speech Dispatcher with your
1000 +chosen software synthesizer, you still need one more piece of software
1001 +in order to make things work. You need a package called speechd-up.
1002 +You get it from the free(b)soft web site mentioned above. After you've
1003 +compiled and installed speechd-up, you are almost ready to begin using
1004 +your software synthesizer.
1005 +
1006 +Before you can use a software synthesizer, you must have created the
1007 +/dev/softsynth device. If you have not already done so, issue the
1008 +following commands as root:
1009 +
1010 +cd /dev
1011 +mknod softsynth c 10 26
1012 +
1013 +While we are at it, we might just as well create the /dev/synth device,
1014 +which can be used to let user space programs send information to your
1015 +synthesizer. To create /dev/synth, change to the /dev directory, and
1016 +issue the following command as root:
1017 +
1018 +mknod synth c 10 25
1019 +
1020 +Now you can begin using your software synthesizer. In order to do so,
1021 +echo the sftsyn keyword to the synth_name proc entry like this:
1022 +
1023 +echo sftsyn >/proc/speakup/synth_name
1024 +
1025 +Next run the speechd_up command like this:
1026 +
1027 +speechd_up &
1028 +
1029 +Your synth should now start talking, and you should be able to adjust
1030 +the pitch, rate, etc.
1031 +
1032 +In this section, we have assumed that your copy of Speakup was compiled
1033 +with the speakup_sftsyn component either built into the kernel, or
1034 +compiled as a module.
1035 +
1036 +9. Using The DecTalk PC Card
1037 +
1038 +The DecTalk PC card is an ISA card that is inserted into one of the ISA
1039 +slots in your computer. It requires that the DecTalk PC software be
1040 +installed on your computer, and that the software be loaded onto the
1041 +Dectalk PC card before it can be used.
1042 +
1043 +You can get the dec_pc.tgz file from the linux-speakup.org site. The
1044 +dec_pc.tgz file is in the ~ftp/pub/linux/speakup directory.
1045 +
1046 +After you have downloaded the dec_pc.tgz file, untar it in your home
1047 +directory, and read the Readme file in the newly created dec_pc
1048 +directory.
1049 +
1050 +The easiest way to get the software working is to copy the entire dec_pc
1051 +directory into /user/local/lib. To do this, su to root in your home
1052 +directory, and issue the command:
1053 +
1054 +cp dec_pc /usr/local/lib
1055 +
1056 +You will need to copy the dtload command from the dec_pc directory to a
1057 +directory in your path. Either /usr/bin or /usr/local/bin is a good
1058 +choice.
1059 +
1060 +You can now run the dtload command in order to load the DecTalk PC
1061 +software onto the card. After you have done this, echo the decpc
1062 +keyword to the synth_name entry in the proc system like this:
1063 +
1064 +echo decpc >/proc/speakup/synth_name
1065 +
1066 +Your DecTalk PC should start talking, and then you can adjust the pitch,
1067 +rate, volume, voice, etc. The voice entry in the Speakup proc system
1068 +will accept a number from 0 through 7 for the DecTalk PC synthesizer,
1069 +which will give you access to some of the DecTalk voices.
1070 +
1071 +10. Using Cursor Tracking
1072 +
1073 +In Speakup version 2.0 and later, cursor tracking is turned on by
1074 +default. This means that when you are using an editor, Speakup will
1075 +automatically speak characters as you move left and right with the
1076 +cursor keys, and lines as you move up and down with the cursor keys.
1077 +
1078 +This is extremely useful, and makes editing files a snap. But there are
1079 +times when cursor tracking can get in your way. So Speakup provides a
1080 +toggle to turn cursor tracking on and off. You do this with the keypad
1081 +asterisk key. Pressing this key repeatedly will toggle the cursor
1082 +tracking on and off, and you will hear Speakup say, "cursoring off", and
1083 +"cursoring on".
1084 +
1085 +Some folks like to turn cursor tracking off while they are using the
1086 +lynx web browser. You definitely want to turn cursor tracking off when
1087 +you are using the alsamixer application. Otherwise, you won't be able
1088 +to hear your mixer settings while you are using the arrow keys.
1089 +
1090 +11. Cut and Paste
1091 +
1092 +One of Speakup's more useful features is the ability to cut and paste
1093 +text on the screen. This means that you can capture information from a
1094 +program, and paste that captured text into a different place in the
1095 +program, or into an entirely different program, which may even be
1096 +running on a different console.
1097 +
1098 +For example, in this manual, we have made references to several web
1099 +sites. It would be nice if you could cut and paste these urls into your
1100 +web browser. Speakup does this quite nicely. Suppose you wanted to
1101 +past the following url into your browser:
1102 +
1103 +http://linux-speakup.org/
1104 +
1105 +Use the speakup review keys to position the reading cursor on the first
1106 +character of the above url. When the reading cursor is in position,
1107 +press the keypad slash key once. Speakup will say, "mark". Next,
1108 +position the reading cursor on the rightmost character of the above
1109 +url. Press the keypad slash key once again to actually cut the text
1110 +from the screen. Speakup will say, "cut". Although we call this
1111 +cutting, Speakup does not actually delete the cut text from the screen.
1112 +It makes a copy of the text in a special buffer for later pasting.
1113 +
1114 +Now that you have the url cut from the screen, you can paste it into
1115 +your browser, or even paste the url on a command line as an argument to
1116 +your browser.
1117 +
1118 +Suppose you want to start lynx and go to the Speakup site.
1119 +
1120 +You can switch to a different console with the alt left and right
1121 +arrows, or you can switch to a specific console by typing alt and a
1122 +function key. These are not Speakup commands, just standard Linux
1123 +console capabilities.
1124 +
1125 +Once you've changed to an appropriate console, and are at a shell prompt,
1126 +type the word lynx, followed by a space. Now press and hold the speakup
1127 +key, while you type the keypad slash character. The url will be pasted
1128 +onto the command line, just as though you had typed it in. Press the
1129 +enter key to execute the command.
1130 +
1131 +The paste buffer will continue to hold the cut information, until a new
1132 +mark and cut operation is carried out. This means you can paste the cut
1133 +information as many times as you like before doing another cut
1134 +operation.
1135 +
1136 +You are not limited to cutting and pasting only one line on the screen.
1137 +You can also cut and paste rectangular regions of the screen. Just
1138 +position the reading cursor at the top left corner of the text to be
1139 +cut, mark it with the keypad slash key, then position the reading cursor
1140 +at the bottom right corner of the region to be cut, and cut it with the
1141 +keypad slash key.
1142 +
1143 +12. Changing the Pronunciation of Characters
1144 +
1145 +Through the /proc/speakup/chars proc entry, Speakup gives you the
1146 +ability to change how Speakup pronounces a given character. You could,
1147 +for example, change how some punctuation characters are spoken. You can
1148 +even change how Speakup will pronounce certain letters.
1149 +
1150 +You may, for example, wish to change how Speakup pronounces the z
1151 +character. The author of Speakup, Kirk Reiser, is Canadian, and thus
1152 +believes that the z should be pronounced zed. If you are an American,
1153 +you might wish to use the zee pronunciation instead of zed. You can
1154 +change the pronunciation of both the upper and lower case z with the
1155 +following two commands:
1156 +
1157 +echo 90 zee >/proc/speakup/characters
1158 +echo 122 zee >/proc/speakup/characters
1159 +
1160 +Let's examine the parts of the two previous commands. They are issued
1161 +at the shell prompt, and could be placed in a startup script.
1162 +
1163 +The word echo tells the shell that you want to have it display the
1164 +string of characters that follow the word echo. If you were to just
1165 +type:
1166 +
1167 +echo hello.
1168 +
1169 +You would get the word hello printed on your screen as soon as you
1170 +pressed the enter key. In this case, we are echoing strings that we
1171 +want to be redirected into the proc system.
1172 +
1173 +The numbers 90 and 122 in the above echo commands are the ascii numeric
1174 +values for the upper and lower case z, the characters we wish to change.
1175 +
1176 +The string zee is the pronunciation that we want Speakup to use for the
1177 +upper and lower case z.
1178 +
1179 +The > symbol redirects the output of the echo command to a file, just
1180 +like in DOS, or at the Windows command prompt.
1181 +
1182 +And finally, /proc/speakup/chars is the file entry in the proc system
1183 +where we want the output to be directed. Speakup looks at the numeric
1184 +value of the character we want to change, and inserts the pronunciation
1185 +string into an internal table.
1186 +
1187 +You can look at the whole table with the following command:
1188 +
1189 +cat /proc/speakup/chars
1190 +
1191 +Speakup will then print out the entire character pronunciation table. I
1192 +won't display it here, but leave you to look at it at your convenience.
1193 +
1194 +13. Mapping Keys
1195 +
1196 +Speakup has the capability of allowing you to assign or "map" keys to
1197 +internal Speakup commands. This section necessarily assumes you have a
1198 +Linux kernel source tree installed, and that it has been patched and
1199 +configured with Speakup. How you do this is beyond the scope of this
1200 +manual. For this information, visit the Speakup web site at
1201 +http://linux-speakup.org/. The reason you'll need the kernel source
1202 +tree patched with Speakup is that the genmap utility you'll need for
1203 +processing keymaps is in the
1204 +/usr/src/linux-<version_number>/drivers/char/speakup directory. The
1205 +<version_number> in the above directory path is the version number of
1206 +the Linux source tree you are working with.
1207 +
1208 +So ok, you've gone off and gotten your kernel source tree, and patched
1209 +and configured it. Now you can start manipulating keymaps.
1210 +
1211 +You can either use the
1212 +/usr/src/linux-<version_number>/drivers/char/speakup/speakupmap.map file
1213 +included with the Speakup source, or you can cut and paste the copy in
1214 +section 4 into a separate file. If you use the one in the Speakup
1215 +source tree, make sure you make a backup of it before you start making
1216 +changes. You have been warned!
1217 +
1218 +Suppose that you want to swap the key assignments for the Speakup
1219 +say_last_char and the Speakup say_first_char commands. The
1220 +speakupmap.map lists the key mappings for these two commands as follows:
1221 +
1222 +spk key_pageup = say_first_char
1223 +spk key_pagedown = say_last_char
1224 +
1225 +You can edit your copy of the speakupmap.map file and swap the command
1226 +names on the right side of the = (equals) sign. You did make a backup,
1227 +right? The new keymap lines would look like this:
1228 +
1229 +spk key_pageup = say_last_char
1230 +spk key_pagedown = say_first_char
1231 +
1232 +After you edit your copy of the speakupmap.map file, save it under a new
1233 +file name, perhaps newmap.map. Then exit your editor and return to the
1234 +shell prompt.
1235 +
1236 +You are now ready to load your keymap with your swapped key assignments.
1237 + Assuming that you saved your new keymap as the file newmap.map, you
1238 +would load your keymap into the proc system like this:
1239 +
1240 +/usr/src/linux-<version_number>/drivers/char/speakup/genmap newmap.map
1241 +>/proc/speakup/keymap
1242 +
1243 +Remember to substitute your kernel version number for the
1244 +<version_number> in the above command. Also note that although the
1245 +above command wrapped onto two lines in this document, you should type
1246 +it all on one line.
1247 +
1248 +Your say first and say last characters should now be swapped. Pressing
1249 +speakup pagedown should read you the first non-whitespace character on
1250 +the line your reading cursor is in, and pressing speakup pageup should
1251 +read you the last character on the line your reading cursor is in.
1252 +
1253 +You should note that these new mappings will only stay in effect until
1254 +you reboot, or until you load another keymap.
1255 +
1256 +One final warning. If you try to load a partial map, you will quickly
1257 +find that all the mappings you didn't include in your file got deleted
1258 +from the working map. Be extremely careful, and always make a backup!
1259 +You have been warned!
1260 +
1261 +14. Using Speakup's Windowing Capability
1262 +
1263 +Speakup has the capability of defining and manipulating windows on the
1264 +screen. Speakup uses the term "Window", to mean a user defined area of
1265 +the screen. The key strokes for defining and manipulating Speakup
1266 +windows are as follows:
1267 +
1268 +speakup + f2 -- Set the bounds of the window.
1269 +Speakup + f3 -- clear the current window definition.
1270 +speakup + f4 -- Toggle window silence on and off.
1271 +speakup + keypad plus -- Say the currently defined window.
1272 +
1273 +These capabilities are useful for tracking a certain part of the screen
1274 +without rereading the whole screen, or for silencing a part of the
1275 +screen that is constantly changing, such as a clock or status line.
1276 +
1277 +There is no way to save these window settings, and you can only have one
1278 +window defined for each virtual console. There is also no way to have
1279 +windows automaticly defined for specific applications.
1280 +
1281 +In order to define a window, use the review keys to move your reading
1282 +cursor to the beginning of the area you want to define. Then press
1283 +speakup + f2. Speakup will tell you that the window starts at the
1284 +indicated row and column position. Then move the reading cursor to the
1285 +end of the area to be defined as a window, and press speakup + f2 again.
1286 + If there is more than one line in the window, Speakup will tell you
1287 +that the window ends at the indicated row and column position. If there
1288 +is only one line in the window, then Speakup will tell you that the
1289 +window is the specified line on the screen. If you are only defining a
1290 +one line window, you can just press speakup + f2 twice after placing the
1291 +reading cursor on the line you want to define as a window. It is not
1292 +necessary to position the reading cursor at the end of the line in order
1293 +to define the whole line as a window.
1294 +
1295 + GNU Free Documentation License
1296 + Version 1.2, November 2002
1297 +
1298 +
1299 + Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
1300 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1301 + Everyone is permitted to copy and distribute verbatim copies
1302 + of this license document, but changing it is not allowed.
1303 +
1304 +
1305 +0. PREAMBLE
1306 +
1307 +The purpose of this License is to make a manual, textbook, or other
1308 +functional and useful document "free" in the sense of freedom: to
1309 +assure everyone the effective freedom to copy and redistribute it,
1310 +with or without modifying it, either commercially or noncommercially.
1311 +Secondarily, this License preserves for the author and publisher a way
1312 +to get credit for their work, while not being considered responsible
1313 +for modifications made by others.
1314 +
1315 +This License is a kind of "copyleft", which means that derivative
1316 +works of the document must themselves be free in the same sense. It
1317 +complements the GNU General Public License, which is a copyleft
1318 +license designed for free software.
1319 +
1320 +We have designed this License in order to use it for manuals for free
1321 +software, because free software needs free documentation: a free
1322 +program should come with manuals providing the same freedoms that the
1323 +software does. But this License is not limited to software manuals;
1324 +it can be used for any textual work, regardless of subject matter or
1325 +whether it is published as a printed book. We recommend this License
1326 +principally for works whose purpose is instruction or reference.
1327 +
1328 +
1329 +1. APPLICABILITY AND DEFINITIONS
1330 +
1331 +This License applies to any manual or other work, in any medium, that
1332 +contains a notice placed by the copyright holder saying it can be
1333 +distributed under the terms of this License. Such a notice grants a
1334 +world-wide, royalty-free license, unlimited in duration, to use that
1335 +work under the conditions stated herein. The "Document", below,
1336 +refers to any such manual or work. Any member of the public is a
1337 +licensee, and is addressed as "you". You accept the license if you
1338 +copy, modify or distribute the work in a way requiring permission
1339 +under copyright law.
1340 +
1341 +A "Modified Version" of the Document means any work containing the
1342 +Document or a portion of it, either copied verbatim, or with
1343 +modifications and/or translated into another language.
1344 +
1345 +A "Secondary Section" is a named appendix or a front-matter section of
1346 +the Document that deals exclusively with the relationship of the
1347 +publishers or authors of the Document to the Document's overall subject
1348 +(or to related matters) and contains nothing that could fall directly
1349 +within that overall subject. (Thus, if the Document is in part a
1350 +textbook of mathematics, a Secondary Section may not explain any
1351 +mathematics.) The relationship could be a matter of historical
1352 +connection with the subject or with related matters, or of legal,
1353 +commercial, philosophical, ethical or political position regarding
1354 +them.
1355 +
1356 +The "Invariant Sections" are certain Secondary Sections whose titles
1357 +are designated, as being those of Invariant Sections, in the notice
1358 +that says that the Document is released under this License. If a
1359 +section does not fit the above definition of Secondary then it is not
1360 +allowed to be designated as Invariant. The Document may contain zero
1361 +Invariant Sections. If the Document does not identify any Invariant
1362 +Sections then there are none.
1363 +
1364 +The "Cover Texts" are certain short passages of text that are listed,
1365 +as Front-Cover Texts or Back-Cover Texts, in the notice that says that
1366 +the Document is released under this License. A Front-Cover Text may
1367 +be at most 5 words, and a Back-Cover Text may be at most 25 words.
1368 +
1369 +A "Transparent" copy of the Document means a machine-readable copy,
1370 +represented in a format whose specification is available to the
1371 +general public, that is suitable for revising the document
1372 +straightforwardly with generic text editors or (for images composed of
1373 +pixels) generic paint programs or (for drawings) some widely available
1374 +drawing editor, and that is suitable for input to text formatters or
1375 +for automatic translation to a variety of formats suitable for input
1376 +to text formatters. A copy made in an otherwise Transparent file
1377 +format whose markup, or absence of markup, has been arranged to thwart
1378 +or discourage subsequent modification by readers is not Transparent.
1379 +An image format is not Transparent if used for any substantial amount
1380 +of text. A copy that is not "Transparent" is called "Opaque".
1381 +
1382 +Examples of suitable formats for Transparent copies include plain
1383 +ASCII without markup, Texinfo input format, LaTeX input format, SGML
1384 +or XML using a publicly available DTD, and standard-conforming simple
1385 +HTML, PostScript or PDF designed for human modification. Examples of
1386 +transparent image formats include PNG, XCF and JPG. Opaque formats
1387 +include proprietary formats that can be read and edited only by
1388 +proprietary word processors, SGML or XML for which the DTD and/or
1389 +processing tools are not generally available, and the
1390 +machine-generated HTML, PostScript or PDF produced by some word
1391 +processors for output purposes only.
1392 +
1393 +The "Title Page" means, for a printed book, the title page itself,
1394 +plus such following pages as are needed to hold, legibly, the material
1395 +this License requires to appear in the title page. For works in
1396 +formats which do not have any title page as such, "Title Page" means
1397 +the text near the most prominent appearance of the work's title,
1398 +preceding the beginning of the body of the text.
1399 +
1400 +A section "Entitled XYZ" means a named subunit of the Document whose
1401 +title either is precisely XYZ or contains XYZ in parentheses following
1402 +text that translates XYZ in another language. (Here XYZ stands for a
1403 +specific section name mentioned below, such as "Acknowledgements",
1404 +"Dedications", "Endorsements", or "History".) To "Preserve the Title"
1405 +of such a section when you modify the Document means that it remains a
1406 +section "Entitled XYZ" according to this definition.
1407 +
1408 +The Document may include Warranty Disclaimers next to the notice which
1409 +states that this License applies to the Document. These Warranty
1410 +Disclaimers are considered to be included by reference in this
1411 +License, but only as regards disclaiming warranties: any other
1412 +implication that these Warranty Disclaimers may have is void and has
1413 +no effect on the meaning of this License.
1414 +
1415 +
1416 +2. VERBATIM COPYING
1417 +
1418 +You may copy and distribute the Document in any medium, either
1419 +commercially or noncommercially, provided that this License, the
1420 +copyright notices, and the license notice saying this License applies
1421 +to the Document are reproduced in all copies, and that you add no other
1422 +conditions whatsoever to those of this License. You may not use
1423 +technical measures to obstruct or control the reading or further
1424 +copying of the copies you make or distribute. However, you may accept
1425 +compensation in exchange for copies. If you distribute a large enough
1426 +number of copies you must also follow the conditions in section 3.
1427 +
1428 +You may also lend copies, under the same conditions stated above, and
1429 +you may publicly display copies.
1430 +
1431 +
1432 +3. COPYING IN QUANTITY
1433 +
1434 +If you publish printed copies (or copies in media that commonly have
1435 +printed covers) of the Document, numbering more than 100, and the
1436 +Document's license notice requires Cover Texts, you must enclose the
1437 +copies in covers that carry, clearly and legibly, all these Cover
1438 +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
1439 +the back cover. Both covers must also clearly and legibly identify
1440 +you as the publisher of these copies. The front cover must present
1441 +the full title with all words of the title equally prominent and
1442 +visible. You may add other material on the covers in addition.
1443 +Copying with changes limited to the covers, as long as they preserve
1444 +the title of the Document and satisfy these conditions, can be treated
1445 +as verbatim copying in other respects.
1446 +
1447 +If the required texts for either cover are too voluminous to fit
1448 +legibly, you should put the first ones listed (as many as fit
1449 +reasonably) on the actual cover, and continue the rest onto adjacent
1450 +pages.
1451 +
1452 +If you publish or distribute Opaque copies of the Document numbering
1453 +more than 100, you must either include a machine-readable Transparent
1454 +copy along with each Opaque copy, or state in or with each Opaque copy
1455 +a computer-network location from which the general network-using
1456 +public has access to download using public-standard network protocols
1457 +a complete Transparent copy of the Document, free of added material.
1458 +If you use the latter option, you must take reasonably prudent steps,
1459 +when you begin distribution of Opaque copies in quantity, to ensure
1460 +that this Transparent copy will remain thus accessible at the stated
1461 +location until at least one year after the last time you distribute an
1462 +Opaque copy (directly or through your agents or retailers) of that
1463 +edition to the public.
1464 +
1465 +It is requested, but not required, that you contact the authors of the
1466 +Document well before redistributing any large number of copies, to give
1467 +them a chance to provide you with an updated version of the Document.
1468 +
1469 +
1470 +4. MODIFICATIONS
1471 +
1472 +You may copy and distribute a Modified Version of the Document under
1473 +the conditions of sections 2 and 3 above, provided that you release
1474 +the Modified Version under precisely this License, with the Modified
1475 +Version filling the role of the Document, thus licensing distribution
1476 +and modification of the Modified Version to whoever possesses a copy
1477 +of it. In addition, you must do these things in the Modified Version:
1478 +
1479 +A. Use in the Title Page (and on the covers, if any) a title distinct
1480 + from that of the Document, and from those of previous versions
1481 + (which should, if there were any, be listed in the History section
1482 + of the Document). You may use the same title as a previous version
1483 + if the original publisher of that version gives permission.
1484 +B. List on the Title Page, as authors, one or more persons or entities
1485 + responsible for authorship of the modifications in the Modified
1486 + Version, together with at least five of the principal authors of the
1487 + Document (all of its principal authors, if it has fewer than five),
1488 + unless they release you from this requirement.
1489 +C. State on the Title page the name of the publisher of the
1490 + Modified Version, as the publisher.
1491 +D. Preserve all the copyright notices of the Document.
1492 +E. Add an appropriate copyright notice for your modifications
1493 + adjacent to the other copyright notices.
1494 +F. Include, immediately after the copyright notices, a license notice
1495 + giving the public permission to use the Modified Version under the
1496 + terms of this License, in the form shown in the Addendum below.
1497 +G. Preserve in that license notice the full lists of Invariant Sections
1498 + and required Cover Texts given in the Document's license notice.
1499 +H. Include an unaltered copy of this License.
1500 +I. Preserve the section Entitled "History", Preserve its Title, and add
1501 + to it an item stating at least the title, year, new authors, and
1502 + publisher of the Modified Version as given on the Title Page. If
1503 + there is no section Entitled "History" in the Document, create one
1504 + stating the title, year, authors, and publisher of the Document as
1505 + given on its Title Page, then add an item describing the Modified
1506 + Version as stated in the previous sentence.
1507 +J. Preserve the network location, if any, given in the Document for
1508 + public access to a Transparent copy of the Document, and likewise
1509 + the network locations given in the Document for previous versions
1510 + it was based on. These may be placed in the "History" section.
1511 + You may omit a network location for a work that was published at
1512 + least four years before the Document itself, or if the original
1513 + publisher of the version it refers to gives permission.
1514 +K. For any section Entitled "Acknowledgements" or "Dedications",
1515 + Preserve the Title of the section, and preserve in the section all
1516 + the substance and tone of each of the contributor acknowledgements
1517 + and/or dedications given therein.
1518 +L. Preserve all the Invariant Sections of the Document,
1519 + unaltered in their text and in their titles. Section numbers
1520 + or the equivalent are not considered part of the section titles.
1521 +M. Delete any section Entitled "Endorsements". Such a section
1522 + may not be included in the Modified Version.
1523 +N. Do not retitle any existing section to be Entitled "Endorsements"
1524 + or to conflict in title with any Invariant Section.
1525 +O. Preserve any Warranty Disclaimers.
1526 +
1527 +If the Modified Version includes new front-matter sections or
1528 +appendices that qualify as Secondary Sections and contain no material
1529 +copied from the Document, you may at your option designate some or all
1530 +of these sections as invariant. To do this, add their titles to the
1531 +list of Invariant Sections in the Modified Version's license notice.
1532 +These titles must be distinct from any other section titles.
1533 +
1534 +You may add a section Entitled "Endorsements", provided it contains
1535 +nothing but endorsements of your Modified Version by various
1536 +parties--for example, statements of peer review or that the text has
1537 +been approved by an organization as the authoritative definition of a
1538 +standard.
1539 +
1540 +You may add a passage of up to five words as a Front-Cover Text, and a
1541 +passage of up to 25 words as a Back-Cover Text, to the end of the list
1542 +of Cover Texts in the Modified Version. Only one passage of
1543 +Front-Cover Text and one of Back-Cover Text may be added by (or
1544 +through arrangements made by) any one entity. If the Document already
1545 +includes a cover text for the same cover, previously added by you or
1546 +by arrangement made by the same entity you are acting on behalf of,
1547 +you may not add another; but you may replace the old one, on explicit
1548 +permission from the previous publisher that added the old one.
1549 +
1550 +The author(s) and publisher(s) of the Document do not by this License
1551 +give permission to use their names for publicity for or to assert or
1552 +imply endorsement of any Modified Version.
1553 +
1554 +
1555 +5. COMBINING DOCUMENTS
1556 +
1557 +You may combine the Document with other documents released under this
1558 +License, under the terms defined in section 4 above for modified
1559 +versions, provided that you include in the combination all of the
1560 +Invariant Sections of all of the original documents, unmodified, and
1561 +list them all as Invariant Sections of your combined work in its
1562 +license notice, and that you preserve all their Warranty Disclaimers.
1563 +
1564 +The combined work need only contain one copy of this License, and
1565 +multiple identical Invariant Sections may be replaced with a single
1566 +copy. If there are multiple Invariant Sections with the same name but
1567 +different contents, make the title of each such section unique by
1568 +adding at the end of it, in parentheses, the name of the original
1569 +author or publisher of that section if known, or else a unique number.
1570 +Make the same adjustment to the section titles in the list of
1571 +Invariant Sections in the license notice of the combined work.
1572 +
1573 +In the combination, you must combine any sections Entitled "History"
1574 +in the various original documents, forming one section Entitled
1575 +"History"; likewise combine any sections Entitled "Acknowledgements",
1576 +and any sections Entitled "Dedications". You must delete all sections
1577 +Entitled "Endorsements".
1578 +
1579 +
1580 +6. COLLECTIONS OF DOCUMENTS
1581 +
1582 +You may make a collection consisting of the Document and other documents
1583 +released under this License, and replace the individual copies of this
1584 +License in the various documents with a single copy that is included in
1585 +the collection, provided that you follow the rules of this License for
1586 +verbatim copying of each of the documents in all other respects.
1587 +
1588 +You may extract a single document from such a collection, and distribute
1589 +it individually under this License, provided you insert a copy of this
1590 +License into the extracted document, and follow this License in all
1591 +other respects regarding verbatim copying of that document.
1592 +
1593 +
1594 +7. AGGREGATION WITH INDEPENDENT WORKS
1595 +
1596 +A compilation of the Document or its derivatives with other separate
1597 +and independent documents or works, in or on a volume of a storage or
1598 +distribution medium, is called an "aggregate" if the copyright
1599 +resulting from the compilation is not used to limit the legal rights
1600 +of the compilation's users beyond what the individual works permit.
1601 +When the Document is included in an aggregate, this License does not
1602 +apply to the other works in the aggregate which are not themselves
1603 +derivative works of the Document.
1604 +
1605 +If the Cover Text requirement of section 3 is applicable to these
1606 +copies of the Document, then if the Document is less than one half of
1607 +the entire aggregate, the Document's Cover Texts may be placed on
1608 +covers that bracket the Document within the aggregate, or the
1609 +electronic equivalent of covers if the Document is in electronic form.
1610 +Otherwise they must appear on printed covers that bracket the whole
1611 +aggregate.
1612 +
1613 +
1614 +8. TRANSLATION
1615 +
1616 +Translation is considered a kind of modification, so you may
1617 +distribute translations of the Document under the terms of section 4.
1618 +Replacing Invariant Sections with translations requires special
1619 +permission from their copyright holders, but you may include
1620 +translations of some or all Invariant Sections in addition to the
1621 +original versions of these Invariant Sections. You may include a
1622 +translation of this License, and all the license notices in the
1623 +Document, and any Warranty Disclaimers, provided that you also include
1624 +the original English version of this License and the original versions
1625 +of those notices and disclaimers. In case of a disagreement between
1626 +the translation and the original version of this License or a notice
1627 +or disclaimer, the original version will prevail.
1628 +
1629 +If a section in the Document is Entitled "Acknowledgements",
1630 +"Dedications", or "History", the requirement (section 4) to Preserve
1631 +its Title (section 1) will typically require changing the actual
1632 +title.
1633 +
1634 +
1635 +9. TERMINATION
1636 +
1637 +You may not copy, modify, sublicense, or distribute the Document except
1638 +as expressly provided for under this License. Any other attempt to
1639 +copy, modify, sublicense or distribute the Document is void, and will
1640 +automatically terminate your rights under this License. However,
1641 +parties who have received copies, or rights, from you under this
1642 +License will not have their licenses terminated so long as such
1643 +parties remain in full compliance.
1644 +
1645 +
1646 +10. FUTURE REVISIONS OF THIS LICENSE
1647 +
1648 +The Free Software Foundation may publish new, revised versions
1649 +of the GNU Free Documentation License from time to time. Such new
1650 +versions will be similar in spirit to the present version, but may
1651 +differ in detail to address new problems or concerns. See
1652 +http://www.gnu.org/copyleft/.
1653 +
1654 +Each version of the License is given a distinguishing version number.
1655 +If the Document specifies that a particular numbered version of this
1656 +License "or any later version" applies to it, you have the option of
1657 +following the terms and conditions either of that specified version or
1658 +of any later version that has been published (not as a draft) by the
1659 +Free Software Foundation. If the Document does not specify a version
1660 +number of this License, you may choose any version ever published (not
1661 +as a draft) by the Free Software Foundation.
1662 +
1663 +
1664 +ADDENDUM: How to use this License for your documents
1665 +
1666 +To use this License in a document you have written, include a copy of
1667 +the License in the document and put the following copyright and
1668 +license notices just after the title page:
1669 +
1670 + Copyright (c) YEAR YOUR NAME.
1671 + Permission is granted to copy, distribute and/or modify this document
1672 + under the terms of the GNU Free Documentation License, Version 1.2
1673 + or any later version published by the Free Software Foundation;
1674 + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
1675 + A copy of the license is included in the section entitled "GNU
1676 + Free Documentation License".
1677 +
1678 +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
1679 +replace the "with...Texts." line with this:
1680 +
1681 + with the Invariant Sections being LIST THEIR TITLES, with the
1682 + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
1683 +
1684 +If you have Invariant Sections without Cover Texts, or some other
1685 +combination of the three, merge those two alternatives to suit the
1686 +situation.
1687 +
1688 +If your document contains nontrivial examples of program code, we
1689 +recommend releasing these examples in parallel under your choice of
1690 +free software license, such as the GNU General Public License,
1691 +to permit their use in free software.
1692 +
1693 +The End.
1694 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/MAINTAINERS linux-2.6.19-spk/MAINTAINERS
1695 --- linux-2.6.19/MAINTAINERS 2006-11-29 16:57:37.000000000 -0500
1696 +++ linux-2.6.19-spk/MAINTAINERS 2006-12-01 18:28:15.000000000 -0500
1697 @@ -2847,6 +2847,13 @@ M: wli@holomorphy.com
1698 L: sparclinux@vger.kernel.org
1699 S: Maintained
1700
1701 +SPEAKUP Console speech output
1702 +P: Kirk Reiser
1703 +M: kirk@braille.uwo.ca
1704 +L: speakup@braille.uwo.ca
1705 +W: http://www.linux-speakup.org
1706 +S: Maintained
1707 +
1708 SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER
1709 P: Roger Wolff
1710 M: R.E.Wolff@BitWizard.nl
1711 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/arch/arm/Kconfig linux-2.6.19-spk/arch/arm/Kconfig
1712 --- linux-2.6.19/arch/arm/Kconfig 2006-11-29 16:57:37.000000000 -0500
1713 +++ linux-2.6.19-spk/arch/arm/Kconfig 2006-12-01 18:28:15.000000000 -0500
1714 @@ -918,6 +918,7 @@ source "drivers/leds/Kconfig"
1715 source "drivers/media/Kconfig"
1716
1717 source "drivers/video/Kconfig"
1718 +source "drivers/char/speakup/Kconfig"
1719
1720 source "sound/Kconfig"
1721
1722 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/Kconfig linux-2.6.19-spk/drivers/Kconfig
1723 --- linux-2.6.19/drivers/Kconfig 2006-11-29 16:57:37.000000000 -0500
1724 +++ linux-2.6.19-spk/drivers/Kconfig 2006-12-01 18:28:15.000000000 -0500
1725 @@ -62,6 +62,8 @@ source "drivers/media/Kconfig"
1726
1727 source "drivers/video/Kconfig"
1728
1729 +source "drivers/char/speakup/Kconfig"
1730 +
1731 source "sound/Kconfig"
1732
1733 source "drivers/usb/Kconfig"
1734 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/Makefile linux-2.6.19-spk/drivers/Makefile
1735 --- linux-2.6.19/drivers/Makefile 2006-11-29 16:57:37.000000000 -0500
1736 +++ linux-2.6.19-spk/drivers/Makefile 2006-12-01 18:28:15.000000000 -0500
1737 @@ -27,6 +27,10 @@ obj-$(CONFIG_FB_INTEL) += video
1738
1739 obj-y += serial/
1740 obj-$(CONFIG_PARPORT) += parport/
1741 +obj-$(CONFIG_SERIO) += input/serio/
1742 +obj-$(CONFIG_GAMEPORT) += input/gameport/
1743 +# load keyboard early so speakup can be quieted
1744 +obj-$(CONFIG_INPUT) += input/
1745 obj-y += base/ block/ misc/ mfd/ net/ media/
1746 obj-$(CONFIG_NUBUS) += nubus/
1747 obj-$(CONFIG_ATM) += atm/
1748 @@ -51,9 +55,6 @@ obj-$(CONFIG_TC) += tc/
1749 obj-$(CONFIG_USB) += usb/
1750 obj-$(CONFIG_PCI) += usb/
1751 obj-$(CONFIG_USB_GADGET) += usb/gadget/
1752 -obj-$(CONFIG_SERIO) += input/serio/
1753 -obj-$(CONFIG_GAMEPORT) += input/gameport/
1754 -obj-$(CONFIG_INPUT) += input/
1755 obj-$(CONFIG_I2O) += message/
1756 obj-$(CONFIG_RTC_LIB) += rtc/
1757 obj-$(CONFIG_I2C) += i2c/
1758 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/Makefile linux-2.6.19-spk/drivers/char/Makefile
1759 --- linux-2.6.19/drivers/char/Makefile 2006-11-29 16:57:37.000000000 -0500
1760 +++ linux-2.6.19-spk/drivers/char/Makefile 2006-12-01 18:28:15.000000000 -0500
1761 @@ -91,6 +91,7 @@ obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.
1762 obj-$(CONFIG_TANBAC_TB0219) += tb0219.o
1763 obj-$(CONFIG_TELCLOCK) += tlclk.o
1764
1765 +obj-$(CONFIG_SPEAKUP) += speakup/
1766 obj-$(CONFIG_WATCHDOG) += watchdog/
1767 obj-$(CONFIG_MWAVE) += mwave/
1768 obj-$(CONFIG_AGP) += agp/
1769 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/consolemap.c linux-2.6.19-spk/drivers/char/consolemap.c
1770 --- linux-2.6.19/drivers/char/consolemap.c 2006-11-29 16:57:37.000000000 -0500
1771 +++ linux-2.6.19-spk/drivers/char/consolemap.c 2006-12-01 18:28:15.000000000 -0500
1772 @@ -667,3 +667,4 @@ console_map_init(void)
1773 }
1774
1775 EXPORT_SYMBOL(con_copy_unimap);
1776 +EXPORT_SYMBOL(inverse_translate);
1777 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/keyboard.c linux-2.6.19-spk/drivers/char/keyboard.c
1778 --- linux-2.6.19/drivers/char/keyboard.c 2006-11-29 16:57:37.000000000 -0500
1779 +++ linux-2.6.19-spk/drivers/char/keyboard.c 2006-12-01 18:28:15.000000000 -0500
1780 @@ -41,6 +41,22 @@
1781 #include <linux/input.h>
1782 #include <linux/reboot.h>
1783
1784 +
1785 +#include <linux/speakup.h>
1786 +
1787 +#if defined(CONFIG_SPEAKUP_MODULE)
1788 +
1789 +spk_key_func addr_spk_key = NULL;
1790 +#define speakup_key_call(__vc, __shift, __keycode, __key, __down) \
1791 + (addr_spk_key && (*addr_spk_key)(__vc, __shift, __keycode, __key, __down))
1792 +
1793 +#elif defined(CONFIG_SPEAKUP)
1794 +#define speakup_key_call(__vc, __shift, __keycode, __key, __down) \
1795 + speakup_key(__vc, __shift, __keycode, __key, __down)
1796 +#else
1797 +#define speakup_key_call(__vc, __shift, __keycode, __key, __down) 0
1798 +#endif
1799 +
1800 static void kbd_disconnect(struct input_handle *handle);
1801 extern void ctrl_alt_del(void);
1802
1803 @@ -65,6 +81,10 @@ extern void ctrl_alt_del(void);
1804
1805 #define KBD_DEFLOCK 0
1806
1807 +/* Key types processed even in raw modes */
1808 +
1809 +#define TYPES_ALLOWED_IN_RAW_MODE ((1 << KT_SPEC) | (1 << KT_SHIFT) | (1 << KT_SPKUP))
1810 +
1811 void compute_shiftstate(void);
1812
1813 /*
1814 @@ -80,7 +100,7 @@ void compute_shiftstate(void);
1815 typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value,
1816 char up_flag);
1817 static k_handler_fn K_HANDLERS;
1818 -static k_handler_fn *k_handler[16] = { K_HANDLERS };
1819 +k_handler_fn *k_handler[16] = { K_HANDLERS };
1820
1821 #define FN_HANDLERS\
1822 fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\
1823 @@ -101,13 +121,16 @@ static fn_handler_fn *fn_handler[] = { F
1824 const int max_vals[] = {
1825 255, ARRAY_SIZE(func_table) - 1, ARRAY_SIZE(fn_handler) - 1, NR_PAD - 1,
1826 NR_DEAD - 1, 255, 3, NR_SHIFT - 1, 255, NR_ASCII - 1, NR_LOCK - 1,
1827 - 255, NR_LOCK - 1, 255, NR_BRL - 1
1828 + 255, NR_LOCK - 1, 255, NR_BRL - 1, 255
1829 };
1830
1831 const int NR_TYPES = ARRAY_SIZE(max_vals);
1832
1833 struct kbd_struct kbd_table[MAX_NR_CONSOLES];
1834 -static struct kbd_struct *kbd = kbd_table;
1835 +struct kbd_struct *kbd = kbd_table;
1836 +
1837 +EXPORT_SYMBOL(kbd);
1838 +EXPORT_SYMBOL(k_handler);
1839
1840 struct vt_spawn_console vt_spawn_con = {
1841 .lock = SPIN_LOCK_UNLOCKED,
1842 @@ -266,6 +289,8 @@ void kd_mksound(unsigned int hz, unsigne
1843 kd_nosound(0);
1844 }
1845
1846 +EXPORT_SYMBOL(kd_mksound);
1847 +
1848 /*
1849 * Setting the keyboard rate.
1850 */
1851 @@ -623,6 +648,7 @@ static void k_spec(struct vc_data *vc, u
1852 if (up_flag)
1853 return;
1854 if (value >= ARRAY_SIZE(fn_handler))
1855 + if (up_flag || (value >= ARRAY_SIZE(fn_handler)))
1856 return;
1857 if ((kbd->kbdmode == VC_RAW ||
1858 kbd->kbdmode == VC_MEDIUMRAW) &&
1859 @@ -1233,6 +1259,9 @@ static void kbd_keycode(unsigned int key
1860 key_map = key_maps[shift_final];
1861
1862 if (!key_map) {
1863 + if (speakup_key_call(vc, shift_final, keycode, K(KT_SHIFT,0), !down))
1864 + return;
1865 +
1866 compute_shiftstate();
1867 kbd->slockstate = 0;
1868 return;
1869 @@ -1256,6 +1285,9 @@ static void kbd_keycode(unsigned int key
1870
1871 type -= 0xf0;
1872
1873 + if (speakup_key_call(vc, shift_final, keycode, keysym, !down))
1874 + return;
1875 +
1876 if (raw_mode && type != KT_SPEC && type != KT_SHIFT)
1877 return;
1878
1879 @@ -1274,6 +1306,9 @@ static void kbd_keycode(unsigned int key
1880 kbd->slockstate = 0;
1881 }
1882
1883 +struct input_dev *fakekeydev=NULL;
1884 +EXPORT_SYMBOL(fakekeydev);
1885 +
1886 static void kbd_event(struct input_handle *handle, unsigned int event_type,
1887 unsigned int event_code, int value)
1888 {
1889 @@ -1311,6 +1346,7 @@ static struct input_handle *kbd_connect(
1890 return NULL;
1891
1892 handle->dev = dev;
1893 + fakekeydev = dev;
1894 handle->handler = handler;
1895 handle->name = "kbd";
1896
1897 Files linux-2.6.19/drivers/char/speakup/.makepatch.swp and linux-2.6.19-spk/drivers/char/speakup/.makepatch.swp differ
1898 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/Config.in linux-2.6.19-spk/drivers/char/speakup/Config.in
1899 --- linux-2.6.19/drivers/char/speakup/Config.in 1969-12-31 19:00:00.000000000 -0500
1900 +++ linux-2.6.19-spk/drivers/char/speakup/Config.in 2006-12-01 18:28:14.000000000 -0500
1901 @@ -0,0 +1,26 @@
1902 +tristate 'Speakup console speech' CONFIG_SPEAKUP
1903 +if [ "$CONFIG_SPEAKUP" != "n" ]; then
1904 + comment 'Type "y" for each synthesizer you want built into the kernel.'
1905 + dep_tristate "Accent SA, acntsa" CONFIG_SPEAKUP_ACNTSA $CONFIG_SPEAKUP
1906 + dep_tristate "Accent PC, acntpc" CONFIG_SPEAKUP_ACNTPC $CONFIG_SPEAKUP
1907 + dep_tristate "Apollo, apollo" CONFIG_SPEAKUP_APOLLO $CONFIG_SPEAKUP
1908 + dep_tristate "Audapter, audptr" CONFIG_SPEAKUP_AUDPTR $CONFIG_SPEAKUP
1909 + dep_tristate "Braille 'n' Speak, bns" CONFIG_SPEAKUP_BNS $CONFIG_SPEAKUP
1910 + dep_tristate "DECtalk Express, dectlk" CONFIG_SPEAKUP_DECTLK $CONFIG_SPEAKUP
1911 + dep_tristate "DECtalk External (old), decext" CONFIG_SPEAKUP_DECEXT $CONFIG_SPEAKUP
1912 + dep_tristate "DECtalk PC (big ISA card), decpc" CONFIG_SPEAKUP_DECPC $CONFIG_SPEAKUP
1913 + if [ "$CONFIG_SPEAKUP_DECPC" = "y" ] ;then
1914 + comment 'warning: decpc can only be built as a module'
1915 + fi
1916 + comment 'In order to use this you will need'
1917 + comment 'the dtload program and DECPC software files '
1918 + comment 'Read the accompanying DECPC documentation for more details'
1919 + dep_tristate "DoubleTalk PC, dtlk" CONFIG_SPEAKUP_DTLK $CONFIG_SPEAKUP
1920 + dep_tristate "Keynote Gold PC, keypc" CONFIG_SPEAKUP_KEYPC $CONFIG_SPEAKUP
1921 + dep_tristate "DoubleTalk LT or LiteTalk, ltlk" CONFIG_SPEAKUP_LTLK $CONFIG_SPEAKUP
1922 + dep_tristate "Software synthesizers /dev/sftsyn, sftsyn" CONFIG_SPEAKUP_SFTSYN $CONFIG_SPEAKUP
1923 + dep_tristate "Speak Out, spkout" CONFIG_SPEAKUP_SPKOUT $CONFIG_SPEAKUP
1924 + dep_tristate "Transport, txprt" CONFIG_SPEAKUP_TXPRT $CONFIG_SPEAKUP
1925 + comment 'Enter the three to six character synth string from above or none.'
1926 + string "Default synthesizer for Speakup" CONFIG_SPEAKUP_DEFAULT "none"
1927 +fi
1928 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/Kconfig linux-2.6.19-spk/drivers/char/speakup/Kconfig
1929 --- linux-2.6.19/drivers/char/speakup/Kconfig 1969-12-31 19:00:00.000000000 -0500
1930 +++ linux-2.6.19-spk/drivers/char/speakup/Kconfig 2006-12-01 18:28:14.000000000 -0500
1931 @@ -0,0 +1,211 @@
1932 +menu "Speakup console speech"
1933 +config SPEAKUP
1934 + tristate "Build speakup console speech"
1935 + ---help---
1936 +
1937 + This is the Speakup screen reader. Think of it as a
1938 + video console for blind people. If built in to the
1939 + kernel, it can speak evrything on the text console from
1940 + boot up to shutdown. For more information on Speakup,
1941 + point your browser at http://www.linux-speakup.org/.
1942 + There is also a mailing list at the above url that you
1943 + can subscribe to.
1944 +
1945 + Supported synthesizers are accent sa, accent pc, appollo
1946 + II., Auddapter, Braille 'n Speak, Dectalk external
1947 + (old), Dectalk PC (full length isa board), Dectalk
1948 + express, Doubletalk, Doubletalk LT or Litetalk,
1949 + Keynote
1950 + Gold internal PC, software synthesizers, Speakout, and transport.
1951 +
1952 + Speakup can either be built in or compiled as a module
1953 + by answering y or m. If you answer y here, then you
1954 + must answer either y or m to at least one of the
1955 + synthesizer drivers below. If you answer m here, then
1956 + the synthesizer drivers below can only be built as
1957 + modules.
1958 +
1959 + These drivers are not standalone drivers, but must be
1960 + used in conjunction with Speakup. Think of them as
1961 + video cards for blind people.
1962 +
1963 +
1964 + The Dectalk pc driver can only be built as a module, and
1965 + requires software to be pre-loaded on to the card before
1966 + the module can be loaded. See the decpc choice below
1967 + for more details.
1968 +
1969 + If you are not a blind person, or don't have access to
1970 + one of the listed synthesizers, you should say n.
1971 +
1972 +config SPEAKUP_ACNTSA
1973 + depends on SPEAKUP
1974 + tristate "Accent SA, acntsa"
1975 + ---help---
1976 +
1977 + This is the Speakup driver for the accent sa
1978 + synthesizer. You can say y to build it into the kernel,
1979 + or m to build it as a module. See the configuration
1980 + help on the Speakup choice above for more info.
1981 +
1982 +config SPEAKUP_ACNTPC
1983 + depends on SPEAKUP
1984 + tristate "Accent PC, acntpc"
1985 + ---help---
1986 +
1987 + This is the Speakup driver for the accent pc
1988 + synthesizer. You can say y to build it into the kernel,
1989 + or m to build it as a module. See the configuration
1990 + help on the Speakup choice above for more info.
1991 +
1992 +config SPEAKUP_APOLLO
1993 + depends on SPEAKUP
1994 + tristate "Apollo, apollo"
1995 + ---help---
1996 +
1997 + This is the Speakup driver for the Apollo II
1998 + synthesizer. You can say y to build it into the kernel,
1999 + or m to build it as a module. See the configuration
2000 + help on the Speakup choice above for more info.
2001 +
2002 +config SPEAKUP_AUDPTR
2003 + depends on SPEAKUP
2004 + tristate "Audapter, audptr"
2005 + ---help---
2006 +
2007 + This is the Speakup driver for the Audapter synthesizer.
2008 + You can say y to build it into the kernel, or m to
2009 + build it as a module. See the configuration help on the
2010 + Speakup choice above for more info.
2011 +
2012 +config SPEAKUP_BNS
2013 + depends on SPEAKUP
2014 + tristate "Braille 'n' Speak, bns"
2015 + ---help---
2016 +
2017 + This is the Speakup driver for the Braille 'n' Speak
2018 + synthesizer. You can say y to build it into the kernel,
2019 + or m to build it as a module. See the configuration
2020 + help on the Speakup choice above for more info.
2021 +
2022 +config SPEAKUP_DECTLK
2023 + depends on SPEAKUP
2024 + tristate "DECtalk Express, dectlk"
2025 + ---help---
2026 +
2027 + This is the Speakup driver for the DecTalk Express
2028 + synthesizer. You can say y to build it into the kernel,
2029 + or m to build it as a module. See the configuration
2030 + help on the Speakup choice above for more info.
2031 +
2032 +config SPEAKUP_DECEXT
2033 + depends on SPEAKUP
2034 + tristate "DECtalk External (old), decext"
2035 + ---help---
2036 +
2037 + This is the Speakup driver for the DecTalk External
2038 + (old) synthesizer. You can say y to build it into the
2039 + kernel, or m to build it as a module. See the
2040 + configuration help on the Speakup choice above for more
2041 + info.
2042 +
2043 +config SPEAKUP_DECPC
2044 + depends on SPEAKUP
2045 + tristate "DECtalk PC (big ISA card), decpc"
2046 + ---help---
2047 +
2048 + This is the Speakup driver for the DecTalk PC (full
2049 + length ISA) synthesizer. You can say m to build it as
2050 + a module. See the configuration help on the Speakup
2051 + choice above for more info.
2052 +
2053 + In order to use the DecTalk PC driver, you must download
2054 + the dec_pc.tgz file from linux-speakup.org. It is in
2055 + the pub/linux/goodies directory. The dec_pc.tgz file
2056 + contains the software which must be pre-loaded on to the
2057 + DecTalk PC board in order to use it with this driver.
2058 + This driver must be built as a module, and can not be
2059 + loaded until the file system is mounted and the DecTalk
2060 + PC software has been pre-loaded on to the board.
2061 +
2062 + See the README file in the dec_pc.tgz file for more
2063 + details.
2064 +
2065 +config SPEAKUP_DTLK
2066 + depends on SPEAKUP
2067 + tristate "DoubleTalk PC, dtlk"
2068 + ---help---
2069 +
2070 + This is the Speakup driver for the internal DoubleTalk
2071 + PC synthesizer. You can say y to build it into the
2072 + kernel, or m to build it as a module. See the
2073 + configuration help on the Speakup choice above for more
2074 + info.
2075 +
2076 +config SPEAKUP_KEYPC
2077 + depends on SPEAKUP
2078 + tristate "Keynote Gold PC, keypc"
2079 + ---help---
2080 +
2081 + This is the Speakup driver for the Keynote Gold
2082 + PC synthesizer. You can say y to build it into the
2083 + kernel, or m to build it as a module. See the
2084 + configuration help on the Speakup choice above for more
2085 + info.
2086 +
2087 +config SPEAKUP_LTLK
2088 + depends on SPEAKUP
2089 + tristate "DoubleTalk LT or LiteTalk, ltlk"
2090 +---help---
2091 +
2092 + This is the Speakup driver for the LiteTalk/DoubleTalk
2093 + LT synthesizer. You can say y to build it into the
2094 + kernel, or m to build it as a module. See the
2095 + configuration help on the Speakup choice above for more
2096 + info.
2097 +
2098 +config SPEAKUP_SFTSYN
2099 + depends on SPEAKUP
2100 + tristate "Software synthesizers, sftsyn"
2101 +---help---
2102 +
2103 + This is the software synthesizer device node. It will
2104 + register a device /dev/sftsyn which midware programs
2105 + and speech
2106 + daemons may open and read to provide kernel output to
2107 + software synths
2108 + such as festival, flite, tuxtalk and so forth. You
2109 + can select 'y' or
2110 + 'm' to have it built-in to the kernel or loaded as a module.
2111 +
2112 +config SPEAKUP_SPKOUT
2113 + depends on SPEAKUP
2114 + tristate "Speak Out, spkout"
2115 + ---help---
2116 +
2117 + This is the Speakup driver for the Speakout synthesizer.
2118 + You can say y to build it into the kernel, or m to
2119 + build it as a module. See the configuration help on the
2120 + Speakup choice above for more info.
2121 +
2122 +config SPEAKUP_TXPRT
2123 + depends on SPEAKUP
2124 + tristate "Transport, txprt"
2125 + ---help---
2126 +
2127 + This is the Speakup driver for the Transport
2128 + synthesizer. You can say y to build it into the kernel,
2129 + or m to build it as a module. See the configuration
2130 + help on the Speakup choice above for more info.
2131 +
2132 +if SPEAKUP != n
2133 +comment 'Enter the 3 to 6 character keyword from the list above, or none for no default synthesizer on boot up.'
2134 + depends on SPEAKUP
2135 +endif
2136 +
2137 +config SPEAKUP_DEFAULT
2138 + string "Choose Default synthesizer for Speakup"
2139 + depends on SPEAKUP
2140 + default "none"
2141 +
2142 +endmenu
2143 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/Makefile linux-2.6.19-spk/drivers/char/speakup/Makefile
2144 --- linux-2.6.19/drivers/char/speakup/Makefile 1969-12-31 19:00:00.000000000 -0500
2145 +++ linux-2.6.19-spk/drivers/char/speakup/Makefile 2006-12-01 18:28:14.000000000 -0500
2146 @@ -0,0 +1,61 @@
2147 +#
2148 +# Makefile for the speakup speech output system.
2149 +#
2150 +
2151 +V := $(shell awk '/UTS_RELEASE/ {print substr($$3,2,3)}' $(TOPDIR)/include/linux/version.h)
2152 +ifeq ($V,2.4)
2153 +# Note! Dependencies are done automagically by 'make dep', which also
2154 +# removes any old dependencies. DON'T put your own dependencies here
2155 +# unless it's something special (ie not a .c file).
2156 +#
2157 +# Note 2! The CFLAGS definitions are now inherited from the
2158 +# parent makes..
2159 +#
2160 +O_TARGET := spk.o
2161 +export-objs := speakup_drvcommon.o speakup.o
2162 +endif
2163 +obj-m = speakup_keyhelp.o
2164 +speakupmain-objs := speakup.o speakup_drvcommon.o
2165 +obj-$(CONFIG_SPEAKUP) += speakupmain.o
2166 +obj-$(CONFIG_SPEAKUP_ACNTPC) += speakup_acntpc.o
2167 +obj-$(CONFIG_SPEAKUP_ACNTSA) += speakup_acntsa.o
2168 +obj-$(CONFIG_SPEAKUP_APOLLO) += speakup_apollo.o
2169 +obj-$(CONFIG_SPEAKUP_AUDPTR) += speakup_audptr.o
2170 +obj-$(CONFIG_SPEAKUP_BNS) += speakup_bns.o
2171 +obj-$(CONFIG_SPEAKUP_DECEXT) += speakup_decext.o
2172 +obj-$(CONFIG_SPEAKUP_DECPC) += speakup_decpc.o
2173 +obj-$(CONFIG_SPEAKUP_DECTLK) += speakup_dectlk.o
2174 +obj-$(CONFIG_SPEAKUP_DTLK) += speakup_dtlk.o
2175 +obj-$(CONFIG_SPEAKUP_KEYPC) += speakup_keypc.o
2176 +obj-$(CONFIG_SPEAKUP_LTLK) += speakup_ltlk.o
2177 +obj-$(CONFIG_SPEAKUP_SFTSYN) += speakup_sftsyn.o
2178 +obj-$(CONFIG_SPEAKUP_SPKOUT) += speakup_spkout.o
2179 +obj-$(CONFIG_SPEAKUP_TXPRT) += speakup_txprt.o
2180 +
2181 +ifeq ($V,2.4)
2182 + include $(TOPDIR)/Rules.make
2183 +
2184 +speakupmap.h: speakupmap.map genmap
2185 + ./genmap speakupmap.map >$@
2186 +
2187 +genmap: genmap.c mapdata.h
2188 + cc -o genmap genmap.c
2189 +
2190 +mapdata.h: makemapdata.c keyinfo.h
2191 + cc -o makemapdata makemapdata.c
2192 + ./makemapdata >mapdata.h
2193 +
2194 +endif
2195 +speakupmain.o:speakup.o speakup_drvcommon.o
2196 + ld -r -o speakupmain.o speakup.o speakup_drvcommon.o
2197 +
2198 +$(obj)/speakupmap.h: $(src)/speakupmap.map $(src)/genmap
2199 + $(src)/genmap $(src)/speakupmap.map >$@
2200 +
2201 +$(obj)/mapdata.h: $(src)/keyinfo.h $(src)/makemapdata
2202 + $(src)/makemapdata >$@
2203 +
2204 +$(obj)/genmap: $(obj)/mapdata.h
2205 +
2206 +HOSTCFLAGS := -Iinclude -I/usr/include
2207 +hostprogs-y := makemapdata genmap
2208 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/cvsversion.h linux-2.6.19-spk/drivers/char/speakup/cvsversion.h
2209 --- linux-2.6.19/drivers/char/speakup/cvsversion.h 1969-12-31 19:00:00.000000000 -0500
2210 +++ linux-2.6.19-spk/drivers/char/speakup/cvsversion.h 2006-12-01 18:28:14.000000000 -0500
2211 @@ -0,0 +1 @@
2212 +#define CVSVERSION " CVS: Sat Oct 7 10:52:29 EDT 2006 "
2213 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/dtload.c linux-2.6.19-spk/drivers/char/speakup/dtload.c
2214 --- linux-2.6.19/drivers/char/speakup/dtload.c 1969-12-31 19:00:00.000000000 -0500
2215 +++ linux-2.6.19-spk/drivers/char/speakup/dtload.c 2006-12-01 18:28:14.000000000 -0500
2216 @@ -0,0 +1,554 @@
2217 +/*
2218 + * This is the DECtalk PC firmware loader for the Linux kernel, version 1.0
2219 + *
2220 + * Original 386BSD source:
2221 + * Copyright ( c ) 1996 Brian Buhrow <buhrow@lothlorien.nfbcal.org>
2222 + *
2223 + * Adapted for Linux:
2224 + * Copyright ( c ) 1997 Nicolas Pitre <nico@cam.org>
2225 + *
2226 + * Adapted for speakup:
2227 + * Copyright ( c ) 2003 David Borowski <david575@golden.net>
2228 + *
2229 + * All rights reserved.
2230 + *
2231 + * This program is free software; you can redistribute it and/or modify
2232 + * it under the terms of the GNU General Public License as published by
2233 + * the Free Software Foundation; either version 2 of the License, or
2234 + * ( at your option ) any later version.
2235 + *
2236 + * This program is distributed in the hope that it will be useful,
2237 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2238 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2239 + * GNU General Public License for more details.
2240 + *
2241 + * You should have received a copy of the GNU General Public License
2242 + * along with this program; if not, write to the Free Software
2243 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2244 + *
2245 + */
2246 +
2247 +#include <stdio.h>
2248 +#include <stdlib.h>
2249 +#include <unistd.h>
2250 +#include <string.h>
2251 +#include <sys/types.h>
2252 +#include <sys/stat.h>
2253 +#include <fcntl.h>
2254 +#include <malloc.h>
2255 +#include <sys/errno.h>
2256 +#include <asm/io.h>
2257 +#include "dtload.h"
2258 +#include "dtpc_reg.h"
2259 +
2260 +#define dt_delay(x) usleep(x)
2261 +int verbose = 0, intest = 0,infd = -1;
2262 +int image_len, total_paras;
2263 +int dt_stat, dma_state = 0, has_kernel = 0;
2264 +struct dos_reloc fixups[512];
2265 +char *read_buff = NULL;
2266 +struct dos_exe_header header;
2267 +u_short iobase = 0x350;
2268 +
2269 +static inline int dt_getstatus( )
2270 +{
2271 + dt_stat = inb_p( iobase )|(inb_p( iobase+1 )<<8);
2272 + return dt_stat;
2273 +}
2274 +
2275 +static void dt_sendcmd( u_int cmd )
2276 +{
2277 + outb_p( cmd & 0xFF, iobase );
2278 + outb_p( (cmd>>8) & 0xFF, iobase+1 );
2279 +}
2280 +
2281 +static int dt_waitbit( int bit )
2282 +{
2283 + int timeout = 100;
2284 + while ( --timeout > 0 ) {
2285 + if( (dt_getstatus( ) & bit ) == bit ) return 1;
2286 + usleep( 1000 );
2287 + }
2288 + return 0;
2289 +}
2290 +
2291 +static int dt_sendcmd_wait( u_int cmd, int bit )
2292 +{
2293 + int timeout = 1000;
2294 + outb_p( cmd & 0xFF, iobase );
2295 + outb_p( (cmd>>8) & 0xFF, iobase+1 );
2296 + while ( --timeout > 0 ) {
2297 + if( (dt_getstatus( ) & bit ) == bit ) return 1;
2298 + usleep( 1000 );
2299 + }
2300 + return 0;
2301 +}
2302 +
2303 +static int dt_waitmode( int pattern )
2304 +{
2305 + int timeout = 1000;
2306 + while ( --timeout > 0 ) {
2307 + if( dt_getstatus( ) == pattern ) return 1;
2308 + usleep( 1000 );
2309 + }
2310 + fprintf( stderr, "waitmode p=%x s = %x\n", pattern, dt_stat );
2311 + return 0;
2312 +}
2313 +
2314 +static int dt_wait_dma( )
2315 +{
2316 + int timeout = 1000, state = dma_state;
2317 + if( !has_kernel ){
2318 + dt_delay( 500 );
2319 + return( dt_waitbit( STAT_dma_ready ) );
2320 + }
2321 + if( ! dt_waitbit( STAT_dma_ready ) ) return 0;
2322 + while ( --timeout > 0 ) {
2323 + if( (dt_getstatus()&STAT_dma_state) == state ) return 1;
2324 + usleep( 1000 );
2325 + }
2326 + dma_state = dt_getstatus( ) & STAT_dma_state;
2327 + return 1;
2328 +}
2329 +
2330 +dt_ctrl( u_int cmd )
2331 +{
2332 + while ( ! dt_waitbit( STAT_cmd_ready ) ) dt_delay( 100 );
2333 + outb_p( 0, iobase+2 );
2334 + outb_p( 0, iobase+3 );
2335 + dt_getstatus( );
2336 + dt_sendcmd( CMD_control|cmd );
2337 + outb_p( 0, iobase+6 );
2338 + dt_delay( 100 );
2339 + dt_sendcmd( CMD_null );
2340 + while ( ! dt_waitbit( STAT_cmd_ready ) ) dt_delay( 100 );
2341 +}
2342 +
2343 +int dt_flush( void )
2344 +{
2345 + dt_ctrl( CTRL_flush );
2346 + dt_waitbit( STAT_dma_ready );
2347 + outb_p( DMA_sync, iobase+4 );
2348 + outb_p( 0, iobase+4 );
2349 + dma_state ^= STAT_dma_state;
2350 + while( dt_getstatus( ) & STAT_flushing ) dt_delay( 100 );
2351 + return 0;
2352 +}
2353 +
2354 +static int dt_sendbuff( char *src, int len )
2355 +{
2356 + while( len-- ){
2357 + if( ! dt_wait_dma( ) ) return -1;
2358 + if( ! (dt_getstatus( ) & STAT_rr_char) ) break;
2359 + outb_p( DMA_single_in, iobase+4 );
2360 + outb_p( *src++, iobase+4 );
2361 + dma_state ^= STAT_dma_state;
2362 + }
2363 + return 0;
2364 +}
2365 +
2366 +unsigned long dt_allocmem( unsigned long paras )
2367 +{
2368 + unsigned long addr;
2369 + if( ! dt_wait_dma( ) ) return 0;
2370 + outb_p( DMA_control, iobase+4 );
2371 + outb_p( DT_MEM_ALLOC, iobase+4 );
2372 + dma_state ^= STAT_dma_state;
2373 + if( ! dt_wait_dma( ) ) return 0;
2374 + outb_p( paras & 0xFF, iobase+4 );
2375 + outb_p( (paras>>8) & 0xFF, iobase+4 );
2376 + dma_state ^= STAT_dma_state;
2377 + if( ! dt_wait_dma( ) ) return 0;
2378 + addr = inb_p( iobase+4 );
2379 + addr |= (inb_p( iobase+4 )<<8);
2380 + addr += (inb_p( iobase+4 )<<4);
2381 + addr += (inb_p( iobase+4 )<<12);
2382 + dma_state ^= STAT_dma_state;
2383 + return addr;
2384 +}
2385 +
2386 +static int testkernel( void )
2387 +{
2388 + dt_sendcmd( CMD_sync );
2389 + if( ! dt_waitbit( STAT_cmd_ready ) ) return -10;
2390 + has_kernel = ( dt_stat&0x8000 ) ? 1 : 0;
2391 + if ( verbose ) printf( "testkernel got %x\n", dt_stat );
2392 + if ( has_kernel ) return 0;
2393 + dt_delay( 100 );
2394 + return 1;
2395 +}
2396 +
2397 +static int dt_loadmem( int addr, int len, char *src )
2398 +{
2399 + char c;
2400 + int l;
2401 + if ( verbose ) printf( "dt_loadmem: addr = %08X size = %d\n", addr, len );
2402 + do {
2403 + l = len;
2404 + if ( l >= 0xc000 ) l = 0xc000;
2405 + len -= l;
2406 + if( ! dt_wait_dma( ) ) return -1;
2407 + outb_p( DMA_control, iobase+4 );
2408 + outb_p( DT_LOAD_MEM, iobase+4 );
2409 + dma_state ^= STAT_dma_state;
2410 + if( ! dt_wait_dma( ) ) return -2;
2411 + outb_p( addr & 0xFF, iobase+4 );
2412 + outb_p( (addr>>8) & 0xFF, iobase+4 );
2413 + outb_p( (addr>>16) & 0xFF, iobase+4 );
2414 + outb_p( (addr>>24) & 0xFF, iobase+4 );
2415 + outb_p( l & 0xFF, iobase+4 );
2416 + outb_p( (l>>8) & 0xFF, iobase+4 );
2417 + dma_state ^= STAT_dma_state;
2418 + if( ! dt_wait_dma( ) ) return -3;
2419 + addr += l;
2420 + while( l-- ){
2421 + c = *src++;
2422 + outb_p( c, iobase+4 );
2423 + }
2424 + dma_state ^= STAT_dma_state;
2425 + } while ( len > 0 );
2426 + return 0;
2427 +}
2428 +
2429 +unsigned int loadfile ( char *filename )
2430 +{
2431 + int i, header_size;
2432 + unsigned int total_paras;
2433 + long fix;
2434 + infd = open ( filename, O_RDONLY );
2435 + if ( infd == -1 ) {
2436 + perror ( "Opening file: " );
2437 + return 0;
2438 + }
2439 + read ( infd, &header, sizeof ( struct dos_exe_header ) );
2440 + if ( header.id != 0x5a4d ) {
2441 + fprintf ( stderr, "Invalid header file format\n" );
2442 + fprintf ( stderr, "Want 0x5a4d, got 0x%x\n", header.id );
2443 + return 0;
2444 + }
2445 + if ( header.relen > MAX_FIXUPS ) {
2446 + fprintf ( stderr, "Too many fixups\n" );
2447 + return 0;
2448 + }
2449 + lseek ( infd, ( long ) header.reloc, SEEK_SET );
2450 + read ( infd, fixups, sizeof ( struct dos_reloc ) * header.relen );
2451 + header_size = header.hsize * 16;
2452 + lseek ( infd, ( long )header_size, SEEK_SET );
2453 + image_len = ( ( header.pages-1 )*512 ) + ( header.rem- header_size );
2454 + total_paras = ( image_len >> 4 ) + header.hmin + 16;
2455 + read ( infd, read_buff, image_len );
2456 + close( infd );
2457 + return total_paras;
2458 +}
2459 +
2460 +static int loadkernel( char *filename )
2461 +{
2462 + int segfix = 0x40, fix, i;
2463 + int ipval, csval;
2464 + if ( has_kernel ) return 0;
2465 + if ( !loadfile( filename ) ) return -1;
2466 + header.csval += segfix;
2467 + header.ssval += segfix;
2468 + if ( verbose ) {
2469 + printf ( "Loading kernel of %ld bytes ( %d relocs )\n",
2470 + image_len, header.relen );
2471 + printf ( " cs:ip == %04x:%04x ss:sp == %04x:%04x\n",
2472 + header.csval, header.ipval, header.ssval, header.spval );
2473 + }
2474 + for ( i = 0; i < header.relen; i++ ) {
2475 + fix = ( fixups[i].segment << 4 ) + fixups[i].offset;
2476 + ( *( unsigned int * ) &read_buff[fix] ) += segfix;
2477 + }
2478 + csval = header.csval;
2479 + ipval = header.ipval;
2480 + dt_sendcmd_wait( MODULE_reset, MODULE_init );
2481 + dt_sendcmd( CMD_reset );
2482 + if( dt_getstatus( ) == MODULE_self_test ){
2483 + if( ! dt_waitmode( MODULE_init ) ) return -1;
2484 + }
2485 + if ( !dt_sendcmd_wait( CMD_reset, MODE_status ) ) return -2;
2486 + if ( !dt_sendcmd_wait( CMD_sync, MODE_error ) ) return -3;
2487 + if ( !dt_sendcmd_wait( CMD_reset, MODE_status ) ) return -4;
2488 + if ( verbose ) printf( "card is ready\n" );
2489 + dt_sendcmd( CMD_dma );
2490 + if( ! dt_waitbit( STAT_dma_ready ) ) return -5;
2491 + if( ( i = dt_loadmem( 0x00000400, image_len, read_buff ) ) ) {
2492 + fprintf( stderr, "kernel load failed, status %d\n", i );
2493 + return -6;
2494 + }
2495 + dt_delay( 100 );
2496 + /* the kernel is loaded, start it */
2497 + if ( !dt_sendcmd_wait( CMD_reset, MODE_status ) ) return -7;
2498 + dt_sendcmd( CMD_dma+1 ); /**xxx**/
2499 + dt_delay( 100 );
2500 + if( ! dt_waitbit( STAT_dma_ready ) ) return-8;
2501 + outb_p( DMA_control, iobase+4 );
2502 + outb_p( DT_START_TASK, iobase+4 );
2503 + dt_delay( 100 );
2504 + outb_p( ipval & 0xFF, iobase+4 );
2505 + outb_p( (ipval>>8) & 0xFF, iobase+4 );
2506 + outb_p( csval & 0xFF, iobase+4 );
2507 + outb_p( (csval>>8) & 0xFF, iobase+4 );
2508 + if( ! dt_waitmode( 0xc001 ) ) return -9;
2509 + if ( verbose ) {
2510 + printf( "done loading kernel\n" );
2511 + }
2512 + return testkernel( );
2513 +}
2514 +
2515 +int loaddict ( char *filename, char *name, int type )
2516 +{
2517 + int i, read_index, read_size, act_size;
2518 + unsigned short *index_fix, seg_fix;
2519 + unsigned long entries, index, dic_bytes, dic_addr;
2520 + unsigned int total_paras;
2521 + unsigned long param, l;
2522 + infd = open ( filename, O_RDONLY );
2523 + if ( infd == -1 ) {
2524 + perror ( filename );
2525 + return -1;
2526 + }
2527 +/* read in the entry count and the actual entry size excluding the
2528 + * index table ( which is entries * 4 ) ... */
2529 + read ( infd, &entries, 4 );
2530 + read ( infd, &dic_bytes, 4 );
2531 + if ( verbose )
2532 + printf ( "Loading %s dictionary of %lu entries, %lu bytes.\n",
2533 + name, entries, dic_bytes );
2534 + total_paras = ( ( ( entries * 4 ) + dic_bytes ) >> 4 ) + 2;
2535 + if ( verbose )
2536 + printf ( "Allocating %d paragraphs of free ram ...\n", total_paras );
2537 + l = dt_allocmem( total_paras );
2538 + if ( l == 0 ) {
2539 + perror ( "Error requesting memory from speech device" );
2540 + return -1;
2541 + }
2542 + seg_fix = ( l >> 4 ) & 0xffff;
2543 + dic_addr = l;
2544 + index = entries;
2545 + index_fix = ( unsigned short * ) &read_buff[0];
2546 + if ( verbose )
2547 + printf ( "Index table starts at %lx\n", l );
2548 + read_index = index*4;
2549 + act_size = read ( infd, read_buff, read_index );
2550 + if ( act_size != read_index ) {
2551 + fprintf ( stderr, "\nError reading indexes\n" );
2552 + fprintf ( stderr, " exp : %d act : %d\n", read_index * 4, act_size );
2553 + return -1;
2554 + }
2555 + for ( i = 1; i < index * 2; i += 2 )
2556 + index_fix[i] += seg_fix;
2557 + if( ( i = dt_loadmem( l, read_index, read_buff ) ) ) {
2558 + fprintf ( stderr, "\nError loading indexes at 0x%lX: i %d\n",
2559 + l, i );
2560 + return -1;
2561 + }
2562 + l += read_index;
2563 +/* now, load up the dictionary bytes ... */
2564 + if ( verbose )
2565 + printf ( "Dictionary text starts at %lx\n", l );
2566 + read_size = dic_bytes;
2567 + if ( ( act_size = read ( infd, read_buff, read_size ) ) != read_size ) {
2568 + fprintf ( stderr, "\nError reading dictionary text!\n" );
2569 + fprintf ( stderr, "asked : %d actual : %d\n", act_size, read_size );
2570 + return -1;
2571 + }
2572 + if( ( i = dt_loadmem( l, read_size, read_buff ) ) ) {
2573 + fprintf ( stderr, "\nError loading dictionary at 0x%lX: status %d\n",
2574 + l, i );
2575 + return -1;
2576 + }
2577 + if( ! dt_wait_dma( ) ) return -1;
2578 + outb_p( DMA_control, iobase+4 );
2579 + outb_p( DT_SET_DIC, iobase+4 );
2580 + dma_state ^= STAT_dma_state;
2581 + if( ! dt_wait_dma( ) ) return -1;
2582 + l = dic_addr;
2583 + l = ((l << 12) & 0xFFFF0000) + (l & 0x0000000F);
2584 + outb_p( l & 0xFF, iobase+4 );
2585 + outb_p( (l>>8) & 0xFF, iobase+4 );
2586 + outb_p( (l>>16) & 0xFF, iobase+4 );
2587 + outb_p( (l>>24) & 0xFF, iobase+4 );
2588 + l = entries;
2589 + outb_p( l & 0xFF, iobase+4 );
2590 + outb_p( (l>>8) & 0xFF, iobase+4 );
2591 + outb_p( (l>>16) & 0xFF, iobase+4 );
2592 + outb_p( (l>>24) & 0xFF, iobase+4 );
2593 + l = type;
2594 + outb_p( l & 0xFF, iobase+4 );
2595 + outb_p( (l>>8) & 0xFF, iobase+4 );
2596 + dma_state ^= STAT_dma_state;
2597 + close ( infd );
2598 + if ( verbose ) printf( "dictionary load complete\n" );
2599 + return 0;
2600 +}
2601 +
2602 +int loadexe ( char *filename )
2603 +{
2604 + unsigned int load_addr = 0, seg_fix;
2605 + int i, read_size;
2606 + int ipval, csval;
2607 + long fix;
2608 + unsigned long total_paras;
2609 + total_paras = loadfile ( filename );
2610 + if ( total_paras == 0 ) return -1;
2611 + load_addr = dt_allocmem( total_paras );
2612 + if ( load_addr == 0 ) {
2613 + fprintf ( stderr, "Error allocating memory on card: " );
2614 + return -1;
2615 + }
2616 + seg_fix = ( load_addr >> 4 ) & 0xffff;
2617 + if ( verbose ) {
2618 + printf ( "Loading %s %ld bytes ( %d relocs )\n",
2619 + filename, image_len, header.relen );
2620 + printf ( "Allocating %ld bytes of free ram at %05x\n",
2621 + ( long ) header.hmin * 16, load_addr );
2622 + printf ( "Total memory taken is %ld bytes\n", ( long ) total_paras * 16 );
2623 + printf ( " cs:ip == %04x:%04x ss:sp == %04x:%04x\n",
2624 + header.csval + seg_fix, header.ipval, header.ssval + seg_fix, header.spval );
2625 + }
2626 + for ( i = 0; i < header.relen; i++ ) {
2627 + fix = ( ( long ) fixups[i].segment << 4 ) + ( long ) fixups[i].offset;
2628 + ( *( unsigned int * ) &read_buff[fix] ) += seg_fix;
2629 + }
2630 + if( ( i = dt_loadmem( load_addr, image_len, read_buff ) ) ) {
2631 + fprintf ( stderr, "Error loading speech device at 0x%lX: status %d\n",
2632 + load_addr, i );
2633 + return -1;
2634 + }
2635 + csval = header.csval + seg_fix;
2636 + ipval = header.ipval;
2637 + if( ! dt_wait_dma( ) ) return -1;
2638 + outb_p( DMA_control, iobase+4 );
2639 + outb_p( DT_START_TASK, iobase+4 );
2640 + dma_state ^= STAT_dma_state;
2641 + if( ! dt_wait_dma( ) ) return -1;
2642 + outb_p( ipval & 0xFF, iobase+4 );
2643 + outb_p( (ipval>>8) & 0xFF, iobase+4 );
2644 + outb_p( csval & 0xFF, iobase+4 );
2645 + outb_p( (csval>>8) & 0xFF, iobase+4 );
2646 + dma_state ^= STAT_dma_state;
2647 + return 0;
2648 +}
2649 +
2650 +void release_io( void )
2651 +{
2652 + ioperm( (long)iobase, 8, 0 );
2653 + ioperm( (long)0x0080, 1, 0 );
2654 + if ( read_buff ) free( read_buff );
2655 +}
2656 +
2657 +parseparm( char *parm, char *value )
2658 +{
2659 + char *cp = parm+strlen( parm );
2660 + while ( --cp > parm ) if ( *cp > ' ' ) break;
2661 + cp[1] = '\0';
2662 + if ( !strcmp( parm, "io" ) ) {
2663 + long io = strtol( value, 0, 0 );
2664 + if ( io >= 0x100 && io <= 0x350 ) {
2665 + iobase = (u_short)io;
2666 + return;
2667 + }
2668 + fprintf( stderr, "invalid io value %s\n", value );
2669 + exit( 1 );
2670 + } else if ( !strcmp( parm,"verbose" ) ) {
2671 + verbose = atoi( value );
2672 + }
2673 +}
2674 +
2675 +do_test( void )
2676 +{
2677 + char buffer[512];
2678 + int len;
2679 + dma_state = dt_getstatus( ) & STAT_dma_state;
2680 + while ( fgets( buffer, 510, stdin ) ) {
2681 + len = strlen( buffer );
2682 + if ( len == 1 ) dt_flush( );
2683 + else {
2684 + if ( buffer[len-1] == '\n' ) buffer[len-1] = '\013';
2685 + dt_sendbuff( buffer, len );
2686 + }
2687 + }
2688 + *buffer = '\013';
2689 + dt_sendbuff( buffer, 1 );
2690 +}
2691 +
2692 +int main ( int argc, char **argv )
2693 +{
2694 + char name[80], *cp;
2695 + char *dirname = 0, *confname = "dec_pc.conf";
2696 + char *init_msg = "[:ra 360] dec pc initialized\011";
2697 + FILE *confile;
2698 + struct stat statbuf;
2699 + int maxsize = 0, status = 0;
2700 + while ( --argc > 0 ) {
2701 + argv++;
2702 + if ( !strcmp( *argv, "-v" ) ) verbose = 1;
2703 + else if ( !strcmp( *argv, "-t" ) ) intest = 1;
2704 + else dirname = *argv;
2705 + }
2706 + if ( !dirname ) dirname = "/usr/local/lib/dec_pc";
2707 + if ( chdir( dirname ) != 0 ) {
2708 + fprintf( stderr, "cannot chdir to %s\n", dirname );
2709 + exit( 1 );
2710 + }
2711 + if ( !( confile = fopen( confname, "r" ) ) ) {
2712 + fprintf( stderr, "could not open %s", confname );
2713 + exit( 1 );
2714 + }
2715 + while ( fgets( name, 80, confile ) ) {
2716 + cp = strchr( name, '\n' );
2717 + if ( cp ) *cp = '\0';
2718 + if ( ( cp = strchr( name, '=' ) ) ) {
2719 + *cp++ = '\0';
2720 + parseparm( name, cp );
2721 + continue;
2722 + }
2723 + if ( stat( name, &statbuf ) != 0 ) {
2724 + fprintf( stderr, "cannot stat %s\n", name );
2725 + exit( 1 );
2726 + }
2727 + if ( statbuf.st_size > maxsize ) maxsize = statbuf.st_size;
2728 + }
2729 + rewind( confile );
2730 + if ( ioperm( (long)0x0080, 1, 1 ) || ioperm( (long)iobase, 8, 1 ) ) {
2731 + fprintf( stderr, "could not get ioperm\n" );
2732 + exit( 1 );
2733 + }
2734 + atexit( release_io );
2735 + if ( testkernel( ) == 0 ) {
2736 + if ( intest ) do_test( );
2737 + else fprintf( stderr, "kernel already loaded\n" );
2738 + exit( 0 );
2739 + }
2740 + read_buff = malloc( maxsize );
2741 + if ( !read_buff ) {
2742 + fprintf( stderr, "cannot malloc %d bytes\n", maxsize );
2743 + exit( 1 );
2744 + }
2745 + while ( fgets( name, 80, confile ) && !status ) {
2746 + cp = strchr( name, '\n' );
2747 + if ( cp ) *cp = '\0';
2748 + if ( strchr( name, '=' ) ) continue; /* a parameter */
2749 + if ( !( cp = strchr( name, '.' ) ) ) continue;
2750 + cp++;
2751 + if ( !strcmp ( cp, "dic" ) ) {
2752 + status = loaddict ( name, "primary", PRIMARY_DIC );
2753 + } else if ( !strcmp ( cp, "dtu" ) ) {
2754 + status = loaddict ( name, "user", USER_DIC );
2755 + } else if ( !strcmp ( cp, "dta" ) ) {
2756 + status = loaddict ( name, "abbreviation file", ABBREV_DIC );
2757 + } else if ( !strcmp ( cp, "exe" ) ) {
2758 + status = loadexe ( name );
2759 + } else if ( !strcmp ( cp, "sys" ) ) {
2760 + status = loadkernel ( name );
2761 + }
2762 + }
2763 + if ( status ) fprintf( stderr, "status %d\n", status );
2764 + fclose( confile );
2765 + if ( status ) exit( status );
2766 + dt_sendbuff( init_msg, strlen( init_msg ) );
2767 + sleep( 1 );
2768 + if ( intest ) do_test( );
2769 + exit( 0 );
2770 +}
2771 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/dtload.h linux-2.6.19-spk/drivers/char/speakup/dtload.h
2772 --- linux-2.6.19/drivers/char/speakup/dtload.h 1969-12-31 19:00:00.000000000 -0500
2773 +++ linux-2.6.19-spk/drivers/char/speakup/dtload.h 2006-12-01 18:28:14.000000000 -0500
2774 @@ -0,0 +1,57 @@
2775 +/*
2776 + * This is the DECtalk PC firmware loader for the Linux kernel, version 1.0
2777 + *
2778 + * Original 386BSD source:
2779 + * Copyright (c) 1996 Brian Buhrow <buhrow@lothlorien.nfbcal.org>
2780 + *
2781 + * Adapted for Linux:
2782 + * Copyright (c) 1997 Nicolas Pitre <nico@cam.org>
2783 + *
2784 + * Adapted for speakup:
2785 + * Copyright (c) 2003 David Borowski <david575@golden.net>
2786 + *
2787 + * All rights reserved.
2788 + *
2789 + * This program is free software; you can redistribute it and/or modify
2790 + * it under the terms of the GNU General Public License as published by
2791 + * the Free Software Foundation; either version 2 of the License, or
2792 + * (at your option) any later version.
2793 + *
2794 + * This program is distributed in the hope that it will be useful,
2795 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2796 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2797 + * GNU General Public License for more details.
2798 + *
2799 + * You should have received a copy of the GNU General Public License
2800 + * along with this program; if not, write to the Free Software
2801 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2802 + *
2803 + */
2804 +
2805 +#define MAX_FIXUPS 512 /* maximum fixups per exe */
2806 +/*
2807 + * msdos .exe files will look like ...
2808 + */
2809 +
2810 +struct dos_exe_header {
2811 + unsigned short id; /* Linker's signature, must be 0x5a4d */
2812 + unsigned short rem; /* length of image mod 512 */
2813 + unsigned short pages; /* length of image in pages of 512 bytes */
2814 + unsigned short relen; /* number of relocation items */
2815 + unsigned short hsize; /* header size in paragraphs of 16 bytes */
2816 + unsigned short hmin; /* min # of paragraphs above prog end */
2817 + unsigned short hmax;
2818 + unsigned short ssval;
2819 + unsigned short spval; /* to be loaded in sp */
2820 + unsigned short checksum;
2821 + unsigned short ipval; /* to be loaded in ip */
2822 + unsigned short csval; /* segment offset to code */
2823 + unsigned short reloc; /* location of relocation items */
2824 + unsigned short ovrlay; /* overlay number */
2825 +};
2826 +
2827 +/* a dos relocation element looks like */
2828 +
2829 +struct dos_reloc {
2830 + short int offset, segment;
2831 +};
2832 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/dtpc_reg.h linux-2.6.19-spk/drivers/char/speakup/dtpc_reg.h
2833 --- linux-2.6.19/drivers/char/speakup/dtpc_reg.h 1969-12-31 19:00:00.000000000 -0500
2834 +++ linux-2.6.19-spk/drivers/char/speakup/dtpc_reg.h 2006-12-01 18:28:14.000000000 -0500
2835 @@ -0,0 +1,132 @@
2836 +/*
2837 + * This is the DECtalk PC register constants (from DEC's DOS driver)
2838 + *
2839 + * Original code:
2840 + * Copyright (c) by Digital Equipment Corp.
2841 + *
2842 + * 386BSD DECtalk PC driver:
2843 + * Copyright (c) 1996 Brian Buhrow <buhrow@lothlorien.nfbcal.org>
2844 + *
2845 + * Linux DECtalk PC driver:
2846 + * Copyright (c) 1997 Nicolas Pitre <nico@cam.org>
2847 + *
2848 + * speakup DECtalk PC driver:
2849 + * Copyright (c) 2003 David Borowski <david575@golden.net>
2850 + *
2851 + * All rights reserved.
2852 + *
2853 + * This program is free software; you can redistribute it and/or modify
2854 + * it under the terms of the GNU General Public License as published by
2855 + * the Free Software Foundation; either version 2 of the License, or
2856 + * (at your option) any later version.
2857 + *
2858 + * This program is distributed in the hope that it will be useful,
2859 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2860 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2861 + * GNU General Public License for more details.
2862 + *
2863 + * You should have received a copy of the GNU General Public License
2864 + * along with this program; if not, write to the Free Software
2865 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2866 + *
2867 + */
2868 +
2869 +/*
2870 + * port interface defs ... used by dtpc.c
2871 + */
2872 +
2873 +#define MODULE_init 0x0dec /* module in boot code */
2874 +#define MODULE_self_test 0x8800 /* module in self-test */
2875 +#define MODULE_reset 0xffff /* reinit the whole module */
2876 +
2877 +#define MODE_mask 0xf000 /* mode bits in high nibble */
2878 +#define MODE_null 0x0000
2879 +#define MODE_test 0x2000 /* in testing mode */
2880 +#define MODE_status 0x8000
2881 +#define STAT_int 0x0001 /* running in interrupt mode */
2882 +#define STAT_tr_char 0x0002 /* character data to transmit */
2883 +#define STAT_rr_char 0x0004 /* ready to receive char data */
2884 +#define STAT_cmd_ready 0x0008 /* ready to accept commands */
2885 +#define STAT_dma_ready 0x0010 /* dma command ready */
2886 +#define STAT_digitized 0x0020 /* spc in digitized mode */
2887 +#define STAT_new_index 0x0040 /* new last index ready */
2888 +#define STAT_new_status 0x0080 /* new status posted */
2889 +#define STAT_dma_state 0x0100 /* dma state toggle */
2890 +#define STAT_index_valid 0x0200 /* indexs are valid */
2891 +#define STAT_flushing 0x0400 /* flush in progress */
2892 +#define STAT_self_test 0x0800 /* module in self test */
2893 +#define MODE_ready 0xc000 /* module ready for next phase */
2894 +#define READY_boot 0x0000
2895 +#define READY_kernel 0x0001
2896 +#define MODE_error 0xf000
2897 +
2898 +#define CMD_mask 0xf000 /* mask for command nibble */
2899 +#define CMD_null 0x0000 /* post status */
2900 +#define CMD_control 0x1000 /* hard control command */
2901 +#define CTRL_mask 0x0F00 /* mask off control nibble */
2902 +#define CTRL_data 0x00FF /* madk to get data byte */
2903 +#define CTRL_null 0x0000 /* null control */
2904 +#define CTRL_vol_up 0x0100 /* increase volume */
2905 +#define CTRL_vol_down 0x0200 /* decrease volume */
2906 +#define CTRL_vol_set 0x0300 /* set volume */
2907 +#define CTRL_pause 0x0400 /* pause spc */
2908 +#define CTRL_resume 0x0500 /* resume spc clock */
2909 +#define CTRL_resume_spc 0x0001 /* resume spc soft pause */
2910 +#define CTRL_flush 0x0600 /* flush all buffers */
2911 +#define CTRL_int_enable 0x0700 /* enable status change ints */
2912 +#define CTRL_buff_free 0x0800 /* buffer remain count */
2913 +#define CTRL_buff_used 0x0900 /* buffer in use */
2914 +#define CTRL_speech 0x0a00 /* immediate speech change */
2915 +#define CTRL_SP_voice 0x0001 /* voice change */
2916 +#define CTRL_SP_rate 0x0002 /* rate change */
2917 +#define CTRL_SP_comma 0x0003 /* comma pause change */
2918 +#define CTRL_SP_period 0x0004 /* period pause change */
2919 +#define CTRL_SP_rate_delta 0x0005 /* delta rate change */
2920 +#define CTRL_SP_get_param 0x0006 /* return the desired parameter */
2921 +#define CTRL_last_index 0x0b00 /* get last index spoken */
2922 +#define CTRL_io_priority 0x0c00 /* change i/o priority */
2923 +#define CTRL_free_mem 0x0d00 /* get free paragraphs on module */
2924 +#define CTRL_get_lang 0x0e00 /* return bit mask of loaded languages */
2925 +#define CMD_test 0x2000 /* self-test request */
2926 +#define TEST_mask 0x0F00 /* isolate test field */
2927 +#define TEST_null 0x0000 /* no test requested */
2928 +#define TEST_isa_int 0x0100 /* assert isa irq */
2929 +#define TEST_echo 0x0200 /* make data in == data out */
2930 +#define TEST_seg 0x0300 /* set peek/poke segment */
2931 +#define TEST_off 0x0400 /* set peek/poke offset */
2932 +#define TEST_peek 0x0500 /* data out == *peek */
2933 +#define TEST_poke 0x0600 /* *peek == data in */
2934 +#define TEST_sub_code 0x00FF /* user defined test sub codes */
2935 +#define CMD_id 0x3000 /* return software id */
2936 +#define ID_null 0x0000 /* null id */
2937 +#define ID_kernel 0x0100 /* kernel code executing */
2938 +#define ID_boot 0x0200 /* boot code executing */
2939 +#define CMD_dma 0x4000 /* force a dma start */
2940 +#define CMD_reset 0x5000 /* reset module status */
2941 +#define CMD_sync 0x6000 /* kernel sync command */
2942 +#define CMD_char_in 0x7000 /* single character send */
2943 +#define CMD_char_out 0x8000 /* single character get */
2944 +#define CHAR_count_1 0x0100 /* one char in cmd_low */
2945 +#define CHAR_count_2 0x0200 /* the second in data_low */
2946 +#define CHAR_count_3 0x0300 /* the third in data_high */
2947 +#define CMD_spc_mode 0x9000 /* change spc mode */
2948 +#define CMD_spc_to_text 0x0100 /* set to text mode */
2949 +#define CMD_spc_to_digit 0x0200 /* set to digital mode */
2950 +#define CMD_spc_rate 0x0400 /* change spc data rate */
2951 +#define CMD_error 0xf000 /* severe error */
2952 +
2953 +enum { PRIMARY_DIC = 0, USER_DIC, COMMAND_DIC, ABBREV_DIC };
2954 +
2955 +#define DMA_single_in 0x01
2956 +#define DMA_single_out 0x02
2957 +#define DMA_buff_in 0x03
2958 +#define DMA_buff_out 0x04
2959 +#define DMA_control 0x05
2960 +#define DT_MEM_ALLOC 0x03
2961 +#define DT_SET_DIC 0x04
2962 +#define DT_START_TASK 0x05
2963 +#define DT_LOAD_MEM 0x06
2964 +#define DT_READ_MEM 0x07
2965 +#define DT_DIGITAL_IN 0x08
2966 +#define DMA_sync 0x06
2967 +#define DMA_sync_char 0x07
2968 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/genmap.c linux-2.6.19-spk/drivers/char/speakup/genmap.c
2969 --- linux-2.6.19/drivers/char/speakup/genmap.c 1969-12-31 19:00:00.000000000 -0500
2970 +++ linux-2.6.19-spk/drivers/char/speakup/genmap.c 2006-12-01 18:28:14.000000000 -0500
2971 @@ -0,0 +1,204 @@
2972 +#include <stdlib.h>
2973 +#include <stdio.h>
2974 +#include <libgen.h>
2975 +#include <string.h>
2976 +#include <linux/version.h>
2977 +#include <ctype.h>
2978 +
2979 +int get_define(void);
2980 +
2981 +#define MAXKEYS 512
2982 +#define MAXKEYVAL 160
2983 +#define HASHSIZE 101
2984 +#define is_shift -3
2985 +#define is_spk -2
2986 +#define is_input -1
2987 +typedef struct st_key_init t_key_init;
2988 +struct st_key_init {
2989 + char *name;
2990 + int value, shift;
2991 +};
2992 +typedef struct st_key t_key;
2993 +struct st_key {
2994 + char *name;
2995 + t_key *next;
2996 + int value, shift;
2997 +};
2998 +unsigned char key_data[MAXKEYVAL][16], *kp;
2999 +
3000 +#include "mapdata.h"
3001 +t_key key_table[MAXKEYS];
3002 +t_key *extra_keys = key_table+HASHSIZE;
3003 +char buffer[256], filename[256];
3004 +FILE *infile;
3005 +char delims[] = "\t\n ";
3006 +char *def_name, *def_val, *cp;
3007 +int map_ver = 119; /* an arbitrary number so speakup can check */
3008 +int lc, shift_table[17];
3009 +int max_states = 1, flags = 0;
3010 +/* flags reserved for later, maybe for individual console maps */
3011 +
3012 +void open_input( char *name )
3013 +{
3014 + strcpy( filename, name );
3015 + if ( ( infile = fopen( filename, "r" ) ) == 0 ) {
3016 + fprintf( stderr, "can't open %s, version %d\n", filename, LINUX_VERSION_CODE );
3017 + exit( 1 );
3018 + }
3019 + lc = 0;
3020 +}
3021 +
3022 +int
3023 +oops( char *msg, char *info )
3024 +{
3025 + if ( info == NULL ) info = " ";
3026 + fprintf( stderr, "error: file %s line %d\n", filename, lc );
3027 + fprintf( stderr, "%s %s\n", msg, info );
3028 + exit( 1 );
3029 +}
3030 +
3031 +t_key *hash_name( char *name )
3032 +{
3033 + u_char *pn = (u_char *)name;
3034 + int hash = 0;
3035 + while ( *pn ) {
3036 + hash = ( hash * 17 ) & 0xfffffff;
3037 + if ( isupper( *pn ) ) *pn = tolower( *pn );
3038 + hash += ( int )*pn;
3039 + pn++;
3040 + }
3041 + hash %= HASHSIZE;
3042 + return &key_table[hash];
3043 +}
3044 +
3045 +t_key *find_key( char *name )
3046 +{
3047 + t_key *this = hash_name( name );
3048 + while ( this ) {
3049 + if ( !strcmp( name, this->name ) ) return this;
3050 + this = this->next;
3051 + }
3052 + return this;
3053 +}
3054 +
3055 +t_key *add_key( char *name, int value, int shift )
3056 +{
3057 + t_key *this = hash_name( name );
3058 + if ( extra_keys-key_table >= MAXKEYS )
3059 + oops( "out of key table space, enlarge MAXKEYS", NULL );
3060 + if ( this->name != NULL ) {
3061 + while ( this->next ) {
3062 + if ( !strcmp( name, this->name ) )
3063 + oops( "attempt to add duplicate key", name );
3064 + this = this->next;
3065 + }
3066 + this->next = extra_keys++;
3067 + this = this->next;
3068 + }
3069 + this->name = strdup( name );
3070 + this->value = value;
3071 + this->shift = shift;
3072 + return this;
3073 +}
3074 +
3075 +int get_shift_value( int state )
3076 +{
3077 + int i;
3078 + for ( i = 0; shift_table[i] != state; i++ ) {
3079 + if ( shift_table[i] == -1 ) {
3080 + if ( i >= 16 )
3081 + oops( "too many shift states", NULL );
3082 + shift_table[i] = state;
3083 + max_states = i+1;
3084 + break;
3085 + }
3086 + }
3087 + return i;
3088 +}
3089 +
3090 +int
3091 +main( int argc, char *argv[] )
3092 +{
3093 + int value, shift_state, i, spk_val = 0, lock_val = 0;
3094 + int max_key_used = 0, num_keys_used = 0;
3095 + t_key *this;
3096 + t_key_init *p_init;
3097 +char *argpath, *argname, *argcopy;
3098 +
3099 + bzero( key_table, sizeof( key_table ) );
3100 + bzero( key_data, sizeof( key_data ) );
3101 + shift_table[0] = 0;
3102 + for ( i = 1; i <= 16; i++ ) shift_table[i] = -1;
3103 + if ( argc < 2 ) {
3104 + fputs( "usage: genmap filename\n", stderr );
3105 + exit( 1 );
3106 + }
3107 + for ( p_init = init_key_data; p_init->name[0] != '.'; p_init++ )
3108 + add_key( p_init->name, p_init->value, p_init->shift );
3109 + open_input( argv[1] );
3110 + while ( fgets( buffer, 250, infile ) ) {
3111 + lc++;
3112 + value = shift_state = 0;
3113 + cp = strtok( buffer, delims );
3114 + if ( *cp == '#' ) continue;
3115 + while ( cp ) {
3116 + if ( *cp == '=' ) break;
3117 + this = find_key( cp );
3118 + if ( this == NULL )
3119 + oops( "unknown key/modifier", cp );
3120 + if ( this->shift == is_shift ) {
3121 + if ( value )
3122 + oops( "modifiers must come first", cp );
3123 + shift_state += this->value;
3124 + } else if ( this->shift == is_input )
3125 + value = this->value;
3126 + else oops( "bad modifier or key", cp );
3127 + cp = strtok( 0, delims );
3128 + }
3129 + if ( !cp ) oops( "no = found", NULL );
3130 + cp = strtok( 0, delims );
3131 + if ( !cp ) oops( "no speakup function after =", NULL );
3132 + this = find_key( cp );
3133 + if ( this == NULL || this->shift != is_spk )
3134 + oops( "invalid speakup function", cp );
3135 + i = get_shift_value( shift_state );
3136 + if ( key_data[value][i] ) {
3137 + while ( --cp > buffer )
3138 + if ( !*cp ) *cp = ' ';
3139 + oops( "two functions on same key combination", cp );
3140 + }
3141 + key_data[value][i] = (char)this->value;
3142 + if ( value > max_key_used ) max_key_used = value;
3143 + }
3144 + fclose( infile );
3145 + this = find_key( "spk_key" );
3146 + if ( this ) spk_val = this->value;
3147 + this = find_key( "spk_lock" );
3148 + if ( this ) lock_val = this->value;
3149 + for ( lc = 1; lc <= max_key_used; lc++ ) {
3150 + kp = key_data[lc];
3151 + if ( !memcmp( key_data[0], kp, 16 ) ) continue;
3152 + num_keys_used++;
3153 + for ( i = 0; i < max_states; i++ ) {
3154 + if ( kp[i] != spk_val&& kp[i] != lock_val ) continue;
3155 + shift_state = shift_table[i];
3156 + if ( ( shift_state&16 ) ) continue;
3157 + shift_state = get_shift_value( shift_state+16 );
3158 + kp[shift_state] = kp[i];
3159 +/* fill in so we can process the key up, as spk bit will be set */
3160 + }
3161 + }
3162 + printf( "\t%d, %d, %d,\n\t", map_ver, num_keys_used, max_states );
3163 + for ( i = 0; i < max_states; i++ )
3164 + printf( "%d, ", shift_table[i] );
3165 + printf( "%d,", flags );
3166 + for ( lc = 1; lc <= max_key_used; lc++ ) {
3167 + kp = key_data[lc];
3168 + if ( !memcmp( key_data[0], kp, 16 ) ) continue;
3169 + printf( "\n\t%d,", lc );
3170 + for ( i = 0; i < max_states; i++ )
3171 + printf( " %d,", (unsigned int)kp[i] );
3172 + }
3173 + printf( "\n\t0, %d\n", map_ver );
3174 + exit( 0 );
3175 +}
3176 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/keyinfo.h linux-2.6.19-spk/drivers/char/speakup/keyinfo.h
3177 --- linux-2.6.19/drivers/char/speakup/keyinfo.h 1969-12-31 19:00:00.000000000 -0500
3178 +++ linux-2.6.19-spk/drivers/char/speakup/keyinfo.h 2006-12-01 18:28:14.000000000 -0500
3179 @@ -0,0 +1,120 @@
3180 +/* spk_priv.h
3181 + review functions for the speakup screen review package.
3182 + originally written by: Kirk Reiser and Andy Berdan.
3183 +
3184 + extensively modified by David Borowski.
3185 +
3186 + Copyright (C ) 1998 Kirk Reiser.
3187 + Copyright (C ) 2003 David Borowski.
3188 +
3189 + This program is free software; you can redistribute it and/or modify
3190 + it under the terms of the GNU General Public License as published by
3191 + the Free Software Foundation; either version 2 of the License, or
3192 + (at your option ) any later version.
3193 +
3194 + This program is distributed in the hope that it will be useful,
3195 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3196 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3197 + GNU General Public License for more details.
3198 +
3199 + You should have received a copy of the GNU General Public License
3200 + along with this program; if not, write to the Free Software
3201 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3202 +*/
3203 +
3204 +enum { /* var_ids */
3205 + VERSION = 0, SYNTH, SILENT, SYNTH_DIRECT,
3206 + KEYMAP, CHARS,
3207 + PUNC_SOME, PUNC_MOST, PUNC_ALL,
3208 + DELIM, REPEATS, EXNUMBER,
3209 + DELAY, TRIGGER, JIFFY, FULL, /* all timers must be together */
3210 + BLEEP_TIME, CURSOR_TIME, BELL_POS,
3211 +SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
3212 + SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
3213 + ATTRIB_BLEEP, BLEEPS,
3214 + RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQ, LANG,
3215 + CAPS_START, CAPS_STOP, CHARTAB,
3216 + MAXVARS
3217 +};
3218 +
3219 +#define FIRST_SYNTH_VAR RATE
3220 +/* 0 is reserved for no remap */
3221 +#define SPEAKUP_GOTO 0x01
3222 +#define SPEECH_KILL 0x02
3223 +#define SPEAKUP_QUIET 0x03
3224 +#define SPEAKUP_CUT 0x04
3225 +#define SPEAKUP_PASTE 0x05
3226 +#define SAY_FIRST_CHAR 0x06
3227 +#define SAY_LAST_CHAR 0x07
3228 +#define SAY_CHAR 0x08
3229 +#define SAY_PREV_CHAR 0x09
3230 +#define SAY_NEXT_CHAR 0x0a
3231 +#define SAY_WORD 0x0b
3232 +#define SAY_PREV_WORD 0x0c
3233 +#define SAY_NEXT_WORD 0x0d
3234 +#define SAY_LINE 0x0e
3235 +#define SAY_PREV_LINE 0x0f
3236 +#define SAY_NEXT_LINE 0x10
3237 +#define TOP_EDGE 0x11
3238 +#define BOTTOM_EDGE 0x12
3239 +#define LEFT_EDGE 0x13
3240 +#define RIGHT_EDGE 0x14
3241 +#define SPELL_PHONETIC 0x15
3242 +#define SPELL_WORD 0x16
3243 +#define SAY_SCREEN 0x17
3244 +#define SAY_POSITION 0x18
3245 +#define SAY_ATTRIBUTES 0x19
3246 +#define SPEAKUP_OFF 0x1a
3247 +#define SPEAKUP_PARKED 0x1b
3248 +#define SAY_LINE_INDENT 0x1c
3249 +#define SAY_FROM_TOP 0x1d
3250 +#define SAY_TO_BOTTOM 0x1e
3251 +#define SAY_FROM_LEFT 0x1f
3252 +#define SAY_TO_RIGHT 0x20
3253 +#define SAY_CHAR_NUM 0x21
3254 +#define EDIT_SOME 0x22
3255 +#define EDIT_MOST 0x23
3256 +#define SAY_PHONETIC_CHAR 0x24
3257 +#define EDIT_DELIM 0x25
3258 +#define EDIT_REPEAT 0x26
3259 +#define EDIT_EXNUM 0x27
3260 +#define SET_WIN 0x28
3261 +#define CLEAR_WIN 0x29
3262 +#define ENABLE_WIN 0x2a
3263 +#define SAY_WIN 0x2b
3264 +#define SPK_LOCK 0x2c
3265 +#define SPEAKUP_HELP 0x2d
3266 +#define TOGGLE_CURSORING 0x2e
3267 +#define READ_ALL_DOC 0x2f
3268 +#define SPKUP_MAX_FUNC 0x30 /* one greater than the last func handler */
3269 +
3270 +#define SPK_KEY 0x80
3271 +#define FIRST_EDIT_BITS 0x22
3272 +
3273 +#define FIRST_SET_VAR SPELL_DELAY
3274 +#define VAR_START 0x40 /* increase if adding more than 0x3f functions */
3275 +
3276 +/* keys for setting variables, must be ordered same as the enum for var_ids */
3277 +/* with dec being even and inc being 1 greater */
3278 +#define SPELL_DELAY_DEC VAR_START+0
3279 +#define SPELL_DELAY_INC SPELL_DELAY_DEC+1
3280 +#define PUNC_LEVEL_DEC SPELL_DELAY_DEC+2
3281 +#define PUNC_LEVEL_INC PUNC_LEVEL_DEC+1
3282 +#define READING_PUNC_DEC PUNC_LEVEL_DEC+2
3283 +#define READING_PUNC_INC READING_PUNC_DEC+1
3284 +#define ATTRIB_BLEEP_DEC READING_PUNC_DEC+2
3285 +#define ATTRIB_BLEEP_INC ATTRIB_BLEEP_DEC+1
3286 +#define BLEEPS_DEC ATTRIB_BLEEP_DEC+2
3287 +#define BLEEPS_INC BLEEPS_DEC+1
3288 +#define RATE_DEC BLEEPS_DEC+2
3289 +#define RATE_INC RATE_DEC+1
3290 +#define PITCH_DEC RATE_DEC+2
3291 +#define PITCH_INC PITCH_DEC+1
3292 +#define VOL_DEC PITCH_DEC+2
3293 +#define VOL_INC VOL_DEC+1
3294 +#define TONE_DEC VOL_DEC+2
3295 +#define TONE_INC TONE_DEC+1
3296 +#define PUNCT_DEC TONE_DEC+2
3297 +#define PUNCT_INC PUNCT_DEC+1
3298 +#define VOICE_DEC PUNCT_DEC+2
3299 +#define VOICE_INC VOICE_DEC+1
3300 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/makemapdata.c linux-2.6.19-spk/drivers/char/speakup/makemapdata.c
3301 --- linux-2.6.19/drivers/char/speakup/makemapdata.c 1969-12-31 19:00:00.000000000 -0500
3302 +++ linux-2.6.19-spk/drivers/char/speakup/makemapdata.c 2006-12-01 18:28:14.000000000 -0500
3303 @@ -0,0 +1,156 @@
3304 +#include <stdlib.h>
3305 +#include <stdio.h>
3306 +#include <libgen.h>
3307 +#include <string.h>
3308 +#include <linux/version.h>
3309 +#include <ctype.h>
3310 +
3311 +int get_define(void);
3312 +
3313 +#define MAXKEYS 512
3314 +#define MAXKEYVAL 160
3315 +#define HASHSIZE 101
3316 +#define is_shift -3
3317 +#define is_spk -2
3318 +#define is_input -1
3319 +typedef struct st_key t_key;
3320 +struct st_key {
3321 + char *name;
3322 + t_key *next;
3323 + int value, shift;
3324 +};
3325 +
3326 +t_key key_table[MAXKEYS];
3327 +t_key *extra_keys = key_table+HASHSIZE;
3328 +char buffer[256], filename[256];
3329 +FILE *infile;
3330 +char delims[] = "\t\n ";
3331 +char *dir_name, *def_name, *def_val, *cp;
3332 +int lc;
3333 +
3334 +void open_input( char *name )
3335 +{
3336 + sprintf( filename, "%s/%s", dir_name, name );
3337 + if ( ( infile = fopen( filename, "r" ) ) == 0 ) {
3338 + fprintf( stderr, "can't open %s\n", filename );
3339 + exit( 1 );
3340 + }
3341 + lc = 0;
3342 +}
3343 +
3344 +int
3345 +oops( char *msg, char *info )
3346 +{
3347 + if ( info == NULL ) info = " ";
3348 + fprintf( stderr, "error: file %s line %d\n", filename, lc );
3349 + fprintf( stderr, "%s %s\n", msg, info );
3350 + exit( 1 );
3351 +}
3352 +
3353 +int get_define( )
3354 +{
3355 + while ( fgets( buffer, 250, infile ) ) {
3356 + lc++;
3357 + if ( strncmp( buffer, "#define", 7 ) ) continue;
3358 + strtok( buffer, delims );
3359 + def_name = strtok( 0, delims );
3360 + def_val = strtok( 0, delims );
3361 + if ( def_val != NULL ) return 1;
3362 + }
3363 + fclose( infile );
3364 + infile = 0;
3365 + return 0;
3366 +}
3367 +
3368 +t_key *hash_name( char *name )
3369 +{
3370 + u_char *pn = (u_char *)name;
3371 + int hash = 0;
3372 + while ( *pn ) {
3373 + hash = ( hash * 17 ) & 0xfffffff;
3374 + if ( isupper( *pn ) ) *pn = tolower( *pn );
3375 + hash += ( int )*pn;
3376 + pn++;
3377 + }
3378 + hash %= HASHSIZE;
3379 + return &key_table[hash];
3380 +}
3381 +
3382 +t_key *find_key( char *name )
3383 +{
3384 + t_key *this = hash_name( name );
3385 + while ( this ) {
3386 + if ( !strcmp( name, this->name ) ) return this;
3387 + this = this->next;
3388 + }
3389 + return this;
3390 +}
3391 +
3392 +t_key *add_key( char *name, int value, int shift )
3393 +{
3394 + t_key *this = hash_name( name );
3395 + if ( extra_keys-key_table >= MAXKEYS )
3396 + oops( "out of key table space, enlarge MAXKEYS", NULL );
3397 + if ( this->name != NULL ) {
3398 + while ( this->next ) {
3399 + if ( !strcmp( name, this->name ) )
3400 + oops( "attempt to add duplicate key", name );
3401 + this = this->next;
3402 + }
3403 + this->next = extra_keys++;
3404 + this = this->next;
3405 + }
3406 + this->name = strdup( name );
3407 + this->value = value;
3408 + this->shift = shift;
3409 + return this;
3410 +}
3411 +
3412 +int
3413 +main( int argc, char *argv[] )
3414 +{
3415 + int value, i;
3416 + t_key *this;
3417 + dir_name = getenv( "TOPDIR" );
3418 + if ( !dir_name ) dir_name = "/usr/src/linux";
3419 + bzero( key_table, sizeof( key_table ) );
3420 + add_key( "shift", 1, is_shift );
3421 + add_key( "altgr", 2, is_shift );
3422 + add_key( "ctrl", 4, is_shift );
3423 + add_key( "alt", 8, is_shift );
3424 + add_key( "spk", 16, is_shift );
3425 + add_key( "double", 32, is_shift );
3426 + open_input( "include/linux/input.h" );
3427 + while ( get_define( ) ) {
3428 + if ( strncmp( def_name, "KEY_", 4 ) ) continue;
3429 + value = atoi( def_val );
3430 + if ( value > 0 && value < MAXKEYVAL )
3431 + add_key( def_name, value, is_input );
3432 + }
3433 + open_input( "drivers/char/speakup/keyinfo.h" );
3434 + while ( get_define( ) ) {
3435 + if ( strlen( def_val ) > 5 ) {
3436 + if ( !( cp = strchr( def_val, '+' ) ) ) continue;
3437 + *cp++ = '\0';
3438 + this = find_key( def_val );
3439 + if ( !this || *cp < '0' || *cp > '9' ) continue;
3440 + value = this->value+atoi( cp );
3441 + } else if ( !strncmp( def_val, "0x", 2 ) )
3442 + sscanf( def_val+2, "%x", &value );
3443 + else if ( *def_val >= '0' && *def_val <= '9' )
3444 + value = atoi( def_val );
3445 + else continue;
3446 + add_key( def_name, value, is_spk );
3447 + }
3448 + printf( "t_key_init init_key_data[] = {\n" );
3449 + for ( i = 0; i < HASHSIZE; i++ ) {
3450 + this = &key_table[i];
3451 + if ( !this->name ) continue;
3452 + do {
3453 + printf( "\t\"%s\", %d, %d,\n", this->name, this->value, this->shift );
3454 + this = this->next;
3455 + } while ( this );
3456 + }
3457 + printf( "\t\".\", 0, 0\n};\n" );
3458 + exit( 0 );
3459 +}
3460 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/mod_code.c linux-2.6.19-spk/drivers/char/speakup/mod_code.c
3461 --- linux-2.6.19/drivers/char/speakup/mod_code.c 1969-12-31 19:00:00.000000000 -0500
3462 +++ linux-2.6.19-spk/drivers/char/speakup/mod_code.c 2006-12-01 18:28:14.000000000 -0500
3463 @@ -0,0 +1,22 @@
3464 +/* this code is to modularize a synth specific file, included at the end */
3465 +
3466 +static void __exit mod_synth_exit( void )
3467 +{
3468 + if ( synth == &MY_SYNTH )
3469 + synth_release( );
3470 + synth_remove( &MY_SYNTH );
3471 +}
3472 +
3473 +static int __init mod_synth_init( void )
3474 +{
3475 + int status = do_synth_init( &MY_SYNTH );
3476 + if ( status != 0 ) return status;
3477 + synth_add( &MY_SYNTH );
3478 + return 0;
3479 +}
3480 +
3481 +module_init( mod_synth_init );
3482 +module_exit( mod_synth_exit );
3483 +MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
3484 +MODULE_DESCRIPTION("Synthesizer driver module for speakup for the synth->long_name");
3485 +MODULE_LICENSE( "GPL" );
3486 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/serialio.h linux-2.6.19-spk/drivers/char/speakup/serialio.h
3487 --- linux-2.6.19/drivers/char/speakup/serialio.h 1969-12-31 19:00:00.000000000 -0500
3488 +++ linux-2.6.19-spk/drivers/char/speakup/serialio.h 2006-12-01 18:28:14.000000000 -0500
3489 @@ -0,0 +1,18 @@
3490 +#ifndef SSPK_SERIAL
3491 +#define SSPK_SERIAL
3492 +
3493 +#include <linux/serial.h> /* for rs_table, serial constants &
3494 + serial_uart_config */
3495 +#include <linux/serial_reg.h> /* for more serial constants */
3496 +#include <linux/serialP.h> /* for struct serial_state */
3497 +#include <asm/serial.h>
3498 +
3499 +#define SPK_SERIAL_TIMEOUT 1000000 /* countdown values for serial timeouts */
3500 +#define SPK_XMITR_TIMEOUT 1000000 /* countdown values transmitter/dsr timeouts */
3501 +#define SPK_LO_TTY 0 /* check ttyS0 ... ttyS3 */
3502 +#define SPK_HI_TTY 3
3503 +#define NUM_DISABLE_TIMEOUTS 3 /* # of timeouts permitted before disable */
3504 +#define SPK_TIMEOUT 100 /* buffer timeout in ms */
3505 +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
3506 +
3507 +#endif
3508 diff --exclude='*.orig' --exclude='*.patch' -urNp linux-2.6.19/drivers/char/speakup/speakup.c linux-2.6.19-spk/drivers/char/speakup/speakup.c
3509 --- linux-2.6.19/drivers/char/speakup/speakup.c 1969-12-31 19:00:00.000000000 -0500
3510 +++ linux-2.6.19-spk/drivers/char/speakup/speakup.c 2006-12-01 18:28:14.000000000 -0500
3511 @@ -0,0 +1,2904 @@
3512 +/* speakup.c
3513 + review functions for the speakup screen review package.
3514 + originally written by: Kirk Reiser and Andy Berdan.
3515 +
3516 + extensively modified by David Borowski.
3517 +
3518 + Copyright (C ) 1998 Kirk Reiser.
3519 + Copyright (C ) 2003 David Borowski.
3520 +
3521 + This program is free software; you can redistribute it and/or modify
3522 + it under the terms of the GNU General Public License as published by
3523 + the Free Software Foundation; either version 2 of the License, or
3524 + (at your option ) any later version.
3525 +
3526 + This program is distributed in the hope that it will be useful,
3527 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3528 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3529 + GNU General Public License for more details.
3530 +
3531 + You should have received a copy of the GNU General Public License
3532 + along with this program; if not, write to the Free Software
3533 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3534 +*/
3535 +
3536 +#define __KERNEL_SYSCALLS__
3537 +
3538 +#include <linux/kernel.h>
3539 +#include <linux/version.h>
3540 +#include <linux/vt.h>
3541 +#include <linux/tty.h>
3542 +#include <linux/mm.h> /* __get_free_page( ) and friends */
3543 +#include <linux/vt_kern.h>
3544 +#include <linux/ctype.h>
3545 +#include <linux/selection.h>
3546 +#include <asm/uaccess.h> /* copy_from|to|user( ) and others */
3547 +#include <linux/unistd.h>
3548 +
3549 +#include <linux/keyboard.h> /* for KT_SHIFT */
3550 +#include <linux/kbd_kern.h> /* for vc_kbd_* and friends */
3551 +#include <linux/vt_kern.h>
3552 +#include <linux/input.h>
3553 +#include <linux/kmod.h>
3554 +#include <linux/speakup.h>
3555 +
3556 +#include "cvsversion.h"
3557 +#include "spk_priv.h"
3558 +#include <linux/bootmem.h> /* for alloc_bootmem */
3559 +
3560 +/* speakup_*_selection */
3561 +#include <linux/module.h>
3562 +#include <linux/sched.h>
3563 +#include <linux/slab.h>
3564 +#include <linux/types.h>
3565 +#include <asm/uaccess.h>
3566 +#include <linux/consolemap.h>
3567 +
3568 +#define SPEAKUP_VERSION "Speakup v-2.00" CVSVERSION
3569 +#define MAX_DELAY ( (500 * HZ ) / 1000 )
3570 +#define KEY_MAP_VER 119
3571 +#define MINECHOCHAR SPACE
3572 +
3573 +/* these are globals from the kernel code */
3574 +extern struct kbd_struct * kbd;
3575 +extern int fg_console;
3576 +extern short punc_masks[];
3577 +
3578 +static special_func special_handler = NULL;
3579 +special_func help_handler = NULL;
3580 +
3581 +int synth_file_inuse = 0;
3582 +short pitch_shift = 0, synth_flags = 0;
3583 +static char buf[256];
3584 +short attrib_bleep = 0, bleeps = 0, bleep_time = 1;
3585 +short no_intr = 0, spell_delay = 0;
3586 +short key_echo = 0, cursor_timeout = 120, say_word_ctl = 0;
3587 +short say_ctrl = 0, bell_pos = 0;
3588 +short punc_mask = 0, punc_level = 0, reading_punc = 0;
3589 +char str_caps_start[MAXVARLEN+1] = "\0", str_caps_stop[MAXVARLEN+1] = "\0";
3590 +bits_data punc_info[] = {
3591 + { "none", "", 0 },
3592 + { "some", "/$%&@", SOME },
3593 + { "most", "$%&#()=+*/@^<>|\\", MOST },
3594 + { "all", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", PUNC },
3595 + { "delimiters", "", B_WDLM },
3596 + { "repeats", "()", CH_RPT },
3597 + { "extended numeric", "", B_EXNUM },
3598 + { "symbols", "", B_SYM },
3599 + { 0, 0 }
3600 +};
3601 +char mark_cut_flag = 0;
3602 +u_short mark_x = 0, mark_y = 0;
3603 +char synth_name[10] = CONFIG_SPEAKUP_DEFAULT;
3604 +#define MAX_KEY 160
3605 +u_char *our_keys[MAX_KEY], *shift_table;
3606 +static u_char key_buf[600];
3607 +static u_char key_defaults[] = {
3608 +#include "speakupmap.h"
3609 +};
3610 +
3611 +// Speakup Cursor Track Variables
3612 +static int cursor_track = 1, prev_cursor_track=1;
3613 +/* cursor track modes, must be ordered same as cursor_msgs */
3614 +enum { CT_Off = 0, CT_On, CT_Highlight, CT_Window, CT_Max };
3615 +#define read_all_mode CT_Max
3616 +
3617 +struct tty_struct *tty;
3618 +#define key_handler k_handler
3619 +typedef void (*k_handler_fn)(struct vc_data *vc, unsigned char value,
3620 + char up_flag);
3621 +#define KBD_PROTO struct vc_data *vc, u_char value, char up_flag
3622 +#define KBD_ARGS vc, value, up_flag
3623 +extern k_handler_fn key_handler[16];
3624 +static k_handler_fn do_shift, do_spec, do_latin, do_cursor;
3625 +EXPORT_SYMBOL( help_handler );
3626 +EXPORT_SYMBOL( special_handler );
3627 +EXPORT_SYMBOL( our_keys );
3628 +EXPORT_SYMBOL(synth_name);
3629 +
3630 +static void speakup_date (struct vc_data *vc );
3631 +static void spkup_write (const char *in_buf, int count );
3632 +int set_mask_bits( const char *input, const int which, const int how );
3633 +
3634 +char str_ctl[] = "control-";
3635 +char *colors[] = {
3636 + "black", "blue", "green", "cyan", "red", "magenta", "yellow", "white",
3637 + "grey"
3638 +};
3639 +
3640 +char *phonetic[] = {
3641 + "alpha", "beta", "charley", "delta", "echo", "fox", "gamma", "hotel",
3642 + "india", "juleiet", "keelo", "leema", "mike", "november", "oscar",
3643 + "papa",
3644 + "quebec", "romeo", "seeara", "tango", "uniform", "victer", "wiskey",
3645 + "x ray", "yankee", "zooloo"
3646 +};
3647 +
3648 +// array of 256 char pointers (one for each character description )
3649 +// initialized to default_chars and user selectable via /proc/speakup/characters
3650 +char *characters[256];
3651 +
3652 +char *default_chars[256] = {
3653 + "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g",
3654 + "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o",
3655 + "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w",
3656 + "^x", "^y", "^z", NULL, NULL, NULL, NULL, NULL,
3657 + "space", "bang!", "quote", "number", "dollar", "percent", "and",
3658 + "tick",
3659 + "left paren", "right paren", "star", "plus", "comma", "dash", "dot",
3660 + "slash",
3661 + "zero", "one", "two", "three", "four", "five", "six", "seven",
3662 + "eight", "nine",
3663 + "colon", "semmy", "less", "equals", "greater", "question", "at",
3664 + "eigh", "b", "c", "d", "e", "f", "g",
3665 + "h", "i", "j", "k", "l", "m", "n", "o",
3666 + "p", "q", "r", "s", "t", "u", "v", "w", "x",
3667 + "y", "zehd", "left bracket", "backslash", "right bracket", "caret",
3668 + "line",
3669 + "accent", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3670 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3671 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3672 + NULL, NULL, NULL, "left brace", "bar", "right brace", "tihlduh",
3673 + "delta", "see cedilla", "u oomlout", "e acute", /* 128 */
3674 + "eigh circumflex", "eigh oomlout", "eigh grave", "eigh ring", /* 132 */
3675 + "see cedilla", "e circumflex", "e oomlout", "e grave", /* 136 */
3676 + "i oomlout", "i circumflex", "i grave", "eigh oomlout", /* 140 */
3677 + "eigh ring", "e acute", "eigh e dipthong", "eigh e dipthong", /* 144 */
3678 + "o circumflex", "o oomlout", "o grave", "u circumflex", /* 148 */
3679 + "u grave", "y oomlout", "o oomlout", "u oomlout", /* 152 */
3680 + "cents", "pounds", "yen", "peseta", /* 156 */
3681 + "florin", "eigh acute", "i acute", "o acute", /* 160 */
3682 + "u acute", "n tilde", "n tilde", "feminine ordinal", /* 164 */
3683 + "masculin ordinal", "inverted question", "reversed not", "not", /* 168 */
3684 + "half", "quarter", "inverted bang", "much less than", /* 172 */
3685 + "much greater than", "dark shading", "medium shading", /* 176 */
3686 + "light shading", "verticle line", "left tee", /* 179 */
3687 + "double left tee", "left double tee", "double top right", /* 182 */
3688 + "top double right", "double left double tee", /* 185 */
3689 + "double vertical line", "double top double right", /* 187 */
3690 + "double bottom double right", "double bottom right", /* 189 */
3691 + "bottom double right", "top right", "left bottom", /* 191 */
3692 + "up tee", "tee down", "tee right", "horizontal line", /* 194 */
3693 + "cross bars", "tee double right", "double tee right", /* 198 */
3694 + "double left double bottom", "double left double top", /* 201 */
3695 + "double up double tee", "double tee double down", /* 203 */
3696 + "double tee double right", "double horizontal line", /* 205 */
3697 + "double cross bars", "up double tee", "double up tee", /* 207 */
3698 + "double tee down", "tee double down", /* 210 */
3699 + "double left bottom", "left double bottom", /* 212 */
3700 + "double left top", "left double top", /* 214 */
3701 + "double vertical cross", "double horizontal cross", /* 216 */
3702 + "bottom right", "left top", "solid square", /* 218 */
3703 + "solid lower half", "solid left half", "solid right half", /* 221 */
3704 + "solid upper half", "alpha", "beta", "gamma", /* 224 */
3705 + "pie", "sigma", "sigma", "mu", /* 228 */
3706 + "tou", "phigh", "thayta", "ohmega", /* 232 */
3707 + "delta", "infinity", "phigh", "epsilaun", /* 236 */
3708 +"intersection", "identical to", "plus or minus", "equal grater than", /* 240 */
3709 + "less than equal", "upper integral", "lower integral", /* 244 */
3710 + "divided by", "almost equal", "degrees", /* 247 */
3711 + "centre dot", "bullet", "square root", /* 250 */
3712 + "power", "squared", "black square", "white space" /* 252 */
3713 +};
3714 +
3715 +// array of 256 u_short (one for each character)
3716 +// initialized to default_chartab and user selectable via /proc/speakup/chartab
3717 +u_short spk_chartab[256];
3718 +
3719 +u_short default_chartab[256] = {
3720 + B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 0-7 */
3721 + B_CTL, B_CTL, A_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 8-15 */
3722 + B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /*16-23 */
3723 + B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 24-31 */
3724 +WDLM, A_PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* !"#$%&' */
3725 +PUNC, PUNC, PUNC, PUNC, A_PUNC, A_PUNC, A_PUNC, PUNC, /* ( )*+, -./ */
3726 +NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, /* 01234567 */
3727 +NUM, NUM, A_PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* 89:;<=>? */
3728 +PUNC, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* @ABCDEFG */
3729 +A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* HIJKLMNO */
3730 +A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* PQRSTUVW */
3731 +A_CAP, A_CAP, A_CAP, PUNC, PUNC, PUNC, PUNC, PUNC, /* XYZ[\]^_ */
3732 +PUNC, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* `abcdefg */
3733 +ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* hijklmno */
3734 +ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* pqrstuvw */
3735 +ALPHA, ALPHA, ALPHA, PUNC, PUNC, PUNC, PUNC, 0, /* xyz{|}~ */
3736 +B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-135 */
3737 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 136-143 */
3738 +B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 144-151 */
3739 +B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 152-159 */
3740 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, /* 160-167 */
3741 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 168-175 */
3742 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 176-183 */
3743 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 184-191 */
3744 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 192-199 */
3745 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 200-207 */
3746 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 208-215 */
3747 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 216-223 */
3748 +B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, /* 224-231 */
3749 +B_SYM, B_CAPSYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 232-239 */
3750 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 240-247 */
3751 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM /* 248-255 */
3752 +};
3753 +
3754 +int spk_keydown = 0;
3755 +static u_char spk_lastkey = 0, spk_close_press = 0, keymap_flags = 0;
3756 +static u_char last_keycode = 0, this_speakup_key = 0;
3757 +static u_long last_spk_jiffy = 0;
3758 +
3759 +spk_t *speakup_console[MAX_NR_CONSOLES];
3760 +
3761 +int spk_setup (char *str )
3762 +{
3763 + int ints[4];
3764 + str = get_options (str, ARRAY_SIZE (ints ), ints );
3765 + if (ints[0] > 0 && ints[1] >= 0 )
3766 + synth_port_forced = ints[1];
3767 + return 1;
3768 +}
3769 +
3770 +int spk_ser_setup (char *str )
3771 +{
3772 + int lookup[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
3773 + int ints[4];
3774 + str = get_options (str, ARRAY_SIZE (ints ), ints );
3775 + if (ints[0] > 0 && ints[1] >= 0 )
3776 + synth_port_forced = lookup[ints[1]];
3777 + return 1;
3778 +}
3779 +
3780 +int spk_synth_setup (char *str )
3781 +{
3782 + size_t len = min_t (size_t, strlen (str ), 9 );
3783 + memcpy (synth_name, str, len );
3784 + synth_name[len] = '\0';
3785 + return 1;
3786 +}
3787 +
3788 +int spk_quiet_setup (char *str )
3789 +{
3790 + if (strchr( "1yt", *str) != NULL) quiet_boot = 1;
3791 + return 1;
3792 +}
3793 +
3794 +__setup ("speakup_port=", spk_setup );
3795 +__setup ("speakup_ser=", spk_ser_setup );
3796 +__setup ("speakup_synth=", spk_synth_setup );
3797 +__setup ("speakup_quiet=", spk_quiet_setup );
3798 +
3799 +char *
3800 +strlwr (char *s )
3801 +{
3802 + char *p;
3803 + for (p = s; *p; p++ ) {
3804 + if (*p >= CAP_A && *p <= CAP_Z ) *p |= 32;
3805 + }
3806 + return s;
3807 +}
3808 +
3809 +static void
3810 +bleep (u_short val )
3811 +{
3812 + static short vals[] = { 350, 370, 392, 414, 440, 466, 491, 523,
3813 +554, 587, 619, 659 };
3814 + short freq;
3815 + int time = bleep_time;
3816 + freq = vals[val%12];
3817 + if (val > 11 )
3818 + freq *= (1<<(val/12 ) );
3819 + kd_mksound (freq, time );
3820 +}
3821 +
3822 +void
3823 +speakup_shut_up (struct vc_data *vc )
3824 +{
3825 + if (spk_killed ) return;
3826 + spk_shut_up |= 0x01;
3827 + spk_parked &= 0xfe;
3828 + speakup_date (vc );
3829 + if (synth == NULL ) return;
3830 + do_flush( );
3831 +}
3832 +
3833 +void
3834 +speech_kill (struct vc_data *vc )
3835 +{
3836 + char val = synth->is_alive ( );
3837 + if (val == 0 ) return;
3838 + /* re-enables synth, if disabled */
3839 + if (val == 2 || spk_killed ) { /* dead */
3840 + spk_shut_up &= ~0x40;
3841 + synth_write_msg ("Eyem a Lighve!" );
3842 + } else {
3843 + synth_write_msg ("You killed speak up!" );
3844 + spk_shut_up |= 0x40;
3845 + }
3846 +}
3847 +
3848 +static void
3849 +speakup_off (struct vc_data *vc )
3850 +{
3851 + if (spk_shut_up & 0x80 ) {
3852 + spk_shut_up &= 0x7f;
3853 + synth_write_msg ("hey. That's better!" );
3854 + } else {
3855 + spk_shut_up |= 0x80;
3856 + synth_write_msg ("You turned me off!" );
3857 + }
3858 + speakup_date (vc );
3859 +}
3860 +
3861 +static void
3862 +speakup_parked (struct vc_data *vc )
3863 +{
3864 + if (spk_parked & 0x80 ) {
3865 + spk_parked = 0;
3866 + synth_write_msg ("unparked!" );
3867 + } else {
3868 + spk_parked |= 0x80;
3869 + synth_write_msg ("parked!" );
3870 + }
3871 +}
3872 +
3873 +/* ------ cut and paste ----- */
3874 +/* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */
3875 +#undef isspace
3876 +#define isspace(c) ((c) == ' ')
3877 +/* Variables for selection control. */
3878 +struct vc_data *spk_sel_cons; /* defined in selection.c must not be disallocated */
3879 +static volatile int sel_start = -1; /* cleared by clear_selection */
3880 +static int sel_end;
3881 +static int sel_buffer_lth;
3882 +static char *sel_buffer;
3883 +
3884 +static unsigned char
3885 +sel_pos(int n)
3886 +{
3887 + return inverse_translate(spk_sel_cons, screen_glyph(spk_sel_cons, n));
3888 +}
3889 +
3890 +static inline u16
3891 +get_char(struct vc_data *vc, u16 *pos)
3892 +{
3893 + u16 ch = ' ';
3894 + if (vc && pos) {
3895 + u16 w = scr_readw(pos);
3896 + u16 c = w & 0xff;
3897 +
3898 + if (w & vc->vc_hi_font_mask)
3899 + c |= 0x100;
3900 +
3901 + ch = w & 0xff00;
3902 + ch |= inverse_translate(vc, c);
3903 + }
3904 + return ch;
3905 +}
3906 +
3907 +static inline unsigned char
3908 +get_attributes(u16 *pos)
3909 +{
3910 + return (u_char ) (scr_readw (pos ) >> 8 );
3911 +}
3912 +
3913 +static void
3914 +speakup_clear_selection(void)
3915 +{
3916 + sel_start = -1;
3917 +}
3918 +
3919 +/* does screen address p correspond to character at LH/RH edge of screen? */
3920 +static inline int atedge(const int p, int size_row)
3921 +{
3922 + return (!(p % size_row) || !((p + 2) % size_row));
3923 +}
3924 +
3925 +/* constrain v such that v <= u */
3926 +static inline unsigned short limit(const unsigned short v, const unsigned short u)
3927 +{
3928 + return (v > u) ? u : v;
3929 +}
3930 +
3931 +unsigned short xs, ys, xe, ye; /* our region points */
3932 +
3933 +static int
3934 +speakup_set_selection( struct tty_struct *tty)
3935 +{
3936 + int new_sel_start, new_sel_end;
3937 + char *bp, *obp;
3938 + int i, ps, pe;
3939 + struct vc_data *vc = vc_cons[fg_console].d;
3940 +
3941 + xs = limit(xs, vc->vc_cols - 1);
3942 + ys = limit(ys, vc->vc_rows - 1);
3943 + xe = limit(xe, vc->vc_cols - 1);
3944 + ye = limit(ye, vc->vc_rows - 1);
3945 + ps = ys * vc->vc_size_row + (xs << 1);
3946 + pe = ye * vc->vc_size_row + (xe << 1);
3947 +
3948 + if (ps > pe) { /* make sel_start <= sel_end */
3949 + int tmp = ps;
3950 + ps = pe;
3951 + pe = tmp;
3952 + }
3953 +
3954 + if (spk_sel_cons != vc_cons[fg_console].d) {
3955 + speakup_clear_selection();
3956 + spk_sel_cons = vc_cons[fg_console].d;
3957 + printk(KERN_WARNING "Selection: mark console not the same as cut\n");
3958 + return -EINVAL;
3959 + }
3960 +
3961 + new_sel_start = ps;
3962 + new_sel_end = pe;
3963 +
3964 + /* select to end of line if on trailing space */
3965 + if (new_sel_end > new_sel_start &&
3966 + !atedge(new_sel_end, vc->vc_size_row) &&
3967 + isspace(sel_pos(new_sel_end))) {
3968 + for (pe = new_sel_end + 2; ; pe += 2)
3969 + if (!isspace(sel_pos(pe)) ||
3970 + atedge(pe, vc->vc_size_row))
3971 + break;
3972 + if (isspace(sel_pos(pe)))
3973 + new_sel_end = pe;
3974 + }
3975 + if ((new_sel_start == sel_start)
3976 + && (new_sel_end == sel_end)) /* no action required */
3977 + return 0;
3978 +
3979 + sel_start = new_sel_start;
3980 + sel_end = new_sel_end;
3981 + /* Allocate a new buffer before freeing the old one ... */
3982 + bp = kmalloc((sel_end-sel_start)/2+1, GFP_ATOMIC);
3983 + if (!bp) {
3984 + printk(KERN_WARNING "selection: kmalloc() failed\n");
3985 + speakup_clear_selection();
3986 + return -ENOMEM;
3987 + }
3988 + if (sel_buffer)
3989 + kfree(sel_buffer);
3990 + sel_buffer = bp;
3991 +
3992 + obp = bp;
3993 + for (i = sel_start; i <= sel_end; i += 2) {
3994 + *bp = sel_pos(i);
3995 + if (!isspace(*bp++))
3996 + obp = bp;
3997 + if (! ((i + 2) % vc->vc_size_row)) {
3998 + /* strip trailing blanks from line and add newline,
3999 + unless non-space at end of line. */
4000 + if (obp != bp) {
4001 + bp = obp;
4002 + *bp++ = '\r';
4003 + }
4004 + obp = bp;
4005 + }
4006 + }
4007 + sel_buffer_lth = bp - sel_buffer;
4008 + return 0;
4009 +}
4010 +
4011 +static int
4012 +speakup_paste_selection(struct tty_struct *tty)
4013 +{
4014 + struct vc_data *vc = (struct vc_data *) tty->driver_data;
4015 + int pasted = 0, count;
4016 + DECLARE_WAITQUEUE(wait, current);
4017 + add_wait_queue(&vc->paste_wait, &wait);
4018 + while (sel_buffer && sel_buffer_lth > pasted) {
4019 + set_current_state(TASK_INTERRUPTIBLE);
4020 + if (test_bit(TTY_THROTTLED, &tty->flags)) {
4021 + schedule();
4022 + continue;
4023 + }
4024 + count = sel_buffer_lth - pasted;
4025 + count = min_t(int, count, tty->receive_room);
4026 + tty->ldisc.receive_buf(tty, sel_buffer + pasted, 0, count);
4027 + pasted += count;
4028 + }
4029 + remove_wait_queue(&vc->paste_wait, &wait);
4030 + current->state = TASK_RUNNING;
4031 + return 0;
4032 +}
4033 +
4034 +static void
4035 +speakup_cut (struct vc_data *vc )
4036 +{
4037 + static const char err_buf[] = "set selection failed";
4038 + int ret;
4039 +
4040 + if (!mark_cut_flag ) {
4041 + mark_cut_flag = 1;
4042 + xs = spk_x;
4043 + ys = spk_y;
4044 + spk_sel_cons = vc;
4045 + synth_write_msg ("mark" );
4046 + return;
4047 + }
4048 + xe = (u_short ) spk_x;
4049 + ye = (u_short )spk_y;
4050 + mark_cut_flag = 0;
4051 + synth_write_msg ("cut" );
4052 +
4053 + speakup_clear_selection( );
4054 + ret = speakup_set_selection ( tty );
4055 +
4056 + switch (ret ) {
4057 + case 0:
4058 + break; /* no error */
4059 + case -EFAULT :
4060 + pr_warn( "%sEFAULT\n", err_buf );
4061 + break;
4062 + case -EINVAL :
4063 + pr_warn( "%sEINVAL\n", err_buf );
4064 + break;
4065 + case -ENOMEM :
4066 + pr_warn( "%sENOMEM\n", err_buf );
4067 + break;
4068 + }
4069 +}
4070 +
4071 +static void
4072 +speakup_paste (struct vc_data *vc )
4073 +{
4074 + if (mark_cut_flag ) {
4075 + mark_cut_flag = 0;
4076 + synth_write_msg ("mark, cleared" );
4077 + } else {
4078 + synth_write_msg ("paste" );
4079 + speakup_paste_selection (tty );
4080 + }
4081 +}
4082 +
4083 +static void
4084 +say_attributes (struct vc_data *vc )
4085 +{
4086 + int fg= spk_attr&0x0f, bg = spk_attr>>4;
4087 + if (fg > 8 ) {
4088 + synth_write_string("bright " );
4089 + fg -= 8;
4090 + }
4091 + synth_write_string(colors[fg] );
4092 + if (bg > 7 ) {
4093 + synth_write_string(" on blinking " );
4094 + bg -= 8;
4095 + } else
4096 + synth_write_string(" on " );
4097 + synth_write_msg(colors[bg] );
4098 +}
4099 +
4100 +static char *blank_msg = "blank";
4101 +static char *edges[] = { "top, ", "bottom, ", "left, ", "right, ", "" };
4102 +enum { edge_top = 1, edge_bottom, edge_left, edge_right, edge_quiet };
4103 +
4104 +static void
4105 +announce_edge (struct vc_data *vc, int msg_id )
4106 +{
4107 + if (bleeps&1 )
4108 + bleep (spk_y );
4109 + if (bleeps&2 )
4110 + synth_write_msg (edges[msg_id-1] );
4111 +}
4112 +
4113 +static void
4114 +speak_char( u_char ch )
4115 +{
4116 + char *cp = characters[ ch];
4117 + if (cp == NULL) {
4118 + pr_info ("speak_char: cp==NULL!\n");
4119 + return;
4120 + }
4121 + synth_buffer_add( SPACE );
4122 + if (IS_CHAR(ch, B_CAP ) ) {
4123 + pitch_shift++;
4124 + synth_write_string(str_caps_start );
4125 + synth_write_string(cp );
4126 + synth_write_string(str_caps_stop );
4127 + } else {
4128 + if (*cp == '^' ) {
4129 + synth_write_string(str_ctl );
4130 + cp++;
4131 + }
4132 + synth_write_string(cp );
4133 + }
4134 + synth_buffer_add( SPACE );
4135 +}
4136 +
4137 +static void
4138 +say_char (struct vc_data *vc )
4139 +{
4140 + u_short ch;
4141 + spk_old_attr = spk_attr;
4142 + ch = get_char(vc, (u_short *) spk_pos);
4143 + spk_attr = (ch >> 8);
4144 + if (spk_attr != spk_old_attr) {
4145 + if (attrib_bleep&1) bleep(spk_y);
4146 + if (attrib_bleep&2) say_attributes(vc);
4147 + }
4148 + speak_char(ch&0xff);
4149 +}
4150 +
4151 +static void
4152 +say_phonetic_char (struct vc_data *vc )
4153 +{
4154 + u_short ch;
4155 + spk_old_attr = spk_attr;
4156 + ch = get_char(vc, (u_short *) spk_pos);
4157 + spk_attr = ((ch & 0xff00 ) >> 8 );
4158 + if ( IS_CHAR(ch, B_ALPHA ) ) {
4159 + ch &= 0x1f;
4160 + synth_write_msg(phonetic[--ch] );
4161 + } else {
4162 + if ( IS_CHAR(ch, B_NUM ) )
4163 + synth_write_string( "number " );
4164 + speak_char( ch );
4165 + }
4166 +}
4167 +
4168 +static void
4169 +say_prev_char (struct vc_data *vc )
4170 +{
4171 + spk_parked |= 0x01;
4172 + if (spk_x == 0 ) {
4173 + announce_edge(vc, edge_left );
4174 + return;
4175 + }
4176 + spk_x--;
4177 + spk_pos -= 2;
4178 + say_char (vc );
4179 +}
4180 +
4181 +static void
4182 +say_next_char (struct vc_data *vc )
4183 +{
4184 + spk_parked |= 0x01;
4185 + if (spk_x == vc->vc_cols - 1 ) {
4186 + announce_edge(vc, edge_right );
4187 + return;
4188 + }
4189 + spk_x++;
4190 + spk_pos += 2;
4191 + say_char (vc );
4192 +}
4193 +
4194 +/* get_word - will first check to see if the character under the
4195 + reading cursor is a space and if say_word_ctl is true it will
4196 + return the word space. If say_word_ctl is not set it will check to
4197 + see if there is a word starting on the next position to the right
4198 + and return that word if it exists. If it does not exist it will
4199 + move left to the beginning of any previous word on the line or the
4200 + beginning off the line whichever comes first.. */
4201 +
4202 +static u_long
4203 +get_word (struct vc_data *vc )
4204 +{
4205 + u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
4206 + char ch;
4207 + u_short attr_ch;
4208 + spk_old_attr = spk_attr;
4209 + ch = (char) get_char(vc, (u_short *) tmp_pos);
4210 +
4211 +/* decided to take out the sayword if on a space (mis-information */
4212 + if ( say_word_ctl && ch == SPACE ) {
4213 + *buf = '\0';
4214 + synth_write_msg( "space" );
4215 + return 0;
4216 + } else if ((tmpx < vc->vc_cols-2 )
4217 + && (ch == SPACE || IS_WDLM(ch ))
4218 + && ((char) get_char (vc, (u_short * ) tmp_pos+1 ) > SPACE)) {
4219 + tmp_pos += 2;
4220 + tmpx++;
4221 + } else
4222 + while (tmpx > 0 ) {
4223 + if (((ch = (char ) get_char (vc, (u_short * ) tmp_pos-1 )) == SPACE
4224 + || IS_WDLM(ch ))
4225 + && ((char) get_char (vc, (u_short * ) tmp_pos ) > SPACE))
4226 + break;
4227 + tmp_pos -= 2;
4228 + tmpx--;
4229 + }
4230 + attr_ch = get_char (vc, (u_short * ) tmp_pos );
4231 + spk_attr = attr_ch >> 8;
4232 + buf[cnt++] = attr_ch&0xff;
4233 + while (tmpx < vc->vc_cols-1 ) {
4234 + tmp_pos += 2;
4235 + tmpx++;
4236 + ch = (char ) get_char (vc, (u_short * ) tmp_pos );
4237 + if ((ch == SPACE )
4238 + || (IS_WDLM(buf[cnt-1] ) && ( ch > SPACE )))
4239 + break;
4240 + buf[cnt++] = ch;
4241 + }
4242 + buf[cnt] = '\0';
4243 + return cnt;
4244 +}
4245 +
4246 +static void
4247 +say_word (struct vc_data *vc )
4248 +{
4249 + u_long cnt = get_word(vc );
4250 + u_short saved_punc_mask = punc_mask;
4251 + if ( cnt == 0 ) return;
4252 + punc_mask = PUNC;
4253 + buf[cnt++] = SPACE;
4254 + spkup_write (buf, cnt );
4255 + punc_mask = saved_punc_mask;
4256 +}
4257 +
4258 +static void
4259 +say_prev_word (struct vc_data *vc )
4260 +{
4261 + char ch;
4262 + u_short edge_said = 0, last_state = 0, state = 0;
4263 + spk_parked |= 0x01;
4264 + if (spk_x == 0 ) {
4265 + if ( spk_y == 0 ) {
4266 + announce_edge(vc, edge_top );
4267 + return;
4268 + }
4269 + spk_y--;
4270 + spk_x = vc->vc_cols;
4271 + edge_said = edge_quiet;
4272 + }
4273 + while ( 1 ) {
4274 + if (spk_x == 0 ) {
4275 + if (spk_y == 0 ) {
4276 + edge_said = edge_top;
4277 + break;
4278 + }
4279 + if ( edge_said != edge_quiet ) edge_said = edge_left;
4280 + if ( state > 0 ) break;
4281 + spk_y--;
4282 + spk_x = vc->vc_cols-1;
4283 + } else spk_x--;
4284 + spk_pos -= 2;
4285 + ch = (char ) get_char (vc, (u_short * ) spk_pos );
4286 + if ( ch == SPACE ) state = 0;
4287 + else if (IS_WDLM(ch ) ) state = 1;
4288 + else state = 2;
4289 + if (state < last_state ) {
4290 + spk_pos += 2;
4291 + spk_x++;
4292 + break;
4293 + }
4294 + last_state = state;
4295 + }
4296 + if ( spk_x == 0 && edge_said == edge_quiet )
4297 + edge_said = edge_left;
4298 + if ( edge_said > 0 && edge_said < edge_quiet )
4299 + announce_edge( vc, edge_said );
4300 + say_word (vc );
4301 +}
4302 +
4303 +static void
4304 +say_next_word (struct vc_data *vc )
4305 +{
4306 + char ch;
4307 + u_short edge_said = 0, last_state = 2, state = 0;
4308 + spk_parked |= 0x01;
4309 + if ( spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows-1 ) {
4310 + announce_edge(vc, edge_bottom );
4311 + return;
4312 + }
4313 + while ( 1 ) {
4314 + ch = (char ) get_char (vc, (u_short * ) spk_pos );
4315 + if ( ch == SPACE ) state = 0;
4316 + else if (IS_WDLM(ch ) ) state = 1;
4317 + else state = 2;
4318 + if ( state > last_state ) break;
4319 + if (spk_x >= vc->vc_cols-1 ) {
4320 + if (spk_y == vc->vc_rows-1 ) {
4321 + edge_said = edge_bottom;
4322 + break;
4323 + }
4324 + state = 0;
4325 + spk_y++;
4326 + spk_x = 0;
4327 + edge_said = edge_right;
4328 + } else spk_x++;
4329 + spk_pos += 2;
4330 + last_state = state;
4331 + }
4332 + if ( edge_said > 0 )
4333 + announce_edge( vc, edge_said );
4334 + say_word (vc );
4335 +}
4336 +
4337 +static void
4338 +spell_word (struct vc_data *vc )
4339 +{
4340 + static char *delay_str[] = { " ", ", ", ". ", ". . ", ". . . " };
4341 + char *cp = buf, *str_cap= str_caps_stop;
4342 + char *cp1, *last_cap = str_caps_stop;
4343 + u_char ch;
4344 + if ( !get_word(vc ) ) return;
4345 + while ((ch = (u_char )*cp ) ) {
4346 + if ( cp != buf )
4347 + synth_write_string (delay_str[spell_delay] );
4348 + if (IS_CHAR(ch, B_CAP ) ) {
4349 + str_cap = str_caps_start;
4350 + if ( *str_caps_stop ) pitch_shift++;
4351 + else last_cap = str_caps_stop; /* synth has no pitch */
4352 + } else str_cap = str_caps_stop;
4353 + if ( str_cap !=last_cap ) {
4354 + synth_write_string( str_cap );
4355 + last_cap = str_cap;
4356 + }
4357 + if ( this_speakup_key == SPELL_PHONETIC && ( IS_CHAR( ch, B_ALPHA ) ) ) {
4358 + ch &= 31;
4359 + cp1 = phonetic[--ch];
4360 + } else {
4361 + cp1 = characters[ch];
4362 + if (*cp1 == '^' ) {
4363 + synth_write_string(str_ctl );
4364 + cp1++;
4365 + }
4366 + }
4367 + synth_write_string(cp1 );
4368 + cp++;
4369 + }
4370 + if ( str_cap != str_caps_stop )
4371 + synth_write_string( str_caps_stop );
4372 +}
4373 +
4374 +static int
4375 +get_line (struct vc_data *vc )
4376 +{
4377 + u_long tmp = spk_pos - (spk_x * 2 );
4378 + int i = 0;
4379 + spk_old_attr = spk_attr;
4380 + spk_attr = get_attributes ((u_short * ) spk_pos );
4381 + for (i = 0; i < vc->vc_cols; i++ ) {
4382 + buf[i] = (u_char ) get_char (vc, (u_short * ) tmp );
4383 + tmp += 2;
4384 + }
4385 + for (--i; i >= 0; i-- )
4386 + if (buf[i] != SPACE ) break;
4387 + return ++i;
4388 +}
4389 +
4390 +static void
4391 +say_line (struct vc_data *vc )
4392 +{
4393 + int i = get_line( vc );
4394 + char *cp;
4395 + char num_buf[8];
4396 + u_short saved_punc_mask = punc_mask;
4397 + if (i == 0 ) {
4398 + synth_write_msg (blank_msg );
4399 + return;
4400 + }
4401 + buf[i++] = '\n';
4402 + if ( this_speakup_key == SAY_LINE_INDENT ) {
4403 + for ( cp = buf; *cp == SPACE; cp++ );
4404 + sprintf( num_buf, "%d, ", ( cp-buf )+1 );
4405 + synth_write_string( num_buf );
4406 + }
4407 + punc_mask = punc_masks[reading_punc];
4408 + spkup_write (buf, i );
4409 + punc_mask = saved_punc_mask;
4410 +}
4411 +
4412 +static void
4413 +say_prev_line (struct vc_data *vc )
4414 +{
4415 + spk_parked |= 0x01;
4416 + if (spk_y == 0 ) {
4417 + announce_edge (vc, edge_top );
4418 + return;
4419 + }
4420 + spk_y--;
4421 + spk_pos -= vc->vc_size_row;
4422 + say_line (vc );
4423 +}
4424 +
4425 +static void
4426 +say_next_line (struct vc_data *vc )
4427 +{
4428 + spk_parked |= 0x01;
4429 + if (spk_y == vc->vc_rows - 1 ) {
4430 + announce_edge (vc, edge_bottom );
4431 + return;
4432 + }
4433 + spk_y++;
4434 + spk_pos += vc->vc_size_row;
4435 + say_line (vc );
4436 +}
4437 +
4438 +static int
4439 +say_from_to (struct vc_data *vc, u_long from, u_long to, int read_punc )
4440 +{
4441 + int i = 0;
4442 + u_short saved_punc_mask = punc_mask;
4443 + spk_old_attr = spk_attr;
4444 + spk_attr = get_attributes ((u_short * ) from );
4445 + while (from < to ) {
4446 + buf[i++] = (char ) get_char (vc, (u_short * ) from );
4447 + from += 2;
4448 + if ( i >= vc->vc_size_row ) break;
4449 + }
4450 + for (--i; i >= 0; i-- )
4451 + if (buf[i] != SPACE ) break;
4452 + buf[++i] = SPACE;
4453 + buf[++i] = '\0';
4454 + if ( i < 1 ) return i;
4455 + if ( read_punc ) punc_mask = punc_info[reading_punc].mask;
4456 + spkup_write (buf, i );
4457 + if ( read_punc ) punc_mask = saved_punc_mask;
4458 + return i-1;
4459 +}
4460 +
4461 +static void
4462 +say_line_from_to (struct vc_data *vc, u_long from, u_long to, int read_punc )
4463 +{
4464 + u_long start = vc->vc_origin+(spk_y*vc->vc_size_row );
4465 + u_long end = start+( to * 2 );
4466 + start += from*2;
4467 + if ( say_from_to( vc, start, end, read_punc ) <= 0 )
4468 + if ( cursor_track != read_all_mode )
4469 + synth_write_msg (blank_msg );
4470 +}
4471 +
4472 +// Sentence Reading Commands
4473 +
4474 +void synth_insert_next_index( int );
4475 +
4476 +int currsentence;
4477 +int numsentences[2];
4478 +char *sentbufend[2];
4479 +char *sentmarks[2][10];
4480 +int currbuf=0;
4481 +int bn;
4482 +static char sentbuf[2][256];
4483 +
4484 +static int
4485 +say_sentence_num ( int num , int prev )
4486 +{
4487 + bn=currbuf;
4488 + currsentence=num+1;
4489 + if (prev) {
4490 + if (--bn == -1) bn=1;
4491 + }
4492 +
4493 + if (num>numsentences[bn])
4494 + return 0;
4495 + spkup_write (sentmarks[bn][num], sentbufend[bn]-sentmarks[bn][num]);
4496 + return 1;
4497 +}
4498 +
4499 +static int
4500 +get_sentence_buf (struct vc_data *vc, int read_punc )
4501 +{
4502 + u_long start,end;
4503 + int i,bn;
4504 + currbuf++;
4505 + if ( currbuf == 2 )
4506 + currbuf=0;
4507 + bn=currbuf;
4508 + start = vc->vc_origin+((spk_y)*vc->vc_size_row );
4509 + end = vc->vc_origin+((spk_y)*vc->vc_size_row ) + vc->vc_cols*2;
4510 +
4511 + numsentences[bn]=0;
4512 + sentmarks[bn][0]=&sentbuf[bn][0];
4513 + i = 0;
4514 + spk_old_attr = spk_attr;
4515 + spk_attr = get_attributes ((u_short * ) start );
4516 +
4517 + while (start < end ) {
4518 + sentbuf[bn][i] = (char ) get_char (vc, (u_short * ) start );
4519 + if (i>0)
4520 + {
4521 + if ((sentbuf[bn][i]==SPACE)&&(sentbuf[bn][i-1]=='.')&&(numsentences[bn]<9))
4522 + {
4523 + // Sentence Marker
4524 + numsentences[bn]++;
4525 + sentmarks[bn][numsentences[bn]]=&sentbuf[bn][i];
4526 + }
4527 + }
4528 + i++;
4529 + start += 2;
4530 + if ( i >= vc->vc_size_row )
4531 + break;
4532 + }
4533 +
4534 + for (--i; i >= 0; i-- )
4535 + if (sentbuf[bn][i] != SPACE )
4536 + break;
4537 +
4538 + if ( i < 1 )
4539 + return -1;
4540 +
4541 + sentbuf[bn][++i] = SPACE;
4542 + sentbuf[bn][++i] = '\0';
4543 +
4544 + sentbufend[bn]=&sentbuf[bn][i];
4545 + return numsentences[bn];
4546 +}
4547 +
4548 +//
4549 +
4550 +static void
4551 +say_screen_from_to (struct vc_data *vc, u_long from, u_long to )
4552 +{
4553 + u_long start = vc->vc_origin, end;
4554 + if ( from > 0 ) start += from * vc->vc_size_row;
4555 + if ( to > vc->vc_rows ) to = vc->vc_rows;
4556 + end = vc->vc_origin + ( to * vc->vc_size_row);
4557 + for ( from = start; from < end; from = to ) {
4558 + to = from + vc->vc_size_row;
4559 + say_from_to( vc, from, to, 1 );
4560 + }
4561 +}
4562 +
4563 +static void
4564 +say_screen (struct vc_data *vc )
4565 +{
4566 + say_screen_from_to( vc, 0, vc->vc_rows );
4567 +}
4568 +
4569 +static void
4570 +speakup_win_say (struct vc_data *vc )
4571 +{
4572 + u_long start, end, from, to;
4573 + if ( win_start < 2 ) {
4574 + synth_write_msg( "no window" );
4575 + return;
4576 + }
4577 + start = vc->vc_origin + ( win_top * vc->vc_size_row );
4578 + end = vc->vc_origin + ( win_bottom * vc->vc_size_row );
4579 + while ( start <= end ) {
4580 + from = start + ( win_left * 2 );
4581 + to = start + ( win_right * 2 );
4582 + say_from_to( vc, from, to, 1 );
4583 + start += vc->vc_size_row;
4584 + }
4585 +}
4586 +
4587 +static void
4588 +top_edge (struct vc_data *vc )
4589 +{
4590 + spk_parked |= 0x01;
4591 + spk_pos = vc->vc_origin + 2 * spk_x;
4592 + spk_y = 0;
4593 + say_line (vc );
4594 +}
4595 +
4596 +static void
4597 +bottom_edge (struct vc_data *vc )
4598 +{
4599 + spk_parked |= 0x01;
4600 + spk_pos += (vc->vc_rows - spk_y - 1 ) * vc->vc_size_row;
4601 + spk_y = vc->vc_rows - 1;
4602 + say_line (vc );
4603 +}
4604 +
4605 +static void
4606 +left_edge (struct vc_data *vc )
4607 +{
4608 + spk_parked |= 0x01;
4609 + spk_pos -= spk_x * 2;
4610 + spk_x = 0;
4611 + say_char (vc );
4612 +}
4613 +
4614 +static void
4615 +right_edge (struct vc_data *vc )
4616 +{
4617 + spk_parked |= 0x01;
4618 + spk_pos += (vc->vc_cols - spk_x - 1 ) * 2;
4619 + spk_x = vc->vc_cols - 1;
4620 + say_char (vc );
4621 +}
4622 +
4623 +static void
4624 +say_first_char (struct vc_data *vc )
4625 +{
4626 + int i, len = get_line( vc );
4627 + u_char ch;
4628 + spk_parked |= 0x01;
4629 + if ( len == 0 ) {
4630 + synth_write_msg( blank_msg );
4631 + return;
4632 + }
4633 + for ( i = 0; i < len; i++ ) if ( buf[i] != SPACE ) break;
4634 + ch = buf[i];
4635 + spk_pos -= ( spk_x-i ) * 2;
4636 + spk_x = i;
4637 + sprintf (buf, "%d, ", ++i );
4638 + synth_write_string (buf );
4639 + speak_char( ch );
4640 +}
4641 +
4642 +static void
4643 +say_last_char (struct vc_data *vc )
4644 +{
4645 + int len = get_line( vc );
4646 + u_char ch;
4647 + spk_parked |= 0x01;
4648 + if ( len == 0 ) {
4649 + synth_write_msg( blank_msg );
4650 + return;
4651 + }
4652 + ch = buf[--len];
4653 + spk_pos -= ( spk_x-len ) * 2;
4654 + spk_x = len;
4655 + sprintf (buf, "%d, ", ++len );
4656 + synth_write_string (buf );
4657 + speak_char( ch );
4658 +}
4659 +
4660 +static void
4661 +say_position (struct vc_data *vc )
4662 +{
4663 + sprintf (buf, "line %ld, col %ld, t t y %d\n", spk_y + 1,
4664 + spk_x + 1, vc->vc_num + 1 );
4665 + synth_write_string (buf );
4666 +}
4667 +
4668 +// Added by brianb
4669 +static void
4670 +say_char_num (struct vc_data *vc )
4671 +{
4672 + u_short ch = get_char(vc, (u_short * ) spk_pos);
4673 + ch &= 0x0ff;
4674 + sprintf (buf, "hex %02x, decimal %d", ch, ch );
4675 + synth_write_msg (buf );
4676 +}
4677 +
4678 +/* these are stub functions to keep keyboard.c happy. */
4679 +
4680 +static void
4681 +say_from_top (struct vc_data *vc )
4682 +{
4683 + say_screen_from_to (vc, 0, spk_y );
4684 +}
4685 +
4686 +static void
4687 +say_to_bottom (struct vc_data *vc )
4688 +{
4689 + say_screen_from_to (vc, spk_y, vc->vc_rows );
4690 +}
4691 +
4692 +static void
4693 +say_from_left (struct vc_data *vc )
4694 +{
4695 + say_line_from_to (vc, 0, spk_x, 1 );
4696 +}
4697 +
4698 +static void
4699 +say_to_right (struct vc_data *vc )
4700 +{
4701 + say_line_from_to (vc, spk_x, vc->vc_cols, 1 );
4702 +}
4703 +
4704 +/* end of stub functions. */
4705 +
4706 +static void
4707 +spkup_write (const char *in_buf, int count )
4708 +{
4709 + static int rep_count = 0;
4710 + static u_char ch = '\0', old_ch = '\0';
4711 + static u_short char_type = 0, last_type = 0;
4712 + static u_char *exn_ptr = NULL;
4713 + int in_count = count;
4714 + char rpt_buf[32];
4715 + spk_keydown = 0;
4716 + while ( count-- ) {
4717 + if ( cursor_track == read_all_mode ) {
4718 + // Insert Sentence Index
4719 + if (( in_buf == sentmarks[bn][currsentence] ) &&
4720 + ( currsentence <= numsentences[bn] ))
4721 + synth_insert_next_index(currsentence++);
4722 + }
4723 + ch = (u_char )*in_buf++;
4724 + char_type = spk_chartab[ch];
4725 + if (ch == old_ch && !(char_type&B_NUM ) ) {
4726 + if (++rep_count > 2 ) continue;
4727 + } else {
4728 + if ( (last_type&CH_RPT) && rep_count > 2 ) {
4729 + sprintf (rpt_buf, " times %d . ", ++rep_count );
4730 + synth_write_string (rpt_buf );
4731 + }
4732 + rep_count = 0;
4733 + }
4734 + if ( !( char_type&B_NUM ) )
4735 + exn_ptr = NULL;
4736 + if (ch == spk_lastkey ) {
4737 + rep_count = 0;
4738 + if ( key_echo == 1 && ch >= MINECHOCHAR )
4739 + speak_char( ch );
4740 + } else if ( ( char_type&B_ALPHA ) ) {
4741 + if ( (synth_flags&SF_DEC) && (last_type&PUNC) )
4742 + synth_buffer_add ( SPACE );
4743 + synth_write( &ch, 1 );
4744 + } else if ( ( char_type&B_NUM ) ) {
4745 + rep_count = 0;
4746 + if ( (last_type&B_EXNUM) && synth_buff_in == exn_ptr+1 ) {
4747 + synth_buff_in--;
4748 + synth_buffer_add( old_ch );
4749 + exn_ptr = NULL;
4750 + }
4751 + synth_write( &ch, 1 );
4752 + } else if ( (char_type&punc_mask) ) {
4753 + speak_char( ch );
4754 + char_type &= ~PUNC; /* for dec nospell processing */
4755 + } else if ( ( char_type&SYNTH_OK ) ) {
4756 +/* these are usually puncts like . and , which synth needs for expression.
4757 + * suppress multiple to get rid of long pausesand clear repeat count so if
4758 + *someone has repeats on you don't get nothing repeated count */
4759 + if ( ch != old_ch )
4760 + synth_write( &ch, 1 );
4761 + else rep_count = 0;
4762 + } else {
4763 + if ( ( char_type&B_EXNUM ) )
4764 + exn_ptr = (u_char *)synth_buff_in;
4765 +/* send space and record position, if next is num overwrite space */
4766 + if ( old_ch != ch ) synth_buffer_add ( SPACE );
4767 + else rep_count = 0;
4768 + }
4769 + old_ch = ch;
4770 + last_type = char_type;
4771 + }
4772 + spk_lastkey = 0;
4773 + if (in_count > 2 && rep_count > 2 ) {
4774 + if ( (last_type&CH_RPT) ) {
4775 + sprintf (rpt_buf, " repeated %d . ", ++rep_count );
4776 + synth_write_string (rpt_buf );
4777 + }
4778 + rep_count = 0;
4779 + }
4780 +}
4781 +
4782 +static char *ctl_key_ids[] = {
4783 + "shift", "altgr", "control", "ault", "l shift", "speakup",
4784 +"l control", "r control"
4785 +};
4786 +#define NUM_CTL_LABELS 8
4787 +
4788 +static void read_all_doc( struct vc_data *vc);
4789 +void cursor_stop_timer(void );
4790 +
4791 +static void
4792 +handle_shift( KBD_PROTO )
4793 +{
4794 + (*do_shift)( KBD_ARGS );
4795 + if ( synth == NULL || up_flag || spk_killed ) return;
4796 + if (cursor_track==read_all_mode) {
4797 + switch (value) {
4798 + case KVAL(K_SHIFT):
4799 + cursor_stop_timer( );
4800 + spk_shut_up &= 0xfe;
4801 + do_flush();
4802 + read_all_doc( vc );
4803 + break;
4804 + case KVAL(K_CTRL):
4805 + cursor_stop_timer( );
4806 + cursor_track=prev_cursor_track;
4807 + spk_shut_up &= 0xfe;
4808 + do_flush();
4809 + break;
4810 + }
4811 + }
4812 + else
4813 + {
4814 + spk_shut_up &= 0xfe;
4815 + do_flush();
4816 + }
4817 + if ( say_ctrl && value < NUM_CTL_LABELS )
4818 + synth_write_string ( ctl_key_ids[value] );
4819 +}
4820 +
4821 +static void
4822 +handle_latin( KBD_PROTO )
4823 +{
4824 + (*do_latin)( KBD_ARGS );
4825 + if ( up_flag ) {
4826 + spk_lastkey = spk_keydown = 0;
4827 + return;
4828 + }
4829 + if ( synth == NULL || spk_killed ) return;
4830 + spk_shut_up &= 0xfe;
4831 + spk_lastkey = value;
4832 + spk_keydown++;
4833 + spk_parked &= 0xfe;
4834 + if ( key_echo == 2 && value >= MINECHOCHAR )
4835 + speak_char( value );
4836 +}
4837 +
4838 +static int
4839 +set_key_info( u_char *key_info, u_char *k_buffer )
4840 +{
4841 + int i = 0, states, key_data_len;
4842 + u_char *cp = key_info, *cp1 = k_buffer;
4843 + u_char ch, version, num_keys;
4844 + version = *cp++;
4845 + if ( version != KEY_MAP_VER ) return -1;
4846 + num_keys = *cp;
4847 + states = (int)cp[1];
4848 + key_data_len = ( states+1 ) * ( num_keys+1 );
4849 + if ( key_data_len+SHIFT_TBL_SIZE+4 >= sizeof(key_buf ) ) return -2;
4850 + memset( k_buffer, 0, SHIFT_TBL_SIZE );
4851 + memset( our_keys, 0, sizeof( our_keys ) );
4852 + shift_table = k_buffer;
4853 + our_keys[0] = shift_table;
4854 + cp1 += SHIFT_TBL_SIZE;
4855 + memcpy( cp1, cp, key_data_len+3 );
4856 +/* get num_keys, states and data*/
4857 + cp1 += 2; /* now pointing at shift states */
4858 + for ( i = 1; i <= states; i++ ) {
4859 + ch = *cp1++;
4860 + if ( ch >= SHIFT_TBL_SIZE ) return -3;
4861 + shift_table[ch] = i;
4862 + }
4863 + keymap_flags = *cp1++;
4864 + while ( ( ch = *cp1 ) ) {
4865 + if ( ch >= MAX_KEY ) return -4;
4866 + our_keys[ch] = cp1;
4867 + cp1 += states+1;
4868 + }
4869 + return 0;
4870 +}
4871 +
4872 +num_var spk_num_vars[] = { /* bell must be first to set high limit */
4873 + { BELL_POS, 0, 0, 0, 0, 0, 0, 0 },
4874 + { SPELL_DELAY, 0, 0, 0, 5, 0, 0, 0 },
4875 + { ATTRIB_BLEEP, 0, 1, 0, 3, 0, 0, 0 },
4876 + { BLEEPS, 0, 3, 0, 3, 0, 0, 0 },
4877 + { BLEEP_TIME, 0, 30, 1, 200, 0, 0, 0 },
4878 + { PUNC_LEVEL, 0, 1, 0, 4, 0, 0, 0 },
4879 + { READING_PUNC, 0, 1, 0, 4, 0, 0, 0 },
4880 + { CURSOR_TIME, 0, 120, 50, 600, 0, 0, 0 },
4881 + { SAY_CONTROL, TOGGLE_0 },
4882 + { SAY_WORD_CTL, TOGGLE_0 },
4883 + { NO_INTERRUPT, TOGGLE_0 },
4884 + { KEY_ECHO, 0, 1, 0, 2, 0, 0, 0 },
4885 + V_LAST_NUM
4886 +};
4887 +
4888 +static char *cursor_msgs[] = { "cursoring off", "cursoring on",
4889 + "highlight tracking", "read windo",
4890 +"read all" };
4891 +
4892 +static void
4893 +toggle_cursoring( struct vc_data *vc )
4894 +{
4895 + if (cursor_track==read_all_mode)
4896 + cursor_track=prev_cursor_track;
4897 + if (++ cursor_track >= CT_Max )
4898 + cursor_track = 0;
4899 + synth_write_msg (cursor_msgs[cursor_track] );
4900 +}
4901 +
4902 +static void
4903 +reset_default_chars (void )
4904 +{
4905 + int i;
4906 + if (default_chars[(int )'a'] == NULL ) { /* lowers are null first time */
4907 + for (i = (int )'a'; default_chars[i] == NULL; i++ )
4908 + default_chars[i] = default_chars[i-32];
4909 + } else { /* free any non-default */
4910 + for (i = 0; i < 256; i++ ) {
4911 + if (characters[i] != default_chars[i] )
4912 + kfree (characters[i] );
4913 + }
4914 + }
4915 + memcpy( characters, default_chars, sizeof( default_chars ) );
4916 +}
4917 +
4918 +static void
4919 +reset_default_chartab (void )
4920 +{
4921 + memcpy( spk_chartab, default_chartab, sizeof( default_chartab ) );
4922 +}
4923 +
4924 +static void
4925 +handle_cursor( KBD_PROTO );
4926 +static void
4927 +handle_spec( KBD_PROTO );
4928 +static void
4929 +cursor_done(u_long data );
4930 +
4931 +declare_timer( cursor_timer );
4932 +
4933 +void __init speakup_open (struct vc_data *vc, spk_t *first_console )
4934 +{
4935 + int i;
4936 + num_var *n_var;
4937 +
4938 + reset_default_chars();
4939 + reset_default_chartab();
4940 + memset( speakup_console, 0, sizeof(speakup_console));
4941 + if ( first_console == NULL ) return;
4942 + memset( first_console, 0, spk_size);
4943 + speakup_console[vc->vc_num] = first_console;
4944 + speakup_date(vc);
4945 + pr_info ("%s: initialized\n", SPEAKUP_VERSION );
4946 + init_timer(&cursor_timer);
4947 + cursor_timer.entry.prev = NULL;
4948 + cursor_timer.function = cursor_done;
4949 + init_sleeper(synth_sleeping_list);
4950 + strlwr(synth_name);
4951 + spk_num_vars[0].high = vc->vc_cols;
4952 + for ( n_var = spk_num_vars; n_var->var_id >= 0; n_var++ )
4953 + speakup_register_var(n_var);
4954 + for (i = 1; punc_info[i].mask != 0; i++ )
4955 + set_mask_bits( 0, i, 2 );
4956 + do_latin = key_handler[KT_LATIN];
4957 + key_handler[KT_LATIN] = handle_latin;
4958 + do_spec = key_handler[KT_SPEC];
4959 + key_handler[KT_SPEC] = handle_spec;
4960 + do_cursor = key_handler[KT_CUR];
4961 + key_handler[KT_CUR] = handle_cursor;
4962 + do_shift = key_handler[KT_SHIFT];
4963 + key_handler[KT_SHIFT] = handle_shift;
4964 + set_key_info(key_defaults, key_buf);
4965 + if (quiet_boot) spk_shut_up |= 0x01;
4966 +}
4967 +
4968 +#ifdef CONFIG_PROC_FS
4969 +
4970 +// speakup /proc interface code
4971 +
4972 +/* Usage:
4973 +cat /proc/speakup/version
4974 +
4975 +cat /proc/speakup/characters > foo
4976 +less /proc/speakup/characters
4977 +vi /proc/speakup/characters
4978 +
4979 +cat foo > /proc/speakup/characters
4980 +cat > /proc/speakup/characters
4981 +echo 39 apostrophe > /proc/speakup/characters
4982 +echo 87 w > /proc/speakup/characters
4983 +echo 119 w > /proc/speakup/characters
4984 +echo defaults > /proc/speakup/characters
4985 +echo reset > /proc/speakup/characters
4986 +
4987 +
4988 +cat /proc/speakup/chartab > foo
4989 +less /proc/speakup/chartab
4990 +vi /proc/speakup/chartab
4991 +
4992 +cat foo > /proc/speakup/chartab
4993 +cat > /proc/speakup/chartab
4994 +echo 233 ALPHA > /proc/speakup/chartab
4995 +echo 46 A_PUNC > /proc/speakup/chartab
4996 +echo defaults > /proc/speakup/chartab
4997 +echo reset > /proc/speakup/chartab
4998 +*/
4999 +
5000 +// keymap handlers
5001 +
5002 +static int
5003 +keys_read_proc (PROC_READ_PROTOTYPE )
5004 +{
5005 + char *cp = page;
5006 + int i, n, num_keys, nstates;
5007 + u_char *cp1 = key_buf + SHIFT_TBL_SIZE, ch;
5008 + num_keys = (int)(*cp1);
5009 + nstates = (int)cp1[1];
5010 + cp += sprintf( cp, "%d, %d, %d,\n", KEY_MAP_VER, num_keys, nstates );
5011 + cp1 += 2; /* now pointing at shift states */
5012 +/* dump num_keys+1 as first row is shift states + flags,
5013 + each subsequent row is key + states */
5014 + for ( n = 0; n <= num_keys; n++ ) {
5015 + for ( i = 0; i <= nstates; i++ ) {
5016 + ch = *cp1++;
5017 + cp += sprintf( cp, "%d,", (int)ch );
5018 + *cp++ = ( i < nstates ) ? SPACE : '\n';
5019 + }
5020 + }
5021 + cp += sprintf( cp, "0, %d\n", KEY_MAP_VER );
5022 + *start = 0;
5023 + *eof = 1;
5024 + return (int)(cp-page);
5025 +}
5026 +
5027 +static char *
5028 +s2uchar ( char *start, char *dest )
5029 +{
5030 + int val = 0;
5031 + while ( *start && *start <= SPACE ) start++;
5032 + while ( *start >= '0' && *start <= '9' ) {
5033 + val *= 10;
5034 + val += ( *start ) - '0';
5035 + start++;
5036 + }
5037 + if ( *start == ',' ) start++;
5038 + *dest = (u_char)val;
5039 + return start;
5040 +}
5041 +
5042 +static int
5043 +keys_write_proc (PROC_WRITE_PROTOTYPE )
5044 +{
5045 + int i, ret = count;
5046 + char *in_buff, *cp;
5047 + u_char *cp1;
5048 + if (count < 1 || count > 1800 )
5049 + return -EINVAL;
5050 + in_buff = ( char * ) __get_free_page ( GFP_KERNEL );
5051 + if ( !in_buff ) return -ENOMEM;
5052 + if (copy_from_user (in_buff, buffer, count ) ) {
5053 + free_page ( ( unsigned long ) in_buff );
5054 + return -EFAULT;
5055 + }
5056 + if (in_buff[count - 1] == '\n' ) count--;
5057 + in_buff[count] = '\0';
5058 + if ( count == 1 && *in_buff == 'd' ) {
5059 + free_page ( ( unsigned long ) in_buff );
5060 + set_key_info( key_defaults, key_buf );
5061 + return ret;
5062 + }
5063 + cp = in_buff;
5064 + cp1 = (u_char *)in_buff;
5065 + for ( i = 0; i < 3; i++ ) {
5066 + cp = s2uchar( cp, cp1 );
5067 + cp1++;
5068 + }
5069 + i = (int)cp1[-2]+1;
5070 + i *= (int)cp1[-1]+1;
5071 + i+= 2; /* 0 and last map ver */
5072 + if ( cp1[-3] != KEY_MAP_VER || cp1[-1] > 10 ||
5073 + i+SHIFT_TBL_SIZE+4 >= sizeof(key_buf ) ) {
5074 +pr_warn( "i %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1] );
5075 + free_page ( ( unsigned long ) in_buff );
5076 + return -EINVAL;
5077 + }
5078 + while ( --i >= 0 ) {
5079 + cp = s2uchar( cp, cp1 );
5080 + cp1++;
5081 + if ( !(*cp) ) break;
5082 + }
5083 + if ( i != 0 || cp1[-1] != KEY_MAP_VER || cp1[-2] != 0 ) {
5084 + ret = -EINVAL;
5085 +pr_warn( "end %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1] );
5086 + } else {
5087 + if ( set_key_info( in_buff, key_buf ) ) {
5088 + set_key_info( key_defaults, key_buf );
5089 + ret = -EINVAL;
5090 +pr_warn( "set key failed\n" );
5091 + }
5092 + }
5093 + free_page ( ( unsigned long ) in_buff );
5094 + return ret;
5095 +}
5096 +
5097 +// this is the handler for /proc/speakup/version
5098 +static int
5099 +version_read_proc (PROC_READ_PROTOTYPE )
5100 +{
5101 + int len = sprintf (page, "%s\n", SPEAKUP_VERSION );
5102 + if ( synth != NULL )
5103 + len += sprintf( page+len, "synth %s version %s\n",
5104 + synth->name, synth->version );
5105 + *start = 0;
5106 + *eof = 1;
5107 + return len;
5108 +}
5109 +
5110 +// this is the read handler for /proc/speakup/characters
5111 +static int
5112 +chars_read_proc (PROC_READ_PROTOTYPE )
5113 +{
5114 + int i, len = 0;
5115 + off_t begin = 0;
5116 + char *cp;
5117 + for (i = 0; i < 256; i++ ) {
5118 + cp = (characters[i] ) ? characters[i] : "NULL";
5119 + len += sprintf (page + len, "%d\t%s\n", i, cp );
5120 + if (len + begin > off + count )
5121 + break;
5122 + if (len + begin < off ) {
5123 + begin += len;
5124 + len = 0;
5125 + }
5126 + }
5127 + if (i >= 256 )
5128 + *eof = 1;
5129 + if (off >= len + begin )
5130 + return 0;
5131 + *start = page + (off - begin );
5132 + return ((count < begin + len - off ) ? count : begin + len - off );
5133 +}
5134 +
5135 +static volatile int chars_timer_active = 0; // indicates when timer is set
5136 +static declare_timer( chars_timer );
5137 +
5138 +static inline void
5139 +chars_stop_timer (void )
5140 +{
5141 + if (chars_timer_active )
5142 + stop_timer ( chars_timer );
5143 +}
5144 +
5145 +static int strings, rejects, updates;
5146 +
5147 +static void
5148 +show_char_results (u_long data )
5149 +{
5150 + int len;
5151 + char buf[80];
5152 + chars_stop_timer ( );
5153 + len = sprintf (buf, " updated %d of %d character descriptions\n",
5154 + updates, strings );
5155 + if (rejects )
5156 + sprintf (buf + (len-1), " with %d reject%s\n",
5157 + rejects, rejects > 1 ? "s" : "" );
5158 + printk( buf );
5159 +}
5160 +
5161 +// this is the read handler for /proc/speakup/chartab
5162 +static int
5163 +chartab_read_proc (PROC_READ_PROTOTYPE )
5164 +{
5165 + int i, len = 0;
5166 + off_t begin = 0;
5167 + char *cp;
5168 + for (i = 0; i < 256; i++ ) {
5169 + cp = "0";
5170 + if (IS_TYPE( i, B_CTL ))
5171 + cp = "B_CTL";
5172 + else if (IS_TYPE( i, WDLM ))
5173 + cp = "WDLM";
5174 + else if (IS_TYPE( i, A_PUNC ))
5175 + cp = "A_PUNC";
5176 + else if (IS_TYPE( i, PUNC ))
5177 + cp = "PUNC";
5178 + else if (IS_TYPE( i, NUM ))
5179 + cp = "NUM";
5180 + else if (IS_TYPE( i, A_CAP ))
5181 + cp = "A_CAP";
5182 + else if (IS_TYPE( i, ALPHA ))
5183 + cp = "ALPHA";
5184 + else if (IS_TYPE( i, B_CAPSYM ))
5185 + cp = "B_CAPSYM";
5186 + else if (IS_TYPE( i, B_SYM ))
5187 + cp = "B_SYM";
5188 +
5189 + len += sprintf (page + len, "%d\t%s\n", i, cp );
5190 + if (len + begin > off + count )
5191 + break;
5192 + if (len + begin < off ) {
5193 + begin += len;
5194 + len = 0;
5195 + }
5196 + }
5197 + if (i >= 256 )
5198 + *eof = 1;
5199 + if (off >= len + begin )
5200 + return 0;
5201 + *start = page + (off - begin );
5202 + return ((count < begin + len - off ) ? count : begin + len - off );
5203 +}
5204 +
5205 +static int
5206 +chartab_get_value (char* keyword)
5207 +{
5208 + int value = 0;
5209 +
5210 + if (!strcmp(keyword,"ALPHA"))
5211 + value = ALPHA;
5212 + else if (!strcmp(keyword,"B_CTL"))
5213 + value = B_CTL;
5214 + else if (!strcmp(keyword,"WDLM"))
5215 + value = WDLM;
5216 + else if (!strcmp(keyword,"A_PUNC"))
5217 + value = A_PUNC;
5218 + else if (!strcmp(keyword,"PUNC"))
5219 + value = PUNC;
5220 + else if (!strcmp(keyword,"NUM"))
5221 + value = NUM;
5222 + else if (!strcmp(keyword,"A_CAP"))
5223 + value = A_CAP;
5224 + else if (!strcmp(keyword,"B_CAPSYM"))
5225 + value = B_CAPSYM;
5226 + else if (!strcmp(keyword,"B_SYM"))
5227 + value = B_SYM;
5228 + return value;
5229 +}
5230 +
5231 +/* this is the write handler for /proc/speakup/silent */
5232 +static int
5233 +silent_write_proc (PROC_WRITE_PROTOTYPE )
5234 +{
5235 + struct vc_data *vc = vc_cons[fg_console].d;
5236 + char ch = 0, shut;
5237 + if (count > 0 || count < 3 ) {
5238 + get_user (ch, buffer );
5239 + if ( ch == '\n' ) ch = '0';
5240 + }
5241 + if ( ch < '0' || ch > '7' ) {
5242 + pr_warn ( "silent value not in range (0,7)\n" );
5243 + return count;
5244 + }
5245 + if ( (ch&2) ) {
5246 + shut = 1;
5247 + do_flush( );
5248 + } else shut = 0;
5249 + if ( (ch&4) ) shut |= 0x40;
5250 + if ( (ch&1) )
5251 + spk_shut_up |= shut;
5252 + else spk_shut_up &= ~shut;
5253 + return count;
5254 +}
5255 +
5256 +// this is the write handler for /proc/speakup/characters
5257 +static int
5258 +chars_write_proc (PROC_WRITE_PROTOTYPE )
5259 +{
5260 +#define max_desc_len 72
5261 + static int cnt = 0, state = 0;
5262 + static char desc[max_desc_len + 1];
5263 + static u_long jiff_last = 0;
5264 + short i = 0, num;
5265 + int len;
5266 + char ch, *cp, *p_new;
5267 + // reset certain vars if enough time has elapsed since last called
5268 + if (jiffies - jiff_last > 10 ) {
5269 + cnt = state = strings = rejects = updates = 0;
5270 + }
5271 + jiff_last = jiffies;
5272 +get_more:
5273 + desc[cnt] = '\0';
5274 + state = 0;
5275 + for (; i < count && state < 2; i++ ) {
5276 + get_user (ch, buffer + i );
5277 + if ( ch == '\n' ) {
5278 + desc[cnt] = '\0';
5279 + state = 2;
5280 + } else if (cnt < max_desc_len )
5281 + desc[cnt++] = ch;
5282 + }
5283 + if (state < 2 ) return count;
5284 + cp = desc;
5285 + while ( *cp && (unsigned char)(*cp) <= SPACE ) cp++;
5286 + if ((!cnt ) || strchr ("dDrR", *cp ) ) {
5287 + reset_default_chars ( );
5288 + pr_info( "character descriptions reset to defaults\n" );
5289 + cnt = 0;
5290 + return count;
5291 + }
5292 + cnt = 0;
5293 + if (*cp == '#' ) goto get_more;
5294 + num = -1;
5295 + cp = speakup_s2i(cp, &num );
5296 + while ( *cp && (unsigned char)(*cp) <= SPACE ) cp++;
5297 + if (num < 0 || num > 255 ) { // not in range
5298 + rejects++;
5299 + strings++;
5300 + goto get_more;
5301 + }
5302 + if (num >= 27 && num <= 31 ) goto get_more;
5303 + if (!strcmp(cp, characters[num] ) ) {
5304 + strings++;
5305 + goto get_more;
5306 + }
5307 + len = strlen(cp );
5308 + if (characters[num] == default_chars[num] )
5309 + p_new = (char * ) kmalloc (sizeof (char ) * len+1, GFP_KERNEL );
5310 + else if ( strlen(characters[num] ) >= len )
5311 + p_new = characters[num];
5312 + else {
5313 + kfree(characters[num] );
5314 + characters[num] = default_chars[num];
5315 + p_new = (char * ) kmalloc (sizeof (char ) * len+1, GFP_KERNEL );
5316 + }
5317 + if (!p_new ) return -ENOMEM;
5318 + strcpy ( p_new, cp );
5319 + characters[num] = p_new;
5320 + updates++;
5321 + strings++;
5322 + if (i < count ) goto get_more;
5323 + chars_stop_timer ( );
5324 + init_timer (&chars_timer );
5325 + chars_timer.function = show_char_results;
5326 + chars_timer.expires = jiffies + 5;
5327 + start_timer (chars_timer );
5328 + chars_timer_active++;
5329 + return count;
5330 +}
5331 +
5332 +// this is the write handler for /proc/speakup/chartab
5333 +static int
5334 +chartab_write_proc (PROC_WRITE_PROTOTYPE )
5335 +{
5336 +#define max_desc_len 72
5337 + static int cnt = 0, state = 0;
5338 + static char desc[max_desc_len + 1];
5339 + static u_long jiff_last = 0;
5340 + short i = 0, num;
5341 + char ch, *cp;
5342 + int value=0;
5343