/[linux-patches]/genpatches-2.6/trunk/2.6.18/4400_speakup-20060814.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.18/4400_speakup-20060814.patch

Parent Directory Parent Directory | Revision Log Revision Log


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