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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 582 - (show annotations) (download)
Sun Aug 6 19:00:56 2006 UTC (12 years, 2 months ago) by phreak
File size: 361197 byte(s)
Fixing 4400_speakup-20060618.patch for 2.6.18-rc4
1 Index: linux-2.6/Documentation/speakup/DefaultKeyAssignments
2 ===================================================================
3 --- /dev/null
4 +++ linux-2.6/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/Documentation/speakup/INSTALLATION
53 ===================================================================
54 --- /dev/null
55 +++ linux-2.6/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/Documentation/speakup/README
166 ===================================================================
167 --- /dev/null
168 +++ linux-2.6/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/Documentation/speakup/keymap-tutorial
269 ===================================================================
270 --- /dev/null
271 +++ linux-2.6/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/Documentation/speakup/spkguide.txt
414 ===================================================================
415 --- /dev/null
416 +++ linux-2.6/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/MAINTAINERS
1698 ===================================================================
1699 --- linux-2.6.orig/MAINTAINERS
1700 +++ linux-2.6/MAINTAINERS
1701 @@ -2724,6 +2724,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/arch/arm/Kconfig
1716 ===================================================================
1717 --- linux-2.6.orig/arch/arm/Kconfig
1718 +++ linux-2.6/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/drivers/Kconfig
1728 ===================================================================
1729 --- linux-2.6.orig/drivers/Kconfig
1730 +++ linux-2.6/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/drivers/Makefile
1741 ===================================================================
1742 --- linux-2.6.orig/drivers/Makefile
1743 +++ linux-2.6/drivers/Makefile
1744 @@ -26,6 +26,9 @@ obj-$(CONFIG_FB_INTEL) += video
1745
1746 obj-y += serial/
1747 obj-$(CONFIG_PARPORT) += parport/
1748 +obj-$(CONFIG_GAMEPORT) += input/gameport/
1749 +# load keyboard early so speakup can be quieted
1750 +obj-$(CONFIG_INPUT) += input/
1751 obj-y += base/ block/ misc/ mfd/ net/ media/
1752 obj-$(CONFIG_NUBUS) += nubus/
1753 obj-$(CONFIG_ATM) += atm/
1754 @@ -50,8 +53,6 @@ obj-$(CONFIG_USB) += usb/
1755 obj-$(CONFIG_PCI) += usb/
1756 obj-$(CONFIG_USB_GADGET) += usb/gadget/
1757 obj-$(CONFIG_SERIO) += input/serio/
1758 -obj-$(CONFIG_GAMEPORT) += input/gameport/
1759 -obj-$(CONFIG_INPUT) += input/
1760 obj-$(CONFIG_I2O) += message/
1761 obj-$(CONFIG_RTC_LIB) += rtc/
1762 obj-$(CONFIG_I2C) += i2c/
1763 Index: linux-2.6/drivers/char/Makefile
1764 ===================================================================
1765 --- linux-2.6.orig/drivers/char/Makefile
1766 +++ linux-2.6/drivers/char/Makefile
1767 @@ -89,6 +89,7 @@ obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.
1768 obj-$(CONFIG_TANBAC_TB0219) += tb0219.o
1769 obj-$(CONFIG_TELCLOCK) += tlclk.o
1770
1771 +obj-$(CONFIG_SPEAKUP) += speakup/
1772 obj-$(CONFIG_WATCHDOG) += watchdog/
1773 obj-$(CONFIG_MWAVE) += mwave/
1774 obj-$(CONFIG_AGP) += agp/
1775 Index: linux-2.6/drivers/char/consolemap.c
1776 ===================================================================
1777 --- linux-2.6.orig/drivers/char/consolemap.c
1778 +++ linux-2.6/drivers/char/consolemap.c
1779 @@ -667,3 +667,4 @@ console_map_init(void)
1780 }
1781
1782 EXPORT_SYMBOL(con_copy_unimap);
1783 +EXPORT_SYMBOL(inverse_translate);
1784 Index: linux-2.6/drivers/char/keyboard.c
1785 ===================================================================
1786 --- linux-2.6.orig/drivers/char/keyboard.c
1787 +++ linux-2.6/drivers/char/keyboard.c
1788 @@ -40,6 +40,13 @@
1789 #include <linux/input.h>
1790 #include <linux/reboot.h>
1791
1792 +
1793 +#include <linux/speakup.h>
1794 +
1795 +#ifdef CONFIG_SPEAKUP_MODULE
1796 +spk_key_func addr_spk_key = NULL;
1797 +#endif
1798 +
1799 static void kbd_disconnect(struct input_handle *handle);
1800 extern void ctrl_alt_del(void);
1801
1802 @@ -64,6 +71,10 @@ extern void ctrl_alt_del(void);
1803
1804 #define KBD_DEFLOCK 0
1805
1806 +/* Key types processed even in raw modes */
1807 +
1808 +#define TYPES_ALLOWED_IN_RAW_MODE ((1 << KT_SPEC) | (1 << KT_SHIFT) | (1 << KT_SPKUP))
1809 +
1810 void compute_shiftstate(void);
1811
1812 /*
1813 @@ -79,7 +90,7 @@ void compute_shiftstate(void);
1814 typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value,
1815 char up_flag, struct pt_regs *regs);
1816 static k_handler_fn K_HANDLERS;
1817 -static k_handler_fn *k_handler[16] = { K_HANDLERS };
1818 +k_handler_fn *k_handler[16] = { K_HANDLERS };
1819
1820 #define FN_HANDLERS\
1821 fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\
1822 @@ -100,7 +111,7 @@ static fn_handler_fn *fn_handler[] = { F
1823 const int max_vals[] = {
1824 255, ARRAY_SIZE(func_table) - 1, ARRAY_SIZE(fn_handler) - 1, NR_PAD - 1,
1825 NR_DEAD - 1, 255, 3, NR_SHIFT - 1, 255, NR_ASCII - 1, NR_LOCK - 1,
1826 - 255, NR_LOCK - 1, 255, NR_BRL - 1
1827 + 255, NR_LOCK - 1, 255, NR_BRL - 1, 255
1828 };
1829
1830 const int NR_TYPES = ARRAY_SIZE(max_vals);
1831 @@ -108,6 +119,9 @@ const int NR_TYPES = ARRAY_SIZE(max_vals
1832 struct kbd_struct kbd_table[MAX_NR_CONSOLES];
1833 static struct kbd_struct *kbd = kbd_table;
1834
1835 +EXPORT_SYMBOL(kbd);
1836 +EXPORT_SYMBOL(k_handler);
1837 +
1838 int spawnpid, spawnsig;
1839
1840 /*
1841 @@ -255,12 +269,14 @@ void kd_mksound(unsigned int hz, unsigne
1842 }
1843 }
1844 }
1845 - if (ticks)
1846 - mod_timer(&kd_mksound_timer, jiffies + ticks);
1847 + if (ticks)
1848 + mod_timer(&kd_mksound_timer, jiffies + ticks);
1849 } else
1850 kd_nosound(0);
1851 }
1852
1853 +EXPORT_SYMBOL(kd_mksound);
1854 +
1855 /*
1856 * Setting the keyboard rate.
1857 */
1858 @@ -613,6 +629,7 @@ static void k_spec(struct vc_data *vc, u
1859 if (up_flag)
1860 return;
1861 if (value >= ARRAY_SIZE(fn_handler))
1862 + if (up_flag || (value >= ARRAY_SIZE(fn_handler)))
1863 return;
1864 if ((kbd->kbdmode == VC_RAW ||
1865 kbd->kbdmode == VC_MEDIUMRAW) &&
1866 @@ -1224,6 +1241,13 @@ static void kbd_keycode(unsigned int key
1867 key_map = key_maps[shift_final];
1868
1869 if (!key_map) {
1870 +#ifdef CONFIG_SPEAKUP
1871 + if (speakup_key(vc, shift_final, keycode, K(KT_SHIFT,0), !down, regs ))
1872 + return;
1873 +#elif defined(CONFIG_SPEAKUP_MODULE)
1874 + if ( addr_spk_key && (*addr_spk_key)(vc, shift_final,
1875 + keycode, K(KT_SHIFT,0), !down, regs) ) return;
1876 +#endif
1877 compute_shiftstate();
1878 kbd->slockstate = 0;
1879 return;
1880 @@ -1246,8 +1270,15 @@ static void kbd_keycode(unsigned int key
1881 }
1882
1883 type -= 0xf0;
1884 +#ifdef CONFIG_SPEAKUP
1885 + if (speakup_key(vc, shift_final, keycode, keysym, !down, regs ))
1886 + return;
1887 +#elif defined(CONFIG_SPEAKUP_MODULE)
1888 + if ( addr_spk_key && (*addr_spk_key)(vc, shift_final,
1889 + keycode, keysym, !down, regs) ) return;
1890 +#endif
1891
1892 - if (raw_mode && type != KT_SPEC && type != KT_SHIFT)
1893 + if (raw_mode && type != KT_SPEC && type != KT_SHIFT )
1894 return;
1895
1896 if (type == KT_LETTER) {
1897 @@ -1258,13 +1289,29 @@ static void kbd_keycode(unsigned int key
1898 keysym = key_map[keycode];
1899 }
1900 }
1901 -
1902 (*k_handler[type])(vc, keysym & 0xff, !down, regs);
1903
1904 if (type != KT_SLOCK)
1905 kbd->slockstate = 0;
1906 }
1907
1908 +struct input_dev *fakekeydev=NULL;
1909 +
1910 +/*void kbd_fakekey(unsigned int keycode)
1911 +{
1912 + if (fakekeydev==NULL)
1913 + return;
1914 + kbd_keycode(keycode, 0, HW_RAW(fakekeydev), fakekeydev->regs);
1915 + kbd_keycode(keycode, 1, HW_RAW(fakekeydev), fakekeydev->regs);
1916 +
1917 + tasklet_schedule(&keyboard_tasklet);
1918 + do_poke_blanked_console = 1;
1919 + schedule_console_callback();
1920 +}
1921 +
1922 +EXPORT_SYMBOL(kbd_fakekey);*/
1923 +EXPORT_SYMBOL(fakekeydev);
1924 +
1925 static void kbd_event(struct input_handle *handle, unsigned int event_type,
1926 unsigned int event_code, int value)
1927 {
1928 @@ -1302,6 +1349,7 @@ static struct input_handle *kbd_connect(
1929 return NULL;
1930
1931 handle->dev = dev;
1932 + fakekeydev=dev;
1933 handle->handler = handler;
1934 handle->name = "kbd";
1935
1936 Index: linux-2.6/drivers/char/speakup/Config.in
1937 ===================================================================
1938 --- /dev/null
1939 +++ linux-2.6/drivers/char/speakup/Config.in
1940 @@ -0,0 +1,26 @@
1941 +tristate 'Speakup console speech' CONFIG_SPEAKUP
1942 +if [ "$CONFIG_SPEAKUP" != "n" ]; then
1943 + comment 'Type "y" for each synthesizer you want built into the kernel.'
1944 + dep_tristate "Accent SA, acntsa" CONFIG_SPEAKUP_ACNTSA $CONFIG_SPEAKUP
1945 + dep_tristate "Accent PC, acntpc" CONFIG_SPEAKUP_ACNTPC $CONFIG_SPEAKUP
1946 + dep_tristate "Apollo, apollo" CONFIG_SPEAKUP_APOLLO $CONFIG_SPEAKUP
1947 + dep_tristate "Audapter, audptr" CONFIG_SPEAKUP_AUDPTR $CONFIG_SPEAKUP
1948 + dep_tristate "Braille 'n' Speak, bns" CONFIG_SPEAKUP_BNS $CONFIG_SPEAKUP
1949 + dep_tristate "DECtalk Express, dectlk" CONFIG_SPEAKUP_DECTLK $CONFIG_SPEAKUP
1950 + dep_tristate "DECtalk External (old), decext" CONFIG_SPEAKUP_DECEXT $CONFIG_SPEAKUP
1951 + dep_tristate "DECtalk PC (big ISA card), decpc" CONFIG_SPEAKUP_DECPC $CONFIG_SPEAKUP
1952 + if [ "$CONFIG_SPEAKUP_DECPC" = "y" ] ;then
1953 + comment 'warning: decpc can only be built as a module'
1954 + fi
1955 + comment 'In order to use this you will need'
1956 + comment 'the dtload program and DECPC software files '
1957 + comment 'Read the accompanying DECPC documentation for more details'
1958 + dep_tristate "DoubleTalk PC, dtlk" CONFIG_SPEAKUP_DTLK $CONFIG_SPEAKUP
1959 + dep_tristate "Keynote Gold PC, keypc" CONFIG_SPEAKUP_KEYPC $CONFIG_SPEAKUP
1960 + dep_tristate "DoubleTalk LT or LiteTalk, ltlk" CONFIG_SPEAKUP_LTLK $CONFIG_SPEAKUP
1961 + dep_tristate "Software synthesizers /dev/sftsyn, sftsyn" CONFIG_SPEAKUP_SFTSYN $CONFIG_SPEAKUP
1962 + dep_tristate "Speak Out, spkout" CONFIG_SPEAKUP_SPKOUT $CONFIG_SPEAKUP
1963 + dep_tristate "Transport, txprt" CONFIG_SPEAKUP_TXPRT $CONFIG_SPEAKUP
1964 + comment 'Enter the three to six character synth string from above or none.'
1965 + string "Default synthesizer for Speakup" CONFIG_SPEAKUP_DEFAULT "none"
1966 +fi
1967 Index: linux-2.6/drivers/char/speakup/Kconfig
1968 ===================================================================
1969 --- /dev/null
1970 +++ linux-2.6/drivers/char/speakup/Kconfig
1971 @@ -0,0 +1,210 @@
1972 +menu "Speakup console speech"
1973 +config SPEAKUP
1974 + tristate "Build speakup console speech"
1975 + ---help---
1976 +
1977 + This is the Speakup screen reader. Think of it as a
1978 + video console for blind people. If built in to the
1979 + kernel, it can speak evrything on the text console from
1980 + boot up to shutdown. For more information on Speakup,
1981 + point your browser at http://www.linux-speakup.org/.
1982 + There is also a mailing list at the above url that you
1983 + can subscribe to.
1984 +
1985 + Supported synthesizers are accent sa, accent pc, appollo
1986 + II., Auddapter, Braille 'n Speak, Dectalk external
1987 + (old), Dectalk PC (full length isa board), Dectalk
1988 + express, Doubletalk, Doubletalk LT or Litetalk,
1989 + Keynote
1990 + Gold internal PC, software synthesizers, Speakout, and transport.
1991 +
1992 + Speakup can either be built in or compiled as a module
1993 + by answering y or m. If you answer y here, then you
1994 + must answer either y or m to at least one of the
1995 + synthesizer drivers below. If you answer m here, then
1996 + the synthesizer drivers below can only be built as
1997 + modules.
1998 +
1999 + These drivers are not standalone drivers, but must be
2000 + used in conjunction with Speakup. Think of them as
2001 + video cards for blind people.
2002 +
2003 +
2004 + The Dectalk pc driver can only be built as a module, and
2005 + requires software to be pre-loaded on to the card before
2006 + the module can be loaded. See the decpc choice below
2007 + for more details.
2008 +
2009 + If you are not a blind person, or don't have access to
2010 + one of the listed synthesizers, you should say n.
2011 +
2012 +config SPEAKUP_ACNTSA
2013 + depends on SPEAKUP
2014 + tristate "Accent SA, acntsa"
2015 + ---help---
2016 +
2017 + This is the Speakup driver for the accent sa
2018 + synthesizer. You can say y to build it into the kernel,
2019 + or m to build it as a module. See the configuration
2020 + help on the Speakup choice above for more info.
2021 +
2022 +config SPEAKUP_ACNTPC
2023 + depends on SPEAKUP
2024 + tristate "Accent PC, acntpc"
2025 + ---help---
2026 +
2027 + This is the Speakup driver for the accent pc
2028 + synthesizer. You can say y to build it into the kernel,
2029 + or m to build it as a module. See the configuration
2030 + help on the Speakup choice above for more info.
2031 +
2032 +config SPEAKUP_APOLLO
2033 + depends on SPEAKUP
2034 + tristate "Apollo, apollo"
2035 + ---help---
2036 +
2037 + This is the Speakup driver for the Apollo II
2038 + synthesizer. You can say y to build it into the kernel,
2039 + or m to build it as a module. See the configuration
2040 + help on the Speakup choice above for more info.
2041 +
2042 +config SPEAKUP_AUDPTR
2043 + depends on SPEAKUP
2044 + tristate "Audapter, audptr"
2045 + ---help---
2046 +
2047 + This is the Speakup driver for the Audapter synthesizer.
2048 + You can say y to build it into the kernel, or m to
2049 + build it as a module. See the configuration help on the
2050 + Speakup choice above for more info.
2051 +
2052 +config SPEAKUP_BNS
2053 + depends on SPEAKUP
2054 + tristate "Braille 'n' Speak, bns"
2055 + ---help---
2056 +
2057 + This is the Speakup driver for the Braille 'n' Speak
2058 + synthesizer. You can say y to build it into the kernel,
2059 + or m to build it as a module. See the configuration
2060 + help on the Speakup choice above for more info.
2061 +
2062 +config SPEAKUP_DECTLK
2063 + depends on SPEAKUP
2064 + tristate "DECtalk Express, dectlk"
2065 + ---help---
2066 +
2067 + This is the Speakup driver for the DecTalk Express
2068 + synthesizer. You can say y to build it into the kernel,
2069 + or m to build it as a module. See the configuration
2070 + help on the Speakup choice above for more info.
2071 +
2072 +config SPEAKUP_DECEXT
2073 + depends on SPEAKUP
2074 + tristate "DECtalk External (old), decext"
2075 + ---help---
2076 +
2077 + This is the Speakup driver for the DecTalk External
2078 + (old) synthesizer. You can say y to build it into the
2079 + kernel, or m to build it as a module. See the
2080 + configuration help on the Speakup choice above for more
2081 + info.
2082 +
2083 +config SPEAKUP_DECPC
2084 + depends on SPEAKUP
2085 + tristate "DECtalk PC (big ISA card), decpc"
2086 + ---help---
2087 +
2088 + This is the Speakup driver for the DecTalk PC (full
2089 + length ISA) synthesizer. You can say m to build it as
2090 + a module. See the configuration help on the Speakup
2091 + choice above for more info.
2092 +
2093 + In order to use the DecTalk PC driver, you must download
2094 + the dec_pc.tgz file from linux-speakup.org. It is in
2095 + the pub/linux/goodies directory. The dec_pc.tgz file
2096 + contains the software which must be pre-loaded on to the
2097 + DecTalk PC board in order to use it with this driver.
2098 + This driver must be built as a module, and can not be
2099 + loaded until the file system is mounted and the DecTalk
2100 + PC software has been pre-loaded on to the board.
2101 +
2102 + See the README file in the dec_pc.tgz file for more
2103 + details.
2104 +
2105 +config SPEAKUP_DTLK
2106 + depends on SPEAKUP
2107 + tristate "DoubleTalk PC, dtlk"
2108 + ---help---
2109 +
2110 + This is the Speakup driver for the internal DoubleTalk
2111 + PC 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_KEYPC
2117 + depends on SPEAKUP
2118 + tristate "Keynote Gold PC, keypc"
2119 + ---help---
2120 +
2121 + This is the Speakup driver for the Keynote Gold
2122 + PC synthesizer. You can say y to build it into the
2123 + kernel, or m to build it as a module. See the
2124 + configuration help on the Speakup choice above for more
2125 + info.
2126 +
2127 +config SPEAKUP_LTLK
2128 + depends on SPEAKUP
2129 + tristate "DoubleTalk LT or LiteTalk, ltlk"
2130 +---help---
2131 +
2132 + This is the Speakup driver for the LiteTalk/DoubleTalk
2133 + LT synthesizer. You can say y to build it into the
2134 + kernel, or m to build it as a module. See the
2135 + configuration help on the Speakup choice above for more
2136 + info.
2137 +
2138 +config SPEAKUP_SFTSYN
2139 + depends on SPEAKUP
2140 + tristate "Software synthesizers, sftsyn"
2141 +---help---
2142 +
2143 + This is the software synthesizer device node. It will
2144 + register a device /dev/sftsyn which midware programs
2145 + and speech
2146 + daemons may open and read to provide kernel output to
2147 + software synths
2148 + such as festival, flite, tuxtalk and so forth. You
2149 + can select 'y' or
2150 + 'm' to have it built-in to the kernel or loaded as a module.
2151 +
2152 +config SPEAKUP_SPKOUT
2153 + depends on SPEAKUP
2154 + tristate "Speak Out, spkout"
2155 + ---help---
2156 +
2157 + This is the Speakup driver for the Speakout synthesizer.
2158 + You can say y to build it into the kernel, or m to
2159 + build it as a module. See the configuration help on the
2160 + Speakup choice above for more info.
2161 +
2162 +config SPEAKUP_TXPRT
2163 + depends on SPEAKUP
2164 + tristate "Transport, txprt"
2165 + ---help---
2166 +
2167 + This is the Speakup driver for the Transport
2168 + synthesizer. You can say y to build it into the kernel,
2169 + or m to build it as a module. See the configuration
2170 + help on the Speakup choice above for more info.
2171 +
2172 +if SPEAKUP != n
2173 + comment 'Enter the 3 to 6 character keyword from the list above, or none for no default synthesizer on boot up.'
2174 + depends on SPEAKUP
2175 +endif
2176 +
2177 +config SPEAKUP_DEFAULT
2178 + string "Choose Default synthesizer for Speakup"
2179 + default "none"
2180 +
2181 +endmenu
2182 Index: linux-2.6/drivers/char/speakup/Makefile
2183 ===================================================================
2184 --- /dev/null
2185 +++ linux-2.6/drivers/char/speakup/Makefile
2186 @@ -0,0 +1,61 @@
2187 +#
2188 +# Makefile for the speakup speech output system.
2189 +#
2190 +
2191 +V := $(shell awk '/UTS_RELEASE/ {print substr($$3,2,3)}' $(TOPDIR)/include/linux/version.h)
2192 +ifeq ($V,2.4)
2193 +# Note! Dependencies are done automagically by 'make dep', which also
2194 +# removes any old dependencies. DON'T put your own dependencies here
2195 +# unless it's something special (ie not a .c file).
2196 +#
2197 +# Note 2! The CFLAGS definitions are now inherited from the
2198 +# parent makes..
2199 +#
2200 +O_TARGET := spk.o
2201 +export-objs := speakup_drvcommon.o speakup.o
2202 +endif
2203 +obj-m = speakup_keyhelp.o
2204 +speakupmain-objs := speakup.o speakup_drvcommon.o
2205 +obj-$(CONFIG_SPEAKUP) += speakupmain.o
2206 +obj-$(CONFIG_SPEAKUP_ACNTPC) += speakup_acntpc.o
2207 +obj-$(CONFIG_SPEAKUP_ACNTSA) += speakup_acntsa.o
2208 +obj-$(CONFIG_SPEAKUP_APOLLO) += speakup_apollo.o
2209 +obj-$(CONFIG_SPEAKUP_AUDPTR) += speakup_audptr.o
2210 +obj-$(CONFIG_SPEAKUP_BNS) += speakup_bns.o
2211 +obj-$(CONFIG_SPEAKUP_DECEXT) += speakup_decext.o
2212 +obj-$(CONFIG_SPEAKUP_DECPC) += speakup_decpc.o
2213 +obj-$(CONFIG_SPEAKUP_DECTLK) += speakup_dectlk.o
2214 +obj-$(CONFIG_SPEAKUP_DTLK) += speakup_dtlk.o
2215 +obj-$(CONFIG_SPEAKUP_KEYPC) += speakup_keypc.o
2216 +obj-$(CONFIG_SPEAKUP_LTLK) += speakup_ltlk.o
2217 +obj-$(CONFIG_SPEAKUP_SFTSYN) += speakup_sftsyn.o
2218 +obj-$(CONFIG_SPEAKUP_SPKOUT) += speakup_spkout.o
2219 +obj-$(CONFIG_SPEAKUP_TXPRT) += speakup_txprt.o
2220 +
2221 +ifeq ($V,2.4)
2222 + include $(TOPDIR)/Rules.make
2223 +
2224 +speakupmap.h: speakupmap.map genmap
2225 + ./genmap speakupmap.map >$@
2226 +
2227 +genmap: genmap.c mapdata.h
2228 + cc -o genmap genmap.c
2229 +
2230 +mapdata.h: makemapdata.c keyinfo.h
2231 + cc -o makemapdata makemapdata.c
2232 + ./makemapdata >mapdata.h
2233 +
2234 +endif
2235 +speakupmain.o:speakup.o speakup_drvcommon.o
2236 + ld -r -o speakupmain.o speakup.o speakup_drvcommon.o
2237 +
2238 +$(obj)/speakupmap.h: $(src)/speakupmap.map $(src)/genmap
2239 + $(src)/genmap $(src)/speakupmap.map >$@
2240 +
2241 +$(obj)/mapdata.h: $(src)/keyinfo.h $(src)/makemapdata
2242 + $(src)/makemapdata >$@
2243 +
2244 +$(obj)/genmap: $(obj)/mapdata.h
2245 +
2246 +HOSTCFLAGS := -Iinclude -I/usr/include
2247 +hostprogs-y := makemapdata genmap
2248 Index: linux-2.6/drivers/char/speakup/cvsversion.h
2249 ===================================================================
2250 --- /dev/null
2251 +++ linux-2.6/drivers/char/speakup/cvsversion.h
2252 @@ -0,0 +1 @@
2253 +#define CVSVERSION " CVS: Mon May 1 09:46:33 EDT 2006 "
2254 Index: linux-2.6/drivers/char/speakup/dtload.c
2255 ===================================================================
2256 --- /dev/null
2257 +++ linux-2.6/drivers/char/speakup/dtload.c
2258 @@ -0,0 +1,554 @@
2259 +/*
2260 + * This is the DECtalk PC firmware loader for the Linux kernel, version 1.0
2261 + *
2262 + * Original 386BSD source:
2263 + * Copyright ( c ) 1996 Brian Buhrow <buhrow@lothlorien.nfbcal.org>
2264 + *
2265 + * Adapted for Linux:
2266 + * Copyright ( c ) 1997 Nicolas Pitre <nico@cam.org>
2267 + *
2268 + * Adapted for speakup:
2269 + * Copyright ( c ) 2003 David Borowski <david575@golden.net>
2270 + *
2271 + * All rights reserved.
2272 + *
2273 + * This program is free software; you can redistribute it and/or modify
2274 + * it under the terms of the GNU General Public License as published by
2275 + * the Free Software Foundation; either version 2 of the License, or
2276 + * ( at your option ) any later version.
2277 + *
2278 + * This program is distributed in the hope that it will be useful,
2279 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2280 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2281 + * GNU General Public License for more details.
2282 + *
2283 + * You should have received a copy of the GNU General Public License
2284 + * along with this program; if not, write to the Free Software
2285 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2286 + *
2287 + */
2288 +
2289 +#include <stdio.h>
2290 +#include <stdlib.h>
2291 +#include <unistd.h>
2292 +#include <string.h>
2293 +#include <sys/types.h>
2294 +#include <sys/stat.h>
2295 +#include <fcntl.h>
2296 +#include <malloc.h>
2297 +#include <sys/errno.h>
2298 +#include <asm/io.h>
2299 +#include "dtload.h"
2300 +#include "dtpc_reg.h"
2301 +
2302 +#define dt_delay(x) usleep(x)
2303 +int verbose = 0, intest = 0,infd = -1;
2304 +int image_len, total_paras;
2305 +int dt_stat, dma_state = 0, has_kernel = 0;
2306 +struct dos_reloc fixups[512];
2307 +char *read_buff = NULL;
2308 +struct dos_exe_header header;
2309 +u_short iobase = 0x350;
2310 +
2311 +static inline int dt_getstatus( )
2312 +{
2313 + dt_stat = inb_p( iobase )|(inb_p( iobase+1 )<<8);
2314 + return dt_stat;
2315 +}
2316 +
2317 +static void dt_sendcmd( u_int cmd )
2318 +{
2319 + outb_p( cmd & 0xFF, iobase );
2320 + outb_p( (cmd>>8) & 0xFF, iobase+1 );
2321 +}
2322 +
2323 +static int dt_waitbit( int bit )
2324 +{
2325 + int timeout = 100;
2326 + while ( --timeout > 0 ) {
2327 + if( (dt_getstatus( ) & bit ) == bit ) return 1;
2328 + usleep( 1000 );
2329 + }
2330 + return 0;
2331 +}
2332 +
2333 +static int dt_sendcmd_wait( u_int cmd, int bit )
2334 +{
2335 + int timeout = 1000;
2336 + outb_p( cmd & 0xFF, iobase );
2337 + outb_p( (cmd>>8) & 0xFF, iobase+1 );
2338 + while ( --timeout > 0 ) {
2339 + if( (dt_getstatus( ) & bit ) == bit ) return 1;
2340 + usleep( 1000 );
2341 + }
2342 + return 0;
2343 +}
2344 +
2345 +static int dt_waitmode( int pattern )
2346 +{
2347 + int timeout = 1000;
2348 + while ( --timeout > 0 ) {
2349 + if( dt_getstatus( ) == pattern ) return 1;
2350 + usleep( 1000 );
2351 + }
2352 + fprintf( stderr, "waitmode p=%x s = %x\n", pattern, dt_stat );
2353 + return 0;
2354 +}
2355 +
2356 +static int dt_wait_dma( )
2357 +{
2358 + int timeout = 1000, state = dma_state;
2359 + if( !has_kernel ){
2360 + dt_delay( 500 );
2361 + return( dt_waitbit( STAT_dma_ready ) );
2362 + }
2363 + if( ! dt_waitbit( STAT_dma_ready ) ) return 0;
2364 + while ( --timeout > 0 ) {
2365 + if( (dt_getstatus()&STAT_dma_state) == state ) return 1;
2366 + usleep( 1000 );
2367 + }
2368 + dma_state = dt_getstatus( ) & STAT_dma_state;
2369 + return 1;
2370 +}
2371 +
2372 +dt_ctrl( u_int cmd )
2373 +{
2374 + while ( ! dt_waitbit( STAT_cmd_ready ) ) dt_delay( 100 );
2375 + outb_p( 0, iobase+2 );
2376 + outb_p( 0, iobase+3 );
2377 + dt_getstatus( );
2378 + dt_sendcmd( CMD_control|cmd );
2379 + outb_p( 0, iobase+6 );
2380 + dt_delay( 100 );
2381 + dt_sendcmd( CMD_null );
2382 + while ( ! dt_waitbit( STAT_cmd_ready ) ) dt_delay( 100 );
2383 +}
2384 +
2385 +int dt_flush( void )
2386 +{
2387 + dt_ctrl( CTRL_flush );
2388 + dt_waitbit( STAT_dma_ready );
2389 + outb_p( DMA_sync, iobase+4 );
2390 + outb_p( 0, iobase+4 );
2391 + dma_state ^= STAT_dma_state;
2392 + while( dt_getstatus( ) & STAT_flushing ) dt_delay( 100 );
2393 + return 0;
2394 +}
2395 +
2396 +static int dt_sendbuff( char *src, int len )
2397 +{
2398 + while( len-- ){
2399 + if( ! dt_wait_dma( ) ) return -1;
2400 + if( ! (dt_getstatus( ) & STAT_rr_char) ) break;
2401 + outb_p( DMA_single_in, iobase+4 );
2402 + outb_p( *src++, iobase+4 );
2403 + dma_state ^= STAT_dma_state;
2404 + }
2405 + return 0;
2406 +}
2407 +
2408 +unsigned long dt_allocmem( unsigned long paras )
2409 +{
2410 + unsigned long addr;
2411 + if( ! dt_wait_dma( ) ) return 0;
2412 + outb_p( DMA_control, iobase+4 );
2413 + outb_p( DT_MEM_ALLOC, iobase+4 );
2414 + dma_state ^= STAT_dma_state;
2415 + if( ! dt_wait_dma( ) ) return 0;
2416 + outb_p( paras & 0xFF, iobase+4 );
2417 + outb_p( (paras>>8) & 0xFF, iobase+4 );
2418 + dma_state ^= STAT_dma_state;
2419 + if( ! dt_wait_dma( ) ) return 0;
2420 + addr = inb_p( iobase+4 );
2421 + addr |= (inb_p( iobase+4 )<<8);
2422 + addr += (inb_p( iobase+4 )<<4);
2423 + addr += (inb_p( iobase+4 )<<12);
2424 + dma_state ^= STAT_dma_state;
2425 + return addr;
2426 +}
2427 +
2428 +static int testkernel( void )
2429 +{
2430 + dt_sendcmd( CMD_sync );
2431 + if( ! dt_waitbit( STAT_cmd_ready ) ) return -10;
2432 + has_kernel = ( dt_stat&0x8000 ) ? 1 : 0;
2433 + if ( verbose ) printf( "testkernel got %x\n", dt_stat );
2434 + if ( has_kernel ) return 0;
2435 + dt_delay( 100 );
2436 + return 1;
2437 +}
2438 +
2439 +static int dt_loadmem( int addr, int len, char *src )
2440 +{
2441 + char c;
2442 + int l;
2443 + if ( verbose ) printf( "dt_loadmem: addr = %08X size = %d\n", addr, len );
2444 + do {
2445 + l = len;
2446 + if ( l >= 0xc000 ) l = 0xc000;
2447 + len -= l;
2448 + if( ! dt_wait_dma( ) ) return -1;
2449 + outb_p( DMA_control, iobase+4 );
2450 + outb_p( DT_LOAD_MEM, iobase+4 );
2451 + dma_state ^= STAT_dma_state;
2452 + if( ! dt_wait_dma( ) ) return -2;
2453 + outb_p( addr & 0xFF, iobase+4 );
2454 + outb_p( (addr>>8) & 0xFF, iobase+4 );
2455 + outb_p( (addr>>16) & 0xFF, iobase+4 );
2456 + outb_p( (addr>>24) & 0xFF, iobase+4 );
2457 + outb_p( l & 0xFF, iobase+4 );
2458 + outb_p( (l>>8) & 0xFF, iobase+4 );
2459 + dma_state ^= STAT_dma_state;
2460 + if( ! dt_wait_dma( ) ) return -3;
2461 + addr += l;
2462 + while( l-- ){
2463 + c = *src++;
2464 + outb_p( c, iobase+4 );
2465 + }
2466 + dma_state ^= STAT_dma_state;
2467 + } while ( len > 0 );
2468 + return 0;
2469 +}
2470 +
2471 +unsigned int loadfile ( char *filename )
2472 +{
2473 + int i, header_size;
2474 + unsigned int total_paras;
2475 + long fix;
2476 + infd = open ( filename, O_RDONLY );
2477 + if ( infd == -1 ) {
2478 + perror ( "Opening file: " );
2479 + return 0;
2480 + }
2481 + read ( infd, &header, sizeof ( struct dos_exe_header ) );
2482 + if ( header.id != 0x5a4d ) {
2483 + fprintf ( stderr, "Invalid header file format\n" );
2484 + fprintf ( stderr, "Want 0x5a4d, got 0x%x\n", header.id );
2485 + return 0;
2486 + }
2487 + if ( header.relen > MAX_FIXUPS ) {
2488 + fprintf ( stderr, "Too many fixups\n" );
2489 + return 0;
2490 + }
2491 + lseek ( infd, ( long ) header.reloc, SEEK_SET );
2492 + read ( infd, fixups, sizeof ( struct dos_reloc ) * header.relen );
2493 + header_size = header.hsize * 16;
2494 + lseek ( infd, ( long )header_size, SEEK_SET );
2495 + image_len = ( ( header.pages-1 )*512 ) + ( header.rem- header_size );
2496 + total_paras = ( image_len >> 4 ) + header.hmin + 16;
2497 + read ( infd, read_buff, image_len );
2498 + close( infd );
2499 + return total_paras;
2500 +}
2501 +
2502 +static int loadkernel( char *filename )
2503 +{
2504 + int segfix = 0x40, fix, i;
2505 + int ipval, csval;
2506 + if ( has_kernel ) return 0;
2507 + if ( !loadfile( filename ) ) return -1;
2508 + header.csval += segfix;
2509 + header.ssval += segfix;
2510 + if ( verbose ) {
2511 + printf ( "Loading kernel of %ld bytes ( %d relocs )\n",
2512 + image_len, header.relen );
2513 + printf ( " cs:ip == %04x:%04x ss:sp == %04x:%04x\n",
2514 + header.csval, header.ipval, header.ssval, header.spval );
2515 + }
2516 + for ( i = 0; i < header.relen; i++ ) {
2517 + fix = ( fixups[i].segment << 4 ) + fixups[i].offset;
2518 + ( *( unsigned int * ) &read_buff[fix] ) += segfix;
2519 + }
2520 + csval = header.csval;
2521 + ipval = header.ipval;
2522 + dt_sendcmd_wait( MODULE_reset, MODULE_init );
2523 + dt_sendcmd( CMD_reset );
2524 + if( dt_getstatus( ) == MODULE_self_test ){
2525 + if( ! dt_waitmode( MODULE_init ) ) return -1;
2526 + }
2527 + if ( !dt_sendcmd_wait( CMD_reset, MODE_status ) ) return -2;
2528 + if ( !dt_sendcmd_wait( CMD_sync, MODE_error ) ) return -3;
2529 + if ( !dt_sendcmd_wait( CMD_reset, MODE_status ) ) return -4;
2530 + if ( verbose ) printf( "card is ready\n" );
2531 + dt_sendcmd( CMD_dma );
2532 + if( ! dt_waitbit( STAT_dma_ready ) ) return -5;
2533 + if( ( i = dt_loadmem( 0x00000400, image_len, read_buff ) ) ) {
2534 + fprintf( stderr, "kernel load failed, status %d\n", i );
2535 + return -6;
2536 + }
2537 + dt_delay( 100 );
2538 + /* the kernel is loaded, start it */
2539 + if ( !dt_sendcmd_wait( CMD_reset, MODE_status ) ) return -7;
2540 + dt_sendcmd( CMD_dma+1 ); /**xxx**/
2541 + dt_delay( 100 );
2542 + if( ! dt_waitbit( STAT_dma_ready ) ) return-8;
2543 + outb_p( DMA_control, iobase+4 );
2544 + outb_p( DT_START_TASK, iobase+4 );
2545 + dt_delay( 100 );
2546 + outb_p( ipval & 0xFF, iobase+4 );
2547 + outb_p( (ipval>>8) & 0xFF, iobase+4 );
2548 + outb_p( csval & 0xFF, iobase+4 );
2549 + outb_p( (csval>>8) & 0xFF, iobase+4 );
2550 + if( ! dt_waitmode( 0xc001 ) ) return -9;
2551 + if ( verbose ) {
2552 + printf( "done loading kernel\n" );
2553 + }
2554 + return testkernel( );
2555 +}
2556 +
2557 +int loaddict ( char *filename, char *name, int type )
2558 +{
2559 + int i, read_index, read_size, act_size;
2560 + unsigned short *index_fix, seg_fix;
2561 + unsigned long entries, index, dic_bytes, dic_addr;
2562 + unsigned int total_paras;
2563 + unsigned long param, l;
2564 + infd = open ( filename, O_RDONLY );
2565 + if ( infd == -1 ) {
2566 + perror ( filename );
2567 + return -1;
2568 + }
2569 +/* read in the entry count and the actual entry size excluding the
2570 + * index table ( which is entries * 4 ) ... */
2571 + read ( infd, &entries, 4 );
2572 + read ( infd, &dic_bytes, 4 );
2573 + if ( verbose )
2574 + printf ( "Loading %s dictionary of %lu entries, %lu bytes.\n",
2575 + name, entries, dic_bytes );
2576 + total_paras = ( ( ( entries * 4 ) + dic_bytes ) >> 4 ) + 2;
2577 + if ( verbose )
2578 + printf ( "Allocating %d paragraphs of free ram ...\n", total_paras );
2579 + l = dt_allocmem( total_paras );
2580 + if ( l == 0 ) {
2581 + perror ( "Error requesting memory from speech device" );
2582 + return -1;
2583 + }
2584 + seg_fix = ( l >> 4 ) & 0xffff;
2585 + dic_addr = l;
2586 + index = entries;
2587 + index_fix = ( unsigned short * ) &read_buff[0];
2588 + if ( verbose )
2589 + printf ( "Index table starts at %lx\n", l );
2590 + read_index = index*4;
2591 + act_size = read ( infd, read_buff, read_index );
2592 + if ( act_size != read_index ) {
2593 + fprintf ( stderr, "\nError reading indexes\n" );
2594 + fprintf ( stderr, " exp : %d act : %d\n", read_index * 4, act_size );
2595 + return -1;
2596 + }
2597 + for ( i = 1; i < index * 2; i += 2 )
2598 + index_fix[i] += seg_fix;
2599 + if( ( i = dt_loadmem( l, read_index, read_buff ) ) ) {
2600 + fprintf ( stderr, "\nError loading indexes at 0x%lX: i %d\n",
2601 + l, i );
2602 + return -1;
2603 + }
2604 + l += read_index;
2605 +/* now, load up the dictionary bytes ... */
2606 + if ( verbose )
2607 + printf ( "Dictionary text starts at %lx\n", l );
2608 + read_size = dic_bytes;
2609 + if ( ( act_size = read ( infd, read_buff, read_size ) ) != read_size ) {
2610 + fprintf ( stderr, "\nError reading dictionary text!\n" );
2611 + fprintf ( stderr, "asked : %d actual : %d\n", act_size, read_size );
2612 + return -1;
2613 + }
2614 + if( ( i = dt_loadmem( l, read_size, read_buff ) ) ) {
2615 + fprintf ( stderr, "\nError loading dictionary at 0x%lX: status %d\n",
2616 + l, i );
2617 + return -1;
2618 + }
2619 + if( ! dt_wait_dma( ) ) return -1;
2620 + outb_p( DMA_control, iobase+4 );
2621 + outb_p( DT_SET_DIC, iobase+4 );
2622 + dma_state ^= STAT_dma_state;
2623 + if( ! dt_wait_dma( ) ) return -1;
2624 + l = dic_addr;
2625 + l = ((l << 12) & 0xFFFF0000) + (l & 0x0000000F);
2626 + outb_p( l & 0xFF, iobase+4 );
2627 + outb_p( (l>>8) & 0xFF, iobase+4 );
2628 + outb_p( (l>>16) & 0xFF, iobase+4 );
2629 + outb_p( (l>>24) & 0xFF, iobase+4 );
2630 + l = entries;
2631 + outb_p( l & 0xFF, iobase+4 );
2632 + outb_p( (l>>8) & 0xFF, iobase+4 );
2633 + outb_p( (l>>16) & 0xFF, iobase+4 );
2634 + outb_p( (l>>24) & 0xFF, iobase+4 );
2635 + l = type;
2636 + outb_p( l & 0xFF, iobase+4 );
2637 + outb_p( (l>>8) & 0xFF, iobase+4 );
2638 + dma_state ^= STAT_dma_state;
2639 + close ( infd );
2640 + if ( verbose ) printf( "dictionary load complete\n" );
2641 + return 0;
2642 +}
2643 +
2644 +int loadexe ( char *filename )
2645 +{
2646 + unsigned int load_addr = 0, seg_fix;
2647 + int i, read_size;
2648 + int ipval, csval;
2649 + long fix;
2650 + unsigned long total_paras;
2651 + total_paras = loadfile ( filename );
2652 + if ( total_paras == 0 ) return -1;
2653 + load_addr = dt_allocmem( total_paras );
2654 + if ( load_addr == 0 ) {
2655 + fprintf ( stderr, "Error allocating memory on card: " );
2656 + return -1;
2657 + }
2658 + seg_fix = ( load_addr >> 4 ) & 0xffff;
2659 + if ( verbose ) {
2660 + printf ( "Loading %s %ld bytes ( %d relocs )\n",
2661 + filename, image_len, header.relen );
2662 + printf ( "Allocating %ld bytes of free ram at %05x\n",
2663 + ( long ) header.hmin * 16, load_addr );
2664 + printf ( "Total memory taken is %ld bytes\n", ( long ) total_paras * 16 );
2665 + printf ( " cs:ip == %04x:%04x ss:sp == %04x:%04x\n",
2666 + header.csval + seg_fix, header.ipval, header.ssval + seg_fix, header.spval );
2667 + }
2668 + for ( i = 0; i < header.relen; i++ ) {
2669 + fix = ( ( long ) fixups[i].segment << 4 ) + ( long ) fixups[i].offset;
2670 + ( *( unsigned int * ) &read_buff[fix] ) += seg_fix;
2671 + }
2672 + if( ( i = dt_loadmem( load_addr, image_len, read_buff ) ) ) {
2673 + fprintf ( stderr, "Error loading speech device at 0x%lX: status %d\n",
2674 + load_addr, i );
2675 + return -1;
2676 + }
2677 + csval = header.csval + seg_fix;
2678 + ipval = header.ipval;
2679 + if( ! dt_wait_dma( ) ) return -1;
2680 + outb_p( DMA_control, iobase+4 );
2681 + outb_p( DT_START_TASK, iobase+4 );
2682 + dma_state ^= STAT_dma_state;
2683 + if( ! dt_wait_dma( ) ) return -1;
2684 + outb_p( ipval & 0xFF, iobase+4 );
2685 + outb_p( (ipval>>8) & 0xFF, iobase+4 );
2686 + outb_p( csval & 0xFF, iobase+4 );
2687 + outb_p( (csval>>8) & 0xFF, iobase+4 );
2688 + dma_state ^= STAT_dma_state;
2689 + return 0;
2690 +}
2691 +
2692 +void release_io( void )
2693 +{
2694 + ioperm( (long)iobase, 8, 0 );
2695 + ioperm( (long)0x0080, 1, 0 );
2696 + if ( read_buff ) free( read_buff );
2697 +}
2698 +
2699 +parseparm( char *parm, char *value )
2700 +{
2701 + char *cp = parm+strlen( parm );
2702 + while ( --cp > parm ) if ( *cp > ' ' ) break;
2703 + cp[1] = '\0';
2704 + if ( !strcmp( parm, "io" ) ) {
2705 + long io = strtol( value, 0, 0 );
2706 + if ( io >= 0x100 && io <= 0x350 ) {
2707 + iobase = (u_short)io;
2708 + return;
2709 + }
2710 + fprintf( stderr, "invalid io value %s\n", value );
2711 + exit( 1 );
2712 + } else if ( !strcmp( parm,"verbose" ) ) {
2713 + verbose = atoi( value );
2714 + }
2715 +}
2716 +
2717 +do_test( void )
2718 +{
2719 + char buffer[512];
2720 + int len;
2721 + dma_state = dt_getstatus( ) & STAT_dma_state;
2722 + while ( fgets( buffer, 510, stdin ) ) {
2723 + len = strlen( buffer );
2724 + if ( len == 1 ) dt_flush( );
2725 + else {
2726 + if ( buffer[len-1] == '\n' ) buffer[len-1] = '\013';
2727 + dt_sendbuff( buffer, len );
2728 + }
2729 + }
2730 + *buffer = '\013';
2731 + dt_sendbuff( buffer, 1 );
2732 +}
2733 +
2734 +int main ( int argc, char **argv )
2735 +{
2736 + char name[80], *cp;
2737 + char *dirname = 0, *confname = "dec_pc.conf";
2738 + char *init_msg = "[:ra 360] dec pc initialized\011";
2739 + FILE *confile;
2740 + struct stat statbuf;
2741 + int maxsize = 0, status = 0;
2742 + while ( --argc > 0 ) {
2743 + argv++;
2744 + if ( !strcmp( *argv, "-v" ) ) verbose = 1;
2745 + else if ( !strcmp( *argv, "-t" ) ) intest = 1;
2746 + else dirname = *argv;
2747 + }
2748 + if ( !dirname ) dirname = "/usr/local/lib/dec_pc";
2749 + if ( chdir( dirname ) != 0 ) {
2750 + fprintf( stderr, "cannot chdir to %s\n", dirname );
2751 + exit( 1 );
2752 + }
2753 + if ( !( confile = fopen( confname, "r" ) ) ) {
2754 + fprintf( stderr, "could not open %s", confname );
2755 + exit( 1 );
2756 + }
2757 + while ( fgets( name, 80, confile ) ) {
2758 + cp = strchr( name, '\n' );
2759 + if ( cp ) *cp = '\0';
2760 + if ( ( cp = strchr( name, '=' ) ) ) {
2761 + *cp++ = '\0';
2762 + parseparm( name, cp );
2763 + continue;
2764 + }
2765 + if ( stat( name, &statbuf ) != 0 ) {
2766 + fprintf( stderr, "cannot stat %s\n", name );
2767 + exit( 1 );
2768 + }
2769 + if ( statbuf.st_size > maxsize ) maxsize = statbuf.st_size;
2770 + }
2771 + rewind( confile );
2772 + if ( ioperm( (long)0x0080, 1, 1 ) || ioperm( (long)iobase, 8, 1 ) ) {
2773 + fprintf( stderr, "could not get ioperm\n" );
2774 + exit( 1 );
2775 + }
2776 + atexit( release_io );
2777 + if ( testkernel( ) == 0 ) {
2778 + if ( intest ) do_test( );
2779 + else fprintf( stderr, "kernel already loaded\n" );
2780 + exit( 0 );
2781 + }
2782 + read_buff = malloc( maxsize );
2783 + if ( !read_buff ) {
2784 + fprintf( stderr, "cannot malloc %d bytes\n", maxsize );
2785 + exit( 1 );
2786 + }
2787 + while ( fgets( name, 80, confile ) && !status ) {
2788 + cp = strchr( name, '\n' );
2789 + if ( cp ) *cp = '\0';
2790 + if ( strchr( name, '=' ) ) continue; /* a parameter */
2791 + if ( !( cp = strchr( name, '.' ) ) ) continue;
2792 + cp++;
2793 + if ( !strcmp ( cp, "dic" ) ) {
2794 + status = loaddict ( name, "primary", PRIMARY_DIC );
2795 + } else if ( !strcmp ( cp, "dtu" ) ) {
2796 + status = loaddict ( name, "user", USER_DIC );
2797 + } else if ( !strcmp ( cp, "dta" ) ) {
2798 + status = loaddict ( name, "abbreviation file", ABBREV_DIC );
2799 + } else if ( !strcmp ( cp, "exe" ) ) {
2800 + status = loadexe ( name );
2801 + } else if ( !strcmp ( cp, "sys" ) ) {
2802 + status = loadkernel ( name );
2803 + }
2804 + }
2805 + if ( status ) fprintf( stderr, "status %d\n", status );
2806 + fclose( confile );
2807 + if ( status ) exit( status );
2808 + dt_sendbuff( init_msg, strlen( init_msg ) );
2809 + sleep( 1 );
2810 + if ( intest ) do_test( );
2811 + exit( 0 );
2812 +}
2813 Index: linux-2.6/drivers/char/speakup/dtload.h
2814 ===================================================================
2815 --- /dev/null
2816 +++ linux-2.6/drivers/char/speakup/dtload.h
2817 @@ -0,0 +1,57 @@
2818 +/*
2819 + * This is the DECtalk PC firmware loader for the Linux kernel, version 1.0
2820 + *
2821 + * Original 386BSD source:
2822 + * Copyright (c) 1996 Brian Buhrow <buhrow@lothlorien.nfbcal.org>
2823 + *
2824 + * Adapted for Linux:
2825 + * Copyright (c) 1997 Nicolas Pitre <nico@cam.org>
2826 + *
2827 + * Adapted for speakup:
2828 + * Copyright (c) 2003 David Borowski <david575@golden.net>
2829 + *
2830 + * All rights reserved.
2831 + *
2832 + * This program is free software; you can redistribute it and/or modify
2833 + * it under the terms of the GNU General Public License as published by
2834 + * the Free Software Foundation; either version 2 of the License, or
2835 + * (at your option) any later version.
2836 + *
2837 + * This program is distributed in the hope that it will be useful,
2838 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2839 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2840 + * GNU General Public License for more details.
2841 + *
2842 + * You should have received a copy of the GNU General Public License
2843 + * along with this program; if not, write to the Free Software
2844 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2845 + *
2846 + */
2847 +
2848 +#define MAX_FIXUPS 512 /* maximum fixups per exe */
2849 +/*
2850 + * msdos .exe files will look like ...
2851 + */
2852 +
2853 +struct dos_exe_header {
2854 + unsigned short id; /* Linker's signature, must be 0x5a4d */
2855 + unsigned short rem; /* length of image mod 512 */
2856 + unsigned short pages; /* length of image in pages of 512 bytes */
2857 + unsigned short relen; /* number of relocation items */
2858 + unsigned short hsize; /* header size in paragraphs of 16 bytes */
2859 + unsigned short hmin; /* min # of paragraphs above prog end */
2860 + unsigned short hmax;
2861 + unsigned short ssval;
2862 + unsigned short spval; /* to be loaded in sp */
2863 + unsigned short checksum;
2864 + unsigned short ipval; /* to be loaded in ip */
2865 + unsigned short csval; /* segment offset to code */
2866 + unsigned short reloc; /* location of relocation items */
2867 + unsigned short ovrlay; /* overlay number */
2868 +};
2869 +
2870 +/* a dos relocation element looks like */
2871 +
2872 +struct dos_reloc {
2873 + short int offset, segment;
2874 +};
2875 Index: linux-2.6/drivers/char/speakup/dtpc_reg.h
2876 ===================================================================
2877 --- /dev/null
2878 +++ linux-2.6/drivers/char/speakup/dtpc_reg.h
2879 @@ -0,0 +1,132 @@
2880 +/*
2881 + * This is the DECtalk PC register constants (from DEC's DOS driver)
2882 + *
2883 + * Original code:
2884 + * Copyright (c) by Digital Equipment Corp.
2885 + *
2886 + * 386BSD DECtalk PC driver:
2887 + * Copyright (c) 1996 Brian Buhrow <buhrow@lothlorien.nfbcal.org>
2888 + *
2889 + * Linux DECtalk PC driver:
2890 + * Copyright (c) 1997 Nicolas Pitre <nico@cam.org>
2891 + *
2892 + * speakup DECtalk PC driver:
2893 + * Copyright (c) 2003 David Borowski <david575@golden.net>
2894 + *
2895 + * All rights reserved.
2896 + *
2897 + * This program is free software; you can redistribute it and/or modify
2898 + * it under the terms of the GNU General Public License as published by
2899 + * the Free Software Foundation; either version 2 of the License, or
2900 + * (at your option) any later version.
2901 + *
2902 + * This program is distributed in the hope that it will be useful,
2903 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2904 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2905 + * GNU General Public License for more details.
2906 + *
2907 + * You should have received a copy of the GNU General Public License
2908 + * along with this program; if not, write to the Free Software
2909 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2910 + *
2911 + */
2912 +
2913 +/*
2914 + * port interface defs ... used by dtpc.c
2915 + */
2916 +
2917 +#define MODULE_init 0x0dec /* module in boot code */
2918 +#define MODULE_self_test 0x8800 /* module in self-test */
2919 +#define MODULE_reset 0xffff /* reinit the whole module */
2920 +
2921 +#define MODE_mask 0xf000 /* mode bits in high nibble */
2922 +#define MODE_null 0x0000
2923 +#define MODE_test 0x2000 /* in testing mode */
2924 +#define MODE_status 0x8000
2925 +#define STAT_int 0x0001 /* running in interrupt mode */
2926 +#define STAT_tr_char 0x0002 /* character data to transmit */
2927 +#define STAT_rr_char 0x0004 /* ready to receive char data */
2928 +#define STAT_cmd_ready 0x0008 /* ready to accept commands */
2929 +#define STAT_dma_ready 0x0010 /* dma command ready */
2930 +#define STAT_digitized 0x0020 /* spc in digitized mode */
2931 +#define STAT_new_index 0x0040 /* new last index ready */
2932 +#define STAT_new_status 0x0080 /* new status posted */
2933 +#define STAT_dma_state 0x0100 /* dma state toggle */
2934 +#define STAT_index_valid 0x0200 /* indexs are valid */
2935 +#define STAT_flushing 0x0400 /* flush in progress */
2936 +#define STAT_self_test 0x0800 /* module in self test */
2937 +#define MODE_ready 0xc000 /* module ready for next phase */
2938 +#define READY_boot 0x0000
2939 +#define READY_kernel 0x0001
2940 +#define MODE_error 0xf000
2941 +
2942 +#define CMD_mask 0xf000 /* mask for command nibble */
2943 +#define CMD_null 0x0000 /* post status */
2944 +#define CMD_control 0x1000 /* hard control command */
2945 +#define CTRL_mask 0x0F00 /* mask off control nibble */
2946 +#define CTRL_data 0x00FF /* madk to get data byte */
2947 +#define CTRL_null 0x0000 /* null control */
2948 +#define CTRL_vol_up 0x0100 /* increase volume */
2949 +#define CTRL_vol_down 0x0200 /* decrease volume */
2950 +#define CTRL_vol_set 0x0300 /* set volume */
2951 +#define CTRL_pause 0x0400 /* pause spc */
2952 +#define CTRL_resume 0x0500 /* resume spc clock */
2953 +#define CTRL_resume_spc 0x0001 /* resume spc soft pause */
2954 +#define CTRL_flush 0x0600 /* flush all buffers */
2955 +#define CTRL_int_enable 0x0700 /* enable status change ints */
2956 +#define CTRL_buff_free 0x0800 /* buffer remain count */
2957 +#define CTRL_buff_used 0x0900 /* buffer in use */
2958 +#define CTRL_speech 0x0a00 /* immediate speech change */
2959 +#define CTRL_SP_voice 0x0001 /* voice change */
2960 +#define CTRL_SP_rate 0x0002 /* rate change */
2961 +#define CTRL_SP_comma 0x0003 /* comma pause change */
2962 +#define CTRL_SP_period 0x0004 /* period pause change */
2963 +#define CTRL_SP_rate_delta 0x0005 /* delta rate change */
2964 +#define CTRL_SP_get_param 0x0006 /* return the desired parameter */
2965 +#define CTRL_last_index 0x0b00 /* get last index spoken */
2966 +#define CTRL_io_priority 0x0c00 /* change i/o priority */
2967 +#define CTRL_free_mem 0x0d00 /* get free paragraphs on module */
2968 +#define CTRL_get_lang 0x0e00 /* return bit mask of loaded languages */
2969 +#define CMD_test 0x2000 /* self-test request */
2970 +#define TEST_mask 0x0F00 /* isolate test field */
2971 +#define TEST_null 0x0000 /* no test requested */
2972 +#define TEST_isa_int 0x0100 /* assert isa irq */
2973 +#define TEST_echo 0x0200 /* make data in == data out */
2974 +#define TEST_seg 0x0300 /* set peek/poke segment */
2975 +#define TEST_off 0x0400 /* set peek/poke offset */
2976 +#define TEST_peek 0x0500 /* data out == *peek */
2977 +#define TEST_poke 0x0600 /* *peek == data in */
2978 +#define TEST_sub_code 0x00FF /* user defined test sub codes */
2979 +#define CMD_id 0x3000 /* return software id */
2980 +#define ID_null 0x0000 /* null id */
2981 +#define ID_kernel 0x0100 /* kernel code executing */
2982 +#define ID_boot 0x0200 /* boot code executing */
2983 +#define CMD_dma 0x4000 /* force a dma start */
2984 +#define CMD_reset 0x5000 /* reset module status */
2985 +#define CMD_sync 0x6000 /* kernel sync command */
2986 +#define CMD_char_in 0x7000 /* single character send */
2987 +#define CMD_char_out 0x8000 /* single character get */
2988 +#define CHAR_count_1 0x0100 /* one char in cmd_low */
2989 +#define CHAR_count_2 0x0200 /* the second in data_low */
2990 +#define CHAR_count_3 0x0300 /* the third in data_high */
2991 +#define CMD_spc_mode 0x9000 /* change spc mode */
2992 +#define CMD_spc_to_text 0x0100 /* set to text mode */
2993 +#define CMD_spc_to_digit 0x0200 /* set to digital mode */
2994 +#define CMD_spc_rate 0x0400 /* change spc data rate */
2995 +#define CMD_error 0xf000 /* severe error */
2996 +
2997 +enum { PRIMARY_DIC = 0, USER_DIC, COMMAND_DIC, ABBREV_DIC };
2998 +
2999 +#define DMA_single_in 0x01
3000 +#define DMA_single_out 0x02
3001 +#define DMA_buff_in 0x03
3002 +#define DMA_buff_out 0x04
3003 +#define DMA_control 0x05
3004 +#define DT_MEM_ALLOC 0x03
3005 +#define DT_SET_DIC 0x04
3006 +#define DT_START_TASK 0x05
3007 +#define DT_LOAD_MEM 0x06
3008 +#define DT_READ_MEM 0x07
3009 +#define DT_DIGITAL_IN 0x08
3010 +#define DMA_sync 0x06
3011 +#define DMA_sync_char 0x07
3012 Index: linux-2.6/drivers/char/speakup/genmap.c
3013 ===================================================================
3014 --- /dev/null
3015 +++ linux-2.6/drivers/char/speakup/genmap.c
3016 @@ -0,0 +1,204 @@
3017 +#include <stdlib.h>
3018 +#include <stdio.h>
3019 +#include <libgen.h>
3020 +#include <string.h>
3021 +#include <linux/version.h>
3022 +#include <ctype.h>
3023 +
3024 +int get_define(void);
3025 +
3026 +#define MAXKEYS 512
3027 +#define MAXKEYVAL 160
3028 +#define HASHSIZE 101
3029 +#define is_shift -3
3030 +#define is_spk -2
3031 +#define is_input -1
3032 +typedef struct st_key_init t_key_init;
3033 +struct st_key_init {
3034 + char *name;
3035 + int value, shift;
3036 +};
3037 +typedef struct st_key t_key;
3038 +struct st_key {
3039 + char *name;
3040 + t_key *next;
3041 + int value, shift;
3042 +};
3043 +unsigned char key_data[MAXKEYVAL][16], *kp;
3044 +
3045 +#include "mapdata.h"
3046 +t_key key_table[MAXKEYS];
3047 +t_key *extra_keys = key_table+HASHSIZE;
3048 +char buffer[256], filename[256];
3049 +FILE *infile;
3050 +char delims[] = "\t\n ";
3051 +char *def_name, *def_val, *cp;
3052 +int map_ver = 119; /* an arbitrary number so speakup can check */
3053 +int lc, shift_table[17];
3054 +int max_states = 1, flags = 0;
3055 +/* flags reserved for later, maybe for individual console maps */
3056 +
3057 +void open_input( char *name )
3058 +{
3059 + strcpy( filename, name );
3060 + if ( ( infile = fopen( filename, "r" ) ) == 0 ) {
3061 + fprintf( stderr, "can't open %s, version %d\n", filename, LINUX_VERSION_CODE );
3062 + exit( 1 );
3063 + }
3064 + lc = 0;
3065 +}
3066 +
3067 +int
3068 +oops( char *msg, char *info )
3069 +{
3070 + if ( info == NULL ) info = " ";
3071 + fprintf( stderr, "error: file %s line %d\n", filename, lc );
3072 + fprintf( stderr, "%s %s\n", msg, info );
3073 + exit( 1 );
3074 +}
3075 +
3076 +t_key *hash_name( char *name )
3077 +{
3078 + u_char *pn = (u_char *)name;
3079 + int hash = 0;
3080 + while ( *pn ) {
3081 + hash = ( hash * 17 ) & 0xfffffff;
3082 + if ( isupper( *pn ) ) *pn = tolower( *pn );
3083 + hash += ( int )*pn;
3084 + pn++;
3085 + }
3086 + hash %= HASHSIZE;
3087 + return &key_table[hash];
3088 +}
3089 +
3090 +t_key *find_key( char *name )
3091 +{
3092 + t_key *this = hash_name( name );
3093 + while ( this ) {
3094 + if ( !strcmp( name, this->name ) ) return this;
3095 + this = this->next;
3096 + }
3097 + return this;
3098 +}
3099 +
3100 +t_key *add_key( char *name, int value, int shift )
3101 +{
3102 + t_key *this = hash_name( name );
3103 + if ( extra_keys-key_table >= MAXKEYS )
3104 + oops( "out of key table space, enlarge MAXKEYS", NULL );
3105 + if ( this->name != NULL ) {
3106 + while ( this->next ) {
3107 + if ( !strcmp( name, this->name ) )
3108 + oops( "attempt to add duplicate key", name );
3109 + this = this->next;
3110 + }
3111 + this->next = extra_keys++;
3112 + this = this->next;
3113 + }
3114 + this->name = strdup( name );
3115 + this->value = value;
3116 + this->shift = shift;
3117 + return this;
3118 +}
3119 +
3120 +int get_shift_value( int state )
3121 +{
3122 + int i;
3123 + for ( i = 0; shift_table[i] != state; i++ ) {
3124 + if ( shift_table[i] == -1 ) {
3125 + if ( i >= 16 )
3126 + oops( "too many shift states", NULL );
3127 + shift_table[i] = state;
3128 + max_states = i+1;
3129 + break;
3130 + }
3131 + }
3132 + return i;
3133 +}
3134 +
3135 +int
3136 +main( int argc, char *argv[] )
3137 +{
3138 + int value, shift_state, i, spk_val = 0, lock_val = 0;
3139 + int max_key_used = 0, num_keys_used = 0;
3140 + t_key *this;
3141 + t_key_init *p_init;
3142 +char *argpath, *argname, *argcopy;
3143 +
3144 + bzero( key_table, sizeof( key_table ) );
3145 + bzero( key_data, sizeof( key_data ) );
3146 + shift_table[0] = 0;
3147 + for ( i = 1; i <= 16; i++ ) shift_table[i] = -1;
3148 + if ( argc < 2 ) {
3149 + fputs( "usage: genmap filename\n", stderr );
3150 + exit( 1 );
3151 + }
3152 + for ( p_init = init_key_data; p_init->name[0] != '.'; p_init++ )
3153 + add_key( p_init->name, p_init->value, p_init->shift );
3154 + open_input( argv[1] );
3155 + while ( fgets( buffer, 250, infile ) ) {
3156 + lc++;
3157 + value = shift_state = 0;
3158 + cp = strtok( buffer, delims );
3159 + if ( *cp == '#' ) continue;
3160 + while ( cp ) {
3161 + if ( *cp == '=' ) break;
3162 + this = find_key( cp );
3163 + if ( this == NULL )
3164 + oops( "unknown key/modifier", cp );
3165 + if ( this->shift == is_shift ) {
3166 + if ( value )
3167 + oops( "modifiers must come first", cp );
3168 + shift_state += this->value;
3169 + } else if ( this->shift == is_input )
3170 + value = this->value;
3171 + else oops( "bad modifier or key", cp );
3172 + cp = strtok( 0, delims );
3173 + }
3174 + if ( !cp ) oops( "no = found", NULL );
3175 + cp = strtok( 0, delims );
3176 + if ( !cp ) oops( "no speakup function after =", NULL );
3177 + this = find_key( cp );
3178 + if ( this == NULL || this->shift != is_spk )
3179 + oops( "invalid speakup function", cp );
3180 + i = get_shift_value( shift_state );
3181 + if ( key_data[value][i] ) {
3182 + while ( --cp > buffer )
3183 + if ( !*cp ) *cp = ' ';
3184 + oops( "two functions on same key combination", cp );
3185 + }
3186 + key_data[value][i] = (char)this->value;
3187 + if ( value > max_key_used ) max_key_used = value;
3188 + }
3189 + fclose( infile );
3190 + this = find_key( "spk_key" );
3191 + if ( this ) spk_val = this->value;
3192 + this = find_key( "spk_lock" );
3193 + if ( this ) lock_val = this->value;
3194 + for ( lc = 1; lc <= max_key_used; lc++ ) {
3195 + kp = key_data[lc];
3196 + if ( !memcmp( key_data[0], kp, 16 ) ) continue;
3197 + num_keys_used++;
3198 + for ( i = 0; i < max_states; i++ ) {
3199 + if ( kp[i] != spk_val&& kp[i] != lock_val ) continue;
3200 + shift_state = shift_table[i];
3201 + if ( ( shift_state&16 ) ) continue;
3202 + shift_state = get_shift_value( shift_state+16 );
3203 + kp[shift_state] = kp[i];
3204 +/* fill in so we can process the key up, as spk bit will be set */
3205 + }
3206 + }
3207 + printf( "\t%d, %d, %d,\n\t", map_ver, num_keys_used, max_states );
3208 + for ( i = 0; i < max_states; i++ )
3209 + printf( "%d, ", shift_table[i] );
3210 + printf( "%d,", flags );
3211 + for ( lc = 1; lc <= max_key_used; lc++ ) {
3212 + kp = key_data[lc];
3213 + if ( !memcmp( key_data[0], kp, 16 ) ) continue;
3214 + printf( "\n\t%d,", lc );
3215 + for ( i = 0; i < max_states; i++ )
3216 + printf( " %d,", (unsigned int)kp[i] );
3217 + }
3218 + printf( "\n\t0, %d\n", map_ver );
3219 + exit( 0 );
3220 +}
3221 Index: linux-2.6/drivers/char/speakup/keyinfo.h
3222 ===================================================================
3223 --- /dev/null
3224 +++ linux-2.6/drivers/char/speakup/keyinfo.h
3225 @@ -0,0 +1,120 @@
3226 +/* spk_priv.h
3227 + review functions for the speakup screen review package.
3228 + originally written by: Kirk Reiser and Andy Berdan.
3229 +
3230 + extensively modified by David Borowski.
3231 +
3232 + Copyright (C ) 1998 Kirk Reiser.
3233 + Copyright (C ) 2003 David Borowski.
3234 +
3235 + This program is free software; you can redistribute it and/or modify
3236 + it under the terms of the GNU General Public License as published by
3237 + the Free Software Foundation; either version 2 of the License, or
3238 + (at your option ) any later version.
3239 +
3240 + This program is distributed in the hope that it will be useful,
3241 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3242 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3243 + GNU General Public License for more details.
3244 +
3245 + You should have received a copy of the GNU General Public License
3246 + along with this program; if not, write to the Free Software
3247 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3248 +*/
3249 +
3250 +enum { /* var_ids */
3251 + VERSION = 0, SYNTH, SILENT, SYNTH_DIRECT,
3252 + KEYMAP, CHARS,
3253 + PUNC_SOME, PUNC_MOST, PUNC_ALL,
3254 + DELIM, REPEATS, EXNUMBER,
3255 + DELAY, TRIGGER, JIFFY, FULL, /* all timers must be together */
3256 + BLEEP_TIME, CURSOR_TIME, BELL_POS,
3257 +SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
3258 + SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
3259 + ATTRIB_BLEEP, BLEEPS,
3260 + RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQ, LANG,
3261 + CAPS_START, CAPS_STOP, CHARTAB,
3262 + MAXVARS
3263 +};
3264 +
3265 +#define FIRST_SYNTH_VAR RATE
3266 +/* 0 is reserved for no remap */
3267 +#define SPEAKUP_GOTO 0x01
3268 +#define SPEECH_KILL 0x02
3269 +#define SPEAKUP_QUIET 0x03
3270 +#define SPEAKUP_CUT 0x04
3271 +#define SPEAKUP_PASTE 0x05
3272 +#define SAY_FIRST_CHAR 0x06
3273 +#define SAY_LAST_CHAR 0x07
3274 +#define SAY_CHAR 0x08
3275 +#define SAY_PREV_CHAR 0x09
3276 +#define SAY_NEXT_CHAR 0x0a
3277 +#define SAY_WORD 0x0b
3278 +#define SAY_PREV_WORD 0x0c
3279 +#define SAY_NEXT_WORD 0x0d
3280 +#define SAY_LINE 0x0e
3281 +#define SAY_PREV_LINE 0x0f
3282 +#define SAY_NEXT_LINE 0x10
3283 +#define TOP_EDGE 0x11
3284 +#define BOTTOM_EDGE 0x12
3285 +#define LEFT_EDGE 0x13
3286 +#define RIGHT_EDGE 0x14
3287 +#define SPELL_PHONETIC 0x15
3288 +#define SPELL_WORD 0x16
3289 +#define SAY_SCREEN 0x17
3290 +#define SAY_POSITION 0x18
3291 +#define SAY_ATTRIBUTES 0x19
3292 +#define SPEAKUP_OFF 0x1a
3293 +#define SPEAKUP_PARKED 0x1b
3294 +#define SAY_LINE_INDENT 0x1c
3295 +#define SAY_FROM_TOP 0x1d
3296 +#define SAY_TO_BOTTOM 0x1e
3297 +#define SAY_FROM_LEFT 0x1f
3298 +#define SAY_TO_RIGHT 0x20
3299 +#define SAY_CHAR_NUM 0x21
3300 +#define EDIT_SOME 0x22
3301 +#define EDIT_MOST 0x23
3302 +#define SAY_PHONETIC_CHAR 0x24
3303 +#define EDIT_DELIM 0x25
3304 +#define EDIT_REPEAT 0x26
3305 +#define EDIT_EXNUM 0x27
3306 +#define SET_WIN 0x28
3307 +#define CLEAR_WIN 0x29
3308 +#define ENABLE_WIN 0x2a
3309 +#define SAY_WIN 0x2b
3310 +#define SPK_LOCK 0x2c
3311 +#define SPEAKUP_HELP 0x2d
3312 +#define TOGGLE_CURSORING 0x2e
3313 +#define READ_ALL_DOC 0x2f
3314 +#define SPKUP_MAX_FUNC 0x30 /* one greater than the last func handler */
3315 +
3316 +#define SPK_KEY 0x80
3317 +#define FIRST_EDIT_BITS 0x22
3318 +
3319 +#define FIRST_SET_VAR SPELL_DELAY
3320 +#define VAR_START 0x40 /* increase if adding more than 0x3f functions */
3321 +
3322 +/* keys for setting variables, must be ordered same as the enum for var_ids */
3323 +/* with dec being even and inc being 1 greater */
3324 +#define SPELL_DELAY_DEC VAR_START+0
3325 +#define SPELL_DELAY_INC SPELL_DELAY_DEC+1
3326 +#define PUNC_LEVEL_DEC SPELL_DELAY_DEC+2
3327 +#define PUNC_LEVEL_INC PUNC_LEVEL_DEC+1
3328 +#define READING_PUNC_DEC PUNC_LEVEL_DEC+2
3329 +#define READING_PUNC_INC READING_PUNC_DEC+1
3330 +#define ATTRIB_BLEEP_DEC READING_PUNC_DEC+2
3331 +#define ATTRIB_BLEEP_INC ATTRIB_BLEEP_DEC+1
3332 +#define BLEEPS_DEC ATTRIB_BLEEP_DEC+2
3333 +#define BLEEPS_INC BLEEPS_DEC+1
3334 +#define RATE_DEC BLEEPS_DEC+2
3335 +#define RATE_INC RATE_DEC+1
3336 +#define PITCH_DEC RATE_DEC+2
3337 +#define PITCH_INC PITCH_DEC+1
3338 +#define VOL_DEC PITCH_DEC+2
3339 +#define VOL_INC VOL_DEC+1
3340 +#define TONE_DEC VOL_DEC+2
3341 +#define TONE_INC TONE_DEC+1
3342 +#define PUNCT_DEC TONE_DEC+2
3343 +#define PUNCT_INC PUNCT_DEC+1
3344 +#define VOICE_DEC PUNCT_DEC+2
3345 +#define VOICE_INC VOICE_DEC+1
3346 Index: linux-2.6/drivers/char/speakup/makemapdata.c
3347 ===================================================================
3348 --- /dev/null
3349 +++ linux-2.6/drivers/char/speakup/makemapdata.c
3350 @@ -0,0 +1,156 @@
3351 +#include <stdlib.h>
3352 +#include <stdio.h>
3353 +#include <libgen.h>
3354 +#include <string.h>
3355 +#include <linux/version.h>
3356 +#include <ctype.h>
3357 +
3358 +int get_define(void);
3359 +
3360 +#define MAXKEYS 512
3361 +#define MAXKEYVAL 160
3362 +#define HASHSIZE 101
3363 +#define is_shift -3
3364 +#define is_spk -2
3365 +#define is_input -1
3366 +typedef struct st_key t_key;
3367 +struct st_key {
3368 + char *name;
3369 + t_key *next;
3370 + int value, shift;
3371 +};
3372 +
3373 +t_key key_table[MAXKEYS];
3374 +t_key *extra_keys = key_table+HASHSIZE;
3375 +char buffer[256], filename[256];
3376 +FILE *infile;
3377 +char delims[] = "\t\n ";
3378 +char *dir_name, *def_name, *def_val, *cp;
3379 +int lc;
3380 +
3381 +void open_input( char *name )
3382 +{
3383 + sprintf( filename, "%s/%s", dir_name, name );
3384 + if ( ( infile = fopen( filename, "r" ) ) == 0 ) {
3385 + fprintf( stderr, "can't open %s\n", filename );
3386 + exit( 1 );
3387 + }
3388 + lc = 0;
3389 +}
3390 +
3391 +int
3392 +oops( char *msg, char *info )
3393 +{
3394 + if ( info == NULL ) info = " ";
3395 + fprintf( stderr, "error: file %s line %d\n", filename, lc );
3396 + fprintf( stderr, "%s %s\n", msg, info );
3397 + exit( 1 );
3398 +}
3399 +
3400 +int get_define( )
3401 +{
3402 + while ( fgets( buffer, 250, infile ) ) {
3403 + lc++;
3404 + if ( strncmp( buffer, "#define", 7 ) ) continue;
3405 + strtok( buffer, delims );
3406 + def_name = strtok( 0, delims );
3407 + def_val = strtok( 0, delims );
3408 + if ( def_val != NULL ) return 1;
3409 + }
3410 + fclose( infile );
3411 + infile = 0;
3412 + return 0;
3413 +}
3414 +
3415 +t_key *hash_name( char *name )
3416 +{
3417 + u_char *pn = (u_char *)name;
3418 + int hash = 0;
3419 + while ( *pn ) {
3420 + hash = ( hash * 17 ) & 0xfffffff;
3421 + if ( isupper( *pn ) ) *pn = tolower( *pn );
3422 + hash += ( int )*pn;
3423 + pn++;
3424 + }
3425 + hash %= HASHSIZE;
3426 + return &key_table[hash];
3427 +}
3428 +
3429 +t_key *find_key( char *name )
3430 +{
3431 + t_key *this = hash_name( name );
3432 + while ( this ) {
3433 + if ( !strcmp( name, this->name ) ) return this;
3434 + this = this->next;
3435 + }
3436 + return this;
3437 +}
3438 +
3439 +t_key *add_key( char *name, int value, int shift )
3440 +{
3441 + t_key *this = hash_name( name );
3442 + if ( extra_keys-key_table >= MAXKEYS )
3443 + oops( "out of key table space, enlarge MAXKEYS", NULL );
3444 + if ( this->name != NULL ) {
3445 + while ( this->next ) {
3446 + if ( !strcmp( name, this->name ) )
3447 + oops( "attempt to add duplicate key", name );
3448 + this = this->next;
3449 + }
3450 + this->next = extra_keys++;
3451 + this = this->next;
3452 + }
3453 + this->name = strdup( name );
3454 + this->value = value;
3455 + this->shift = shift;
3456 + return this;
3457 +}
3458 +
3459 +int
3460 +main( int argc, char *argv[] )
3461 +{
3462 + int value, i;
3463 + t_key *this;
3464 + dir_name = getenv( "TOPDIR" );
3465 + if ( !dir_name ) dir_name = "/usr/src/linux";
3466 + bzero( key_table, sizeof( key_table ) );
3467 + add_key( "shift", 1, is_shift );
3468 + add_key( "altgr", 2, is_shift );
3469 + add_key( "ctrl", 4, is_shift );
3470 + add_key( "alt", 8, is_shift );
3471 + add_key( "spk", 16, is_shift );
3472 + add_key( "double", 32, is_shift );
3473 + open_input( "include/linux/input.h" );
3474 + while ( get_define( ) ) {
3475 + if ( strncmp( def_name, "KEY_", 4 ) ) continue;
3476 + value = atoi( def_val );
3477 + if ( value > 0 && value < MAXKEYVAL )
3478 + add_key( def_name, value, is_input );
3479 + }
3480 + open_input( "drivers/char/speakup/keyinfo.h" );
3481 + while ( get_define( ) ) {
3482 + if ( strlen( def_val ) > 5 ) {
3483 + if ( !( cp = strchr( def_val, '+' ) ) ) continue;
3484 + *cp++ = '\0';
3485 + this = find_key( def_val );
3486 + if ( !this || *cp < '0' || *cp > '9' ) continue;
3487 + value = this->value+atoi( cp );
3488 + } else if ( !strncmp( def_val, "0x", 2 ) )
3489 + sscanf( def_val+2, "%x", &value );
3490 + else if ( *def_val >= '0' && *def_val <= '9' )
3491 + value = atoi( def_val );
3492 + else continue;
3493 + add_key( def_name, value, is_spk );
3494 + }
3495 + printf( "t_key_init init_key_data[] = {\n" );
3496 + for ( i = 0; i < HASHSIZE; i++ ) {
3497 + this = &key_table[i];
3498 + if ( !this->name ) continue;
3499 + do {
3500 + printf( "\t\"%s\", %d, %d,\n", this->name, this->value, this->shift );
3501 + this = this->next;
3502 + } while ( this );
3503 + }
3504 + printf( "\t\".\", 0, 0\n};\n" );
3505 + exit( 0 );
3506 +}
3507 Index: linux-2.6/drivers/char/speakup/mod_code.c
3508 ===================================================================
3509 --- /dev/null
3510 +++ linux-2.6/drivers/char/speakup/mod_code.c
3511 @@ -0,0 +1,22 @@
3512 +/* this code is to modularize a synth specific file, included at the end */
3513 +
3514 +static void __exit mod_synth_exit( void )
3515 +{
3516 + if ( synth == &MY_SYNTH )
3517 + synth_release( );
3518 + synth_remove( &MY_SYNTH );
3519 +}
3520 +
3521 +static int __init mod_synth_init( void )
3522 +{
3523 + int status = do_synth_init( &MY_SYNTH );
3524 + if ( status != 0 ) return status;
3525 + synth_add( &MY_SYNTH );
3526 + return 0;
3527 +}
3528 +
3529 +module_init( mod_synth_init );
3530 +module_exit( mod_synth_exit );
3531 +MODULE_AUTHOR("Kirk Reiser <kirk@braille.uwo.ca>");
3532 +MODULE_DESCRIPTION("Synthesizer driver module for speakup for the synth->long_name");
3533 +MODULE_LICENSE( "GPL" );
3534 Index: linux-2.6/drivers/char/speakup/serialio.h
3535 ===================================================================
3536 --- /dev/null
3537 +++ linux-2.6/drivers/char/speakup/serialio.h
3538 @@ -0,0 +1,18 @@
3539 +#ifndef SSPK_SERIAL
3540 +#define SSPK_SERIAL
3541 +
3542 +#include <linux/serial.h> /* for rs_table, serial constants &
3543 + serial_uart_config */
3544 +#include <linux/serial_reg.h> /* for more serial constants */
3545 +#include <linux/serialP.h> /* for struct serial_state */
3546 +#include <asm/serial.h>
3547 +
3548 +#define SPK_SERIAL_TIMEOUT 1000000 /* countdown values for serial timeouts */
3549 +#define SPK_XMITR_TIMEOUT 1000000 /* countdown values transmitter/dsr timeouts */
3550 +#define SPK_LO_TTY 0 /* check ttyS0 ... ttyS3 */
3551 +#define SPK_HI_TTY 3
3552 +#define NUM_DISABLE_TIMEOUTS 3 /* # of timeouts permitted before disable */
3553 +#define SPK_TIMEOUT 100 /* buffer timeout in ms */
3554 +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
3555 +
3556 +#endif
3557 Index: linux-2.6/drivers/char/speakup/speakup.c
3558 ===================================================================
3559 --- /dev/null
3560 +++ linux-2.6/drivers/char/speakup/speakup.c
3561 @@ -0,0 +1,2905 @@
3562 +/* speakup.c
3563 + review functions for the speakup screen review package.
3564 + originally written by: Kirk Reiser and Andy Berdan.
3565 +
3566 + extensively modified by David Borowski.
3567 +
3568 + Copyright (C ) 1998 Kirk Reiser.
3569 + Copyright (C ) 2003 David Borowski.
3570 +
3571 + This program is free software; you can redistribute it and/or modify
3572 + it under the terms of the GNU General Public License as published by
3573 + the Free Software Foundation; either version 2 of the License, or
3574 + (at your option ) any later version.
3575 +
3576 + This program is distributed in the hope that it will be useful,
3577 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3578 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3579 + GNU General Public License for more details.
3580 +
3581 + You should have received a copy of the GNU General Public License
3582 + along with this program; if not, write to the Free Software
3583 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3584 +*/
3585 +
3586 +#define __KERNEL_SYSCALLS__
3587 +
3588 +#include <linux/kernel.h>
3589 +#include <linux/version.h>
3590 +#include <linux/vt.h>
3591 +#include <linux/tty.h>
3592 +#include <linux/mm.h> /* __get_free_page( ) and friends */
3593 +#include <linux/vt_kern.h>
3594 +#include <linux/ctype.h>
3595 +#include <linux/selection.h>
3596 +#include <asm/uaccess.h> /* copy_from|to|user( ) and others */
3597 +#include <linux/unistd.h>
3598 +
3599 +#include <linux/keyboard.h> /* for KT_SHIFT */
3600 +#include <linux/kbd_kern.h> /* for vc_kbd_* and friends */
3601 +#include <linux/vt_kern.h>
3602 +#include <linux/input.h>
3603 +#include <linux/kmod.h>
3604 +#include <linux/speakup.h>
3605 +
3606 +#include "cvsversion.h"
3607 +#include "spk_priv.h"
3608 +#include <linux/bootmem.h> /* for alloc_bootmem */
3609 +
3610 +/* speakup_*_selection */
3611 +#include <linux/module.h>
3612 +#include <linux/sched.h>
3613 +#include <linux/slab.h>
3614 +#include <linux/types.h>
3615 +#include <asm/uaccess.h>
3616 +#include <linux/consolemap.h>
3617 +
3618 +#define SPEAKUP_VERSION "Speakup v-2.00" CVSVERSION
3619 +#define MAX_DELAY ( (500 * HZ ) / 1000 )
3620 +#define KEY_MAP_VER 119
3621 +#define MINECHOCHAR SPACE
3622 +
3623 +/* these are globals from the kernel code */
3624 +extern void *kmalloc (size_t, unsigned int );
3625 +extern void kfree (const void * );
3626 +extern struct kbd_struct * kbd;
3627 +extern int fg_console;
3628 +extern short punc_masks[];
3629 +
3630 +static special_func special_handler = NULL;
3631 +special_func help_handler = NULL;
3632 +
3633 +int synth_file_inuse = 0;
3634 +short pitch_shift = 0, synth_flags = 0;
3635 +static char buf[256];
3636 +short attrib_bleep = 0, bleeps = 0, bleep_time = 1;
3637 +short no_intr = 0, spell_delay = 0;
3638 +short key_echo = 0, cursor_timeout = 120, say_word_ctl = 0;
3639 +short say_ctrl = 0, bell_pos = 0;
3640 +short punc_mask = 0, punc_level = 0, reading_punc = 0;
3641 +char str_caps_start[MAXVARLEN+1] = "\0", str_caps_stop[MAXVARLEN+1] = "\0";
3642 +bits_data punc_info[] = {
3643 + { "none", "", 0 },
3644 + { "some", "/$%&@", SOME },
3645 + { "most", "$%&#()=+*/@^<>|\\", MOST },
3646 + { "all", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", PUNC },
3647 + { "delimiters", "", B_WDLM },
3648 + { "repeats", "()", CH_RPT },
3649 + { "extended numeric", "", B_EXNUM },
3650 + { "symbols", "", B_SYM },
3651 + { 0, 0 }
3652 +};
3653 +char mark_cut_flag = 0;
3654 +u_short mark_x = 0, mark_y = 0;
3655 +char synth_name[10] = CONFIG_SPEAKUP_DEFAULT;
3656 +#define MAX_KEY 160
3657 +u_char *our_keys[MAX_KEY], *shift_table;
3658 +static u_char key_buf[600];
3659 +static u_char key_defaults[] = {
3660 +#include "speakupmap.h"
3661 +};
3662 +
3663 +// Speakup Cursor Track Variables
3664 +static int cursor_track = 1, prev_cursor_track=1;
3665 +/* cursor track modes, must be ordered same as cursor_msgs */
3666 +enum { CT_Off = 0, CT_On, CT_Highlight, CT_Window, CT_Max };
3667 +#define read_all_mode CT_Max
3668 +
3669 +struct tty_struct *tty;
3670 +#define key_handler k_handler
3671 +typedef void (*k_handler_fn)(struct vc_data *vc, unsigned char value,
3672 + char up_flag, struct pt_regs *regs);
3673 +#define KBD_PROTO struct vc_data *vc, u_char value, char up_flag, struct pt_regs *regs
3674 +#define KBD_ARGS vc, value, up_flag, regs
3675 +extern k_handler_fn key_handler[16];
3676 +static k_handler_fn do_shift, do_spec, do_latin, do_cursor;
3677 +EXPORT_SYMBOL( help_handler );
3678 +EXPORT_SYMBOL( special_handler );
3679 +EXPORT_SYMBOL( our_keys );
3680 +EXPORT_SYMBOL(synth_name);
3681 +
3682 +static void speakup_date (struct vc_data *vc );
3683 +static void spkup_write (const char *in_buf, int count );
3684 +int set_mask_bits( const char *input, const int which, const int how );
3685 +
3686 +char str_ctl[] = "control-";
3687 +char *colors[] = {
3688 + "black", "blue", "green", "cyan", "red", "magenta", "yellow", "white",
3689 + "grey"
3690 +};
3691 +
3692 +char *phonetic[] = {
3693 + "alpha", "beta", "charley", "delta", "echo", "fox", "gamma", "hotel",
3694 + "india", "juleiet", "keelo", "leema", "mike", "november", "oscar",
3695 + "papa",
3696 + "quebec", "romeo", "seeara", "tango", "uniform", "victer", "wiskey",
3697 + "x ray", "yankee", "zooloo"
3698 +};
3699 +
3700 +// array of 256 char pointers (one for each character description )
3701 +// initialized to default_chars and user selectable via /proc/speakup/characters
3702 +char *characters[256];
3703 +
3704 +char *default_chars[256] = {
3705 + "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g",
3706 + "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o",
3707 + "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w",
3708 + "^x", "^y", "^z", NULL, NULL, NULL, NULL, NULL,
3709 + "space", "bang!", "quote", "number", "dollar", "percent", "and",
3710 + "tick",
3711 + "left paren", "right paren", "star", "plus", "comma", "dash", "dot",
3712 + "slash",
3713 + "zero", "one", "two", "three", "four", "five", "six", "seven",
3714 + "eight", "nine",
3715 + "colon", "semmy", "less", "equals", "greater", "question", "at",
3716 + "eigh", "b", "c", "d", "e", "f", "g",
3717 + "h", "i", "j", "k", "l", "m", "n", "o",
3718 + "p", "q", "r", "s", "t", "u", "v", "w", "x",
3719 + "y", "zehd", "left bracket", "backslash", "right bracket", "caret",
3720 + "line",
3721 + "accent", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3722 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3723 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
3724 + NULL, NULL, NULL, "left brace", "bar", "right brace", "tihlduh",
3725 + "delta", "see cedilla", "u oomlout", "e acute", /* 128 */
3726 + "eigh circumflex", "eigh oomlout", "eigh grave", "eigh ring", /* 132 */
3727 + "see cedilla", "e circumflex", "e oomlout", "e grave", /* 136 */
3728 + "i oomlout", "i circumflex", "i grave", "eigh oomlout", /* 140 */
3729 + "eigh ring", "e acute", "eigh e dipthong", "eigh e dipthong", /* 144 */
3730 + "o circumflex", "o oomlout", "o grave", "u circumflex", /* 148 */
3731 + "u grave", "y oomlout", "o oomlout", "u oomlout", /* 152 */
3732 + "cents", "pounds", "yen", "peseta", /* 156 */
3733 + "florin", "eigh acute", "i acute", "o acute", /* 160 */
3734 + "u acute", "n tilde", "n tilde", "feminine ordinal", /* 164 */
3735 + "masculin ordinal", "inverted question", "reversed not", "not", /* 168 */
3736 + "half", "quarter", "inverted bang", "much less than", /* 172 */
3737 + "much greater than", "dark shading", "medium shading", /* 176 */
3738 + "light shading", "verticle line", "left tee", /* 179 */
3739 + "double left tee", "left double tee", "double top right", /* 182 */
3740 + "top double right", "double left double tee", /* 185 */
3741 + "double vertical line", "double top double right", /* 187 */
3742 + "double bottom double right", "double bottom right", /* 189 */
3743 + "bottom double right", "top right", "left bottom", /* 191 */
3744 + "up tee", "tee down", "tee right", "horizontal line", /* 194 */
3745 + "cross bars", "tee double right", "double tee right", /* 198 */
3746 + "double left double bottom", "double left double top", /* 201 */
3747 + "double up double tee", "double tee double down", /* 203 */
3748 + "double tee double right", "double horizontal line", /* 205 */
3749 + "double cross bars", "up double tee", "double up tee", /* 207 */
3750 + "double tee down", "tee double down", /* 210 */
3751 + "double left bottom", "left double bottom", /* 212 */
3752 + "double left top", "left double top", /* 214 */
3753 + "double vertical cross", "double horizontal cross", /* 216 */
3754 + "bottom right", "left top", "solid square", /* 218 */
3755 + "solid lower half", "solid left half", "solid right half", /* 221 */
3756 + "solid upper half", "alpha", "beta", "gamma", /* 224 */
3757 + "pie", "sigma", "sigma", "mu", /* 228 */
3758 + "tou", "phigh", "thayta", "ohmega", /* 232 */
3759 + "delta", "infinity", "phigh", "epsilaun", /* 236 */
3760 +"intersection", "identical to", "plus or minus", "equal grater than", /* 240 */
3761 + "less than equal", "upper integral", "lower integral", /* 244 */
3762 + "divided by", "almost equal", "degrees", /* 247 */
3763 + "centre dot", "bullet", "square root", /* 250 */
3764 + "power", "squared", "black square", "white space" /* 252 */
3765 +};
3766 +
3767 +// array of 256 u_short (one for each character)
3768 +// initialized to default_chartab and user selectable via /proc/speakup/chartab
3769 +u_short spk_chartab[256];
3770 +
3771 +u_short default_chartab[256] = {
3772 + B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 0-7 */
3773 + B_CTL, B_CTL, A_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 8-15 */
3774 + B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /*16-23 */
3775 + B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 24-31 */
3776 +WDLM, A_PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* !"#$%&' */
3777 +PUNC, PUNC, PUNC, PUNC, A_PUNC, A_PUNC, A_PUNC, PUNC, /* ( )*+, -./ */
3778 +NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, /* 01234567 */
3779 +NUM, NUM, A_PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* 89:;<=>? */
3780 +PUNC, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* @ABCDEFG */
3781 +A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* HIJKLMNO */
3782 +A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* PQRSTUVW */
3783 +A_CAP, A_CAP, A_CAP, PUNC, PUNC, PUNC, PUNC, PUNC, /* XYZ[\]^_ */
3784 +PUNC, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* `abcdefg */
3785 +ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* hijklmno */
3786 +ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* pqrstuvw */
3787 +ALPHA, ALPHA, ALPHA, PUNC, PUNC, PUNC, PUNC, 0, /* xyz{|}~ */
3788 +B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-135 */
3789 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 136-143 */
3790 +B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 144-151 */
3791 +B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 152-159 */
3792 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, /* 160-167 */
3793 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 168-175 */
3794 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 176-183 */
3795 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 184-191 */
3796 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 192-199 */
3797 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 200-207 */
3798 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 208-215 */
3799 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 216-223 */
3800 +B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, /* 224-231 */
3801 +B_SYM, B_CAPSYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 232-239 */
3802 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 240-247 */
3803 +B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM /* 248-255 */
3804 +};
3805 +
3806 +int spk_keydown = 0;
3807 +static u_char spk_lastkey = 0, spk_close_press = 0, keymap_flags = 0;
3808 +static u_char last_keycode = 0, this_speakup_key = 0;
3809 +static u_long last_spk_jiffy = 0;
3810 +
3811 +spk_t *speakup_console[MAX_NR_CONSOLES];
3812 +
3813 +int spk_setup (char *str )
3814 +{
3815 + int ints[4];
3816 + str = get_options (str, ARRAY_SIZE (ints ), ints );
3817 + if (ints[0] > 0 && ints[1] >= 0 )
3818 + synth_port_forced = ints[1];
3819 + return 1;
3820 +}
3821 +
3822 +int spk_ser_setup (char *str )
3823 +{
3824 + int lookup[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
3825 + int ints[4];
3826 + str = get_options (str, ARRAY_SIZE (ints ), ints );
3827 + if (ints[0] > 0 && ints[1] >= 0 )
3828 + synth_port_forced = lookup[ints[1]];
3829 + return 1;
3830 +}
3831 +
3832 +int spk_synth_setup (char *str )
3833 +{
3834 + size_t len = MIN (strlen (str ), 9 );
3835 + memcpy (synth_name, str, len );
3836 + synth_name[len] = '\0';
3837 + return 1;
3838 +}
3839 +
3840 +int spk_quiet_setup (char *str )
3841 +{
3842 + if (strchr( "1yt", *str) != NULL) quiet_boot = 1;
3843 + return 1;
3844 +}
3845 +
3846 +__setup ("speakup_port=", spk_setup );
3847 +__setup ("speakup_ser=", spk_ser_setup );
3848 +__setup ("speakup_synth=", spk_synth_setup );
3849 +__setup ("speakup_quiet=", spk_quiet_setup );
3850 +
3851 +char *
3852 +strlwr (char *s )
3853 +{
3854 + char *p;
3855 + for (p = s; *p; p++ ) {
3856 + if (*p >= CAP_A && *p <= CAP_Z ) *p |= 32;
3857 + }
3858 + return s;
3859 +}
3860 +
3861 +static void
3862 +bleep (u_short val )
3863 +{
3864 + static short vals[] = { 350, 370, 392, 414, 440, 466, 491, 523,
3865 +554, 587, 619, 659 };
3866 + short freq;
3867 + int time = bleep_time;
3868 + freq = vals[val%12];
3869 + if (val > 11 )
3870 + freq *= (1<<(val/12 ) );
3871 + kd_mksound (freq, time );
3872 +}
3873 +
3874 +void
3875 +speakup_shut_up (struct vc_data *vc )
3876 +{
3877 + if (spk_killed ) return;
3878 + spk_shut_up |= 0x01;
3879 + spk_parked &= 0xfe;
3880 + speakup_date (vc );
3881 + if (synth == NULL ) return;
3882 + do_flush( );
3883 +}
3884 +
3885 +void
3886 +speech_kill (struct vc_data *vc )
3887 +{
3888 + char val = synth->is_alive ( );
3889 + if (val == 0 ) return;
3890 + /* re-enables synth, if disabled */
3891 + if (val == 2 || spk_killed ) { /* dead */
3892 + spk_shut_up &= ~0x40;
3893 + synth_write_msg ("Eyem a Lighve!" );
3894 + } else {
3895 + synth_write_msg ("You killed speak up!" );
3896 + spk_shut_up |= 0x40;
3897 + }
3898 +}
3899 +
3900 +static void
3901 +speakup_off (struct vc_data *vc )
3902 +{
3903 + if (spk_shut_up & 0x80 ) {
3904 + spk_shut_up &= 0x7f;
3905 + synth_write_msg ("hey. That's better!" );
3906 + } else {
3907 + spk_shut_up |= 0x80;
3908 + synth_write_msg ("You turned me off!" );
3909 + }
3910 + speakup_date (vc );
3911 +}
3912 +
3913 +static void
3914 +speakup_parked (struct vc_data *vc )
3915 +{
3916 + if (spk_parked & 0x80 ) {
3917 + spk_parked = 0;
3918 + synth_write_msg ("unparked!" );
3919 + } else {
3920 + spk_parked |= 0x80;
3921 + synth_write_msg ("parked!" );
3922 + }
3923 +}
3924 +
3925 +/* ------ cut and paste ----- */
3926 +/* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */
3927 +#undef isspace
3928 +#define isspace(c) ((c) == ' ')
3929 +/* Variables for selection control. */
3930 +struct vc_data *spk_sel_cons; /* defined in selection.c must not be disallocated */
3931 +static volatile int sel_start = -1; /* cleared by clear_selection */
3932 +static int sel_end;
3933 +static int sel_buffer_lth;
3934 +static char *sel_buffer;
3935 +
3936 +static unsigned char
3937 +sel_pos(int n)
3938 +{
3939 + return inverse_translate(spk_sel_cons, screen_glyph(spk_sel_cons, n));
3940 +}
3941 +
3942 +static inline unsigned char
3943 +get_char(struct vc_data *vc, u16 *pos)
3944 +{
3945 + unsigned char ch = ' ';
3946 + if (vc && pos) {
3947 + u16 w = scr_readw (pos );
3948 + u16 c = w & 0xff;
3949 +
3950 + if (w & vc->vc_hi_font_mask)
3951 + c |= 0x100;
3952 +
3953 + ch = inverse_translate (vc, c );
3954 + }
3955 + return ch;
3956 +}
3957 +
3958 +static inline unsigned char
3959 +get_attributes(u16 *pos)
3960 +{
3961 + return (u_char ) (scr_readw (pos ) >> 8 );
3962 +}
3963 +
3964 +static void
3965 +speakup_clear_selection(void)
3966 +{
3967 + sel_start = -1;
3968 +}
3969 +
3970 +/* does screen address p correspond to character at LH/RH edge of screen? */
3971 +static inline int atedge(const int p, int size_row)
3972 +{
3973 + return (!(p % size_row) || !((p + 2) % size_row));
3974 +}
3975 +
3976 +/* constrain v such that v <= u */
3977 +static inline unsigned short limit(const unsigned short v, const unsigned short u)
3978 +{
3979 + return (v > u) ? u : v;
3980 +}
3981 +
3982 +unsigned short xs, ys, xe, ye; /* our region points */
3983 +
3984 +static int
3985 +speakup_set_selection( struct tty_struct *tty)
3986 +{
3987 + int new_sel_start, new_sel_end;
3988 + char *bp, *obp;
3989 + int i, ps, pe;
3990 + struct vc_data *vc = vc_cons[fg_console].d;
3991 +
3992 + xs = limit(xs, vc->vc_cols - 1);
3993 + ys = limit(ys, vc->vc_rows - 1);
3994 + xe = limit(xe, vc->vc_cols - 1);
3995 + ye = limit(ye, vc->vc_rows - 1);
3996 + ps = ys * vc->vc_size_row + (xs << 1);
3997 + pe = ye * vc->vc_size_row + (xe << 1);
3998 +
3999 + if (ps > pe) { /* make sel_start <= sel_end */
4000 + int tmp = ps;
4001 + ps = pe;
4002 + pe = tmp;
4003 + }
4004 +
4005 + if (spk_sel_cons != vc_cons[fg_console].d) {
4006 + speakup_clear_selection();
4007 + spk_sel_cons = vc_cons[fg_console].d;
4008 + printk(KERN_WARNING "Selection: mark console not the same as cut\n");
4009 + return -EINVAL;
4010 + }
4011 +
4012 + new_sel_start = ps;
4013 + new_sel_end = pe;
4014 +
4015 + /* select to end of line if on trailing space */
4016 + if (new_sel_end > new_sel_start &&
4017 + !atedge(new_sel_end, vc->vc_size_row) &&
4018 + isspace(sel_pos(new_sel_end))) {
4019 + for (pe = new_sel_end + 2; ; pe += 2)
4020 + if (!isspace(sel_pos(pe)) ||
4021 + atedge(pe, vc->vc_size_row))
4022 + break;
4023 + if (isspace(sel_pos(pe)))
4024 + new_sel_end = pe;
4025 + }
4026 + if ((new_sel_start == sel_start)
4027 + && (new_sel_end == sel_end)) /* no action required */
4028 + return 0;
4029 +
4030 + sel_start = new_sel_start;
4031 + sel_end = new_sel_end;
4032 + /* Allocate a new buffer before freeing the old one ... */
4033 + bp = kmalloc((sel_end-sel_start)/2+1, GFP_ATOMIC);
4034 + if (!bp) {
4035 + printk(KERN_WARNING "selection: kmalloc() failed\n");
4036 + speakup_clear_selection();
4037 + return -ENOMEM;
4038 + }
4039 + if (sel_buffer)
4040 + kfree(sel_buffer);
4041 + sel_buffer = bp;
4042 +
4043 + obp = bp;
4044 + for (i = sel_start; i <= sel_end; i += 2) {
4045 + *bp = sel_pos(i);
4046 + if (!isspace(*bp++))
4047 + obp = bp;
4048 + if (! ((i + 2) % vc->vc_size_row)) {
4049 + /* strip trailing blanks from line and add newline,
4050 + unless non-space at end of line. */
4051 + if (obp != bp) {
4052 + bp = obp;
4053 + *bp++ = '\r';
4054 + }
4055 + obp = bp;
4056 + }
4057 + }
4058 + sel_buffer_lth = bp - sel_buffer;
4059 + return 0;
4060 +}
4061 +
4062 +static int
4063 +speakup_paste_selection(struct tty_struct *tty)
4064 +{
4065 + struct vc_data *vc = (struct vc_data *) tty->driver_data;
4066 + int pasted = 0, count;
4067 + DECLARE_WAITQUEUE(wait, current);
4068 + add_wait_queue(&vc->paste_wait, &wait);
4069 + while (sel_buffer && sel_buffer_lth > pasted) {
4070 + set_current_state(TASK_INTERRUPTIBLE);
4071 + if (test_bit(TTY_THROTTLED, &tty->flags)) {
4072 + schedule();
4073 + continue;
4074 + }
4075 + count = sel_buffer_lth - pasted;
4076 + count = MIN(count, tty->receive_room);
4077 + tty->ldisc.receive_buf(tty, sel_buffer + pasted, 0, count);
4078 + pasted += count;
4079 + }
4080 + remove_wait_queue(&vc->paste_wait, &wait);
4081 + current->state = TASK_RUNNING;
4082 + return 0;
4083 +}
4084 +
4085 +static void
4086 +speakup_cut (struct vc_data *vc )
4087 +{
4088 + static const char err_buf[] = "set selection failed";
4089 + int ret;
4090 +
4091 + if (!mark_cut_flag ) {
4092 + mark_cut_flag = 1;
4093 + xs = spk_x;
4094 + ys = spk_y;
4095 + spk_sel_cons = vc;
4096 + synth_write_msg ("mark" );
4097 + return;
4098 + }
4099 + xe = (u_short ) spk_x;
4100 + ye = (u_short )spk_y;
4101 + mark_cut_flag = 0;
4102 + synth_write_msg ("cut" );
4103 +
4104 + speakup_clear_selection( );
4105 + ret = speakup_set_selection ( tty );
4106 +
4107 + switch (ret ) {
4108 + case 0:
4109 + break; /* no error */
4110 + case -EFAULT :
4111 + pr_warn( "%sEFAULT\n", err_buf );
4112 + break;
4113 + case -EINVAL :
4114 + pr_warn( "%sEINVAL\n", err_buf );
4115 + break;
4116 + case -ENOMEM :
4117 + pr_warn( "%sENOMEM\n", err_buf );
4118 + break;
4119 + }
4120 +}
4121 +
4122 +static void
4123 +speakup_paste (struct vc_data *vc )
4124 +{
4125 + if (mark_cut_flag ) {
4126 + mark_cut_flag = 0;
4127 + synth_write_msg ("mark, cleared" );
4128 + } else {
4129 + synth_write_msg ("paste" );
4130 + speakup_paste_selection (tty );
4131 + }
4132 +}
4133 +
4134 +static void
4135 +say_attributes (struct vc_data *vc )
4136 +{
4137 + int fg= spk_attr&0x0f, bg = spk_attr>>4;
4138 + if (fg > 8 ) {
4139 + synth_write_string("bright " );
4140 + fg -= 8;
4141 + }
4142 + synth_write_string(colors[fg] );
4143 + if (bg > 7 ) {
4144 + synth_write_string(" on blinking " );
4145 + bg -= 8;
4146 + } else
4147 + synth_write_string(" on " );
4148 + synth_write_msg(colors[bg] );
4149 +}
4150 +
4151 +static char *blank_msg = "blank";
4152 +static char *edges[] = { "top, ", "bottom, ", "left, ", "right, ", "" };
4153 +enum { edge_top = 1, edge_bottom, edge_left, edge_right, edge_quiet };
4154 +
4155 +static void
4156 +announce_edge (struct vc_data *vc, int msg_id )
4157 +{
4158 + if (bleeps&1 )
4159 + bleep (spk_y );
4160 + if (bleeps&2 )
4161 + synth_write_msg (edges[msg_id-1] );
4162 +}
4163 +
4164 +static void
4165 +speak_char( u_char ch )
4166 +{
4167 + char *cp = characters[ ch];
4168 + if (cp == NULL) {
4169 + pr_info ("speak_char: cp==NULL!\n");
4170 + return;
4171 + }
4172 + synth_buffer_add( SPACE );
4173 + if (IS_CHAR(ch, B_CAP ) ) {
4174 + pitch_shift++;
4175 + synth_write_string(str_caps_start );
4176 + synth_write_string(cp );
4177 + synth_write_string(str_caps_stop );
4178 + } else {
4179 + if (*cp == '^' ) {
4180 + synth_write_string(str_ctl );
4181 + cp++;
4182 + }
4183 + synth_write_string(cp );
4184 + }
4185 + synth_buffer_add( SPACE );
4186 +}
4187 +
4188 +static void
4189 +say_char (struct vc_data *vc )
4190 +{
4191 + u_short ch;
4192 + spk_old_attr = spk_attr;
4193 + ch = get_char (vc, (u_short * ) spk_pos );
4194 + spk_attr = ((ch & 0xff00 ) >> 8 );
4195 + if (spk_attr != spk_old_attr ) {
4196 + if ( attrib_bleep&1 ) bleep (spk_y );
4197 + if ( attrib_bleep&2 ) say_attributes( vc );
4198 + }
4199 + speak_char( ch&0xff );
4200 +}
4201 +
4202 +static void
4203 +say_phonetic_char (struct vc_data *vc )
4204 +{
4205 + u_short ch;
4206 + spk_old_attr = spk_attr;
4207 + ch = get_char (vc, (u_short * ) spk_pos );
4208 + spk_attr = ((ch & 0xff00 ) >> 8 );
4209 + if ( IS_CHAR(ch, B_ALPHA ) ) {
4210 + ch &= 0x1f;
4211 + synth_write_msg(phonetic[--ch] );
4212 + } else {
4213 + if ( IS_CHAR(ch, B_NUM ) )
4214 + synth_write_string( "number " );
4215 + speak_char( ch );
4216 + }
4217 +}
4218 +
4219 +static void
4220 +say_prev_char (struct vc_data *vc )
4221 +{
4222 + spk_parked |= 0x01;
4223 + if (spk_x == 0 ) {
4224 + announce_edge(vc, edge_left );
4225 + return;
4226 + }
4227 + spk_x--;
4228 + spk_pos -= 2;
4229 + say_char (vc );
4230 +}
4231 +
4232 +static void
4233 +say_next_char (struct vc_data *vc )
4234 +{
4235 + spk_parked |= 0x01;
4236 + if (spk_x == vc->vc_cols - 1 ) {
4237 + announce_edge(vc, edge_right );
4238 + return;
4239 + }
4240 + spk_x++;
4241 + spk_pos += 2;
4242 + say_char (vc );
4243 +}
4244 +
4245 +/* get_word - will first check to see if the character under the
4246 + reading cursor is a space and if say_word_ctl is true it will
4247 + return the word space. If say_word_ctl is not set it will check to
4248 + see if there is a word starting on the next position to the right
4249 + and return that word if it exists. If it does not exist it will
4250 + move left to the beginning of any previous word on the line or the
4251 + beginning off the line whichever comes first.. */
4252 +
4253 +static u_long
4254 +get_word (struct vc_data *vc )
4255 +{
4256 + u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
4257 + char ch;
4258 + u_short attr_ch;
4259 + spk_old_attr = spk_attr;
4260 + ch = (char ) get_char (vc, (u_short * ) tmp_pos );
4261 +
4262 +/* decided to take out the sayword if on a space (mis-information */
4263 + if ( say_word_ctl && ch == SPACE ) {
4264 + *buf = '\0';
4265 + synth_write_msg( "space" );
4266 + return 0;
4267 + } else if ((tmpx < vc->vc_cols-2 )
4268 + && (ch == SPACE || IS_WDLM(ch ))
4269 + && ((char) get_char (vc, (u_short * ) tmp_pos+1 ) > SPACE)) {
4270 + tmp_pos += 2;
4271 + tmpx++;
4272 + } else
4273 + while (tmpx > 0 ) {
4274 + if (((ch = (char ) get_char (vc, (u_short * ) tmp_pos-1 )) == SPACE
4275 + || IS_WDLM(ch ))
4276 + && ((char) get_char (vc, (u_short * ) tmp_pos ) > SPACE))
4277 + break;
4278 + tmp_pos -= 2;
4279 + tmpx--;
4280 + }
4281 + attr_ch = get_char (vc, (u_short * ) tmp_pos );
4282 + spk_attr = attr_ch >> 8;
4283 + buf[cnt++] = attr_ch&0xff;
4284 + while (tmpx < vc->vc_cols-1 ) {
4285 + tmp_pos += 2;
4286 + tmpx++;
4287 + ch = (char ) get_char (vc, (u_short * ) tmp_pos );
4288 + if ((ch == SPACE )
4289 + || (IS_WDLM(buf[cnt-1] ) && ( ch > SPACE )))
4290 + break;
4291 + buf[cnt++] = ch;
4292 + }
4293 + buf[cnt] = '\0';
4294 + return cnt;
4295 +}
4296 +
4297 +static void
4298 +say_word (struct vc_data *vc )
4299 +{
4300 + u_long cnt = get_word(vc );
4301 + u_short saved_punc_mask = punc_mask;
4302 + if ( cnt == 0 ) return;
4303 + punc_mask = PUNC;
4304 + buf[cnt++] = SPACE;
4305 + spkup_write (buf, cnt );
4306 + punc_mask = saved_punc_mask;
4307 +}
4308 +
4309 +static void
4310 +say_prev_word (struct vc_data *vc )
4311 +{
4312 + char ch;
4313 + u_short edge_said = 0, last_state = 0, state = 0;
4314 + spk_parked |= 0x01;
4315 + if (spk_x == 0 ) {
4316 + if ( spk_y == 0 ) {
4317 + announce_edge(vc, edge_top );
4318 + return;
4319 + }
4320 + spk_y--;
4321 + spk_x = vc->vc_cols;
4322 + edge_said = edge_quiet;
4323 + }
4324 + while ( 1 ) {
4325 + if (spk_x == 0 ) {
4326 + if (spk_y == 0 ) {
4327 + edge_said = edge_top;
4328 + break;
4329 + }
4330 + if ( edge_said != edge_quiet ) edge_said = edge_left;
4331 + if ( state > 0 ) break;
4332 + spk_y--;
4333 + spk_x = vc->vc_cols-1;
4334 + } else spk_x--;
4335 + spk_pos -= 2;
4336 + ch = (char ) get_char (vc, (u_short * ) spk_pos );
4337 + if ( ch == SPACE ) state = 0;
4338 + else if (IS_WDLM(ch ) ) state = 1;
4339 + else state = 2;
4340 + if (state < last_state ) {
4341 + spk_pos += 2;
4342 + spk_x++;
4343 + break;
4344 + }
4345 + last_state = state;
4346 + }
4347 + if ( spk_x == 0 && edge_said == edge_quiet )
4348 + edge_said = edge_left;
4349 + if ( edge_said > 0 && edge_said < edge_quiet )
4350 + announce_edge( vc, edge_said );
4351 + say_word (vc );
4352 +}
4353 +
4354 +static void
4355 +say_next_word (struct vc_data *vc )
4356 +{
4357 + char ch;
4358 + u_short edge_said = 0, last_state = 2, state = 0;
4359 + spk_parked |= 0x01;
4360 + if ( spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows-1 ) {
4361 + announce_edge(vc, edge_bottom );
4362 + return;
4363 + }
4364 + while ( 1 ) {
4365 + ch = (char ) get_char (vc, (u_short * ) spk_pos );
4366 + if ( ch == SPACE ) state = 0;
4367 + else if (IS_WDLM(ch ) ) state = 1;
4368 + else state = 2;
4369 + if ( state > last_state ) break;
4370 + if (spk_x >= vc->vc_cols-1 ) {
4371 + if (spk_y == vc->vc_rows-1 ) {
4372 + edge_said = edge_bottom;
4373 + break;
4374 + }
4375 + state = 0;
4376 + spk_y++;
4377 + spk_x = 0;
4378 + edge_said = edge_right;
4379 + } else spk_x++;
4380 + spk_pos += 2;
4381 + last_state = state;
4382 + }
4383 + if ( edge_said > 0 )
4384 + announce_edge( vc, edge_said );
4385 + say_word (vc );
4386 +}
4387 +
4388 +static void
4389 +spell_word (struct vc_data *vc )
4390 +{
4391 + static char *delay_str[] = { " ", ", ", ". ", ". . ", ". . . " };
4392 + char *cp = buf, *str_cap= str_caps_stop;
4393 + char *cp1, *last_cap = str_caps_stop;
4394 + u_char ch;
4395 + if ( !get_word(vc ) ) return;
4396 + while ((ch = (u_char )*cp ) ) {
4397 + if ( cp != buf )
4398 + synth_write_string (delay_str[spell_delay] );
4399 + if (IS_CHAR(ch, B_CAP ) ) {
4400 + str_cap = str_caps_start;
4401 + if ( *str_caps_stop ) pitch_shift++;
4402 + else last_cap = str_caps_stop; /* synth has no pitch */
4403 + } else str_cap = str_caps_stop;
4404 + if ( str_cap !=last_cap ) {
4405 + synth_write_string( str_cap );
4406 + last_cap = str_cap;
4407 + }
4408 + if ( this_speakup_key == SPELL_PHONETIC && ( IS_CHAR( ch, B_ALPHA ) ) ) {
4409 + ch &= 31;
4410 + cp1 = phonetic[--ch];
4411 + } else {
4412 + cp1 = characters[ch];
4413 + if (*cp1 == '^' ) {
4414 + synth_write_string(str_ctl );
4415 + cp1++;
4416 + }
4417 + }
4418 + synth_write_string(cp1 );
4419 + cp++;
4420 + }
4421 + if ( str_cap != str_caps_stop )
4422 + synth_write_string( str_caps_stop );
4423 +}
4424 +
4425 +static int
4426 +get_line (struct vc_data *vc )
4427 +{
4428 + u_long tmp = spk_pos - (spk_x * 2 );
4429 + int i = 0;
4430 + spk_old_attr = spk_attr;
4431 + spk_attr = get_attributes ((u_short * ) spk_pos );
4432 + for (i = 0; i < vc->vc_cols; i++ ) {
4433 + buf[i] = (u_char ) get_char (vc, (u_short * ) tmp );
4434 + tmp += 2;
4435 + }
4436 + for (--i; i >= 0; i-- )
4437 + if (buf[i] != SPACE ) break;
4438 + return ++i;
4439 +}
4440 +
4441 +static void
4442 +say_line (struct vc_data *vc )
4443 +{
4444 + int i = get_line( vc );
4445 + char *cp;
4446 + char num_buf[8];
4447 + u_short saved_punc_mask = punc_mask;
4448 + if (i == 0 ) {
4449 + synth_write_msg (blank_msg );
4450 + return;
4451 + }
4452 + buf[i++] = '\n';
4453 + if ( this_speakup_key == SAY_LINE_INDENT ) {
4454 + for ( cp = buf; *cp == SPACE; cp++ );
4455 + sprintf( num_buf, "%d, ", ( cp-buf )+1 );
4456 + synth_write_string( num_buf );
4457 + }
4458 + punc_mask = punc_masks[reading_punc];
4459 + spkup_write (buf, i );
4460 + punc_mask = saved_punc_mask;
4461 +}
4462 +
4463 +static void
4464 +say_prev_line (struct vc_data *vc )
4465 +{
4466 + spk_parked |= 0x01;
4467 + if (spk_y == 0 ) {
4468 + announce_edge (vc, edge_top );
4469 + return;
4470 + }
4471 + spk_y--;
4472 + spk_pos -= vc->vc_size_row;
4473 + say_line (vc );
4474 +}
4475 +
4476 +static void
4477 +say_next_line (struct vc_data *vc )
4478 +{
4479 + spk_parked |= 0x01;
4480 + if (spk_y == vc->vc_rows - 1 ) {
4481 + announce_edge (vc, edge_bottom );
4482 + return;
4483 + }
4484 + spk_y++;
4485 + spk_pos += vc->vc_size_row;
4486 + say_line (vc );
4487 +}
4488 +
4489 +static int
4490 +say_from_to (struct vc_data *vc, u_long from, u_long to, int read_punc )
4491 +{
4492 + int i = 0;
4493 + u_short saved_punc_mask = punc_mask;
4494 + spk_old_attr = spk_attr;
4495 + spk_attr = get_attributes ((u_short * ) from );
4496 + while (from < to ) {
4497 + buf[i++] = (char ) get_char (vc, (u_short * ) from );
4498 + from += 2;
4499 + if ( i >= vc->vc_size_row ) break;
4500 + }
4501 + for (--i; i >= 0; i-- )
4502 + if (buf[i] != SPACE ) break;
4503 + buf[++i] = SPACE;
4504 + buf[++i] = '\0';
4505 + if ( i < 1 ) return i;
4506 + if ( read_punc ) punc_mask = punc_info[reading_punc].mask;
4507 + spkup_write (buf, i );
4508 + if ( read_punc ) punc_mask = saved_punc_mask;
4509 + return i-1;
4510 +}
4511 +
4512 +static void
4513 +say_line_from_to (struct vc_data *vc, u_long from, u_long to, int read_punc )
4514 +{
4515 + u_long start = vc->vc_origin+(spk_y*vc->vc_size_row );
4516 + u_long end = start+( to * 2 );
4517 + start += from*2;
4518 + if ( say_from_to( vc, start, end, read_punc ) <= 0 )
4519 + if ( cursor_track != read_all_mode )
4520 + synth_write_msg (blank_msg );
4521 +}
4522 +
4523 +// Sentence Reading Commands
4524 +
4525 +void synth_insert_next_index( int );
4526 +
4527 +int currsentence;
4528 +int numsentences[2];
4529 +char *sentbufend[2];
4530 +char *sentmarks[2][10];
4531 +int currbuf=0;
4532 +int bn;
4533 +static char sentbuf[2][256];
4534 +
4535 +static int
4536 +say_sentence_num ( int num , int prev )
4537 +{
4538 + bn=currbuf;
4539 + currsentence=num+1;
4540 + if (prev) {
4541 + if (--bn == -1) bn=1;
4542 + }
4543 +
4544 + if (num>numsentences[bn])
4545 + return 0;
4546 + spkup_write (sentmarks[bn][num], sentbufend[bn]-sentmarks[bn][num]);
4547 + return 1;
4548 +}
4549 +
4550 +static int
4551 +get_sentence_buf (struct vc_data *vc, int read_punc )
4552 +{
4553 + u_long start,end;
4554 + int i,bn;
4555 + currbuf++;
4556 + if ( currbuf == 2 )
4557 + currbuf=0;
4558 + bn=currbuf;
4559 + start = vc->vc_origin+((spk_y)*vc->vc_size_row );
4560 + end = vc->vc_origin+((spk_y)*vc->vc_size_row ) + vc->vc_cols*2;
4561 +
4562 + numsentences[bn]=0;
4563 + sentmarks[bn][0]=&sentbuf[bn][0];
4564 + i = 0;
4565 + spk_old_attr = spk_attr;
4566 + spk_attr = get_attributes ((u_short * ) start );
4567 +
4568 + while (start < end ) {
4569 + sentbuf[bn][i] = (char ) get_char (vc, (u_short * ) start );
4570 + if (i>0)
4571 + {
4572 + if ((sentbuf[bn][i]==SPACE)&&(sentbuf[bn][i-1]=='.')&&(numsentences[bn]<9))
4573 + {
4574 + // Sentence Marker
4575 + numsentences[bn]++;
4576 + sentmarks[bn][numsentences[bn]]=&sentbuf[bn][i];
4577 + }
4578 + }
4579 + i++;
4580 + start += 2;
4581 + if ( i >= vc->vc_size_row )
4582 + break;
4583 + }
4584 +
4585 + for (--i; i >= 0; i-- )
4586 + if (sentbuf[bn][i] != SPACE )
4587 + break;
4588 +
4589 + if ( i < 1 )
4590 + return -1;
4591 +
4592 + sentbuf[bn][++i] = SPACE;
4593 + sentbuf[bn][++i] = '\0';
4594 +
4595 + sentbufend[bn]=&sentbuf[bn][i];
4596 + return numsentences[bn];
4597 +}
4598 +
4599 +//
4600 +
4601 +static void
4602 +say_screen_from_to (struct vc_data *vc, u_long from, u_long to )
4603 +{
4604 + u_long start = vc->vc_origin, end;
4605 + if ( from > 0 ) start += from * vc->vc_size_row;
4606 + if ( to > vc->vc_rows ) to = vc->vc_rows;
4607 + end = vc->vc_origin + ( to * vc->vc_size_row);
4608 + for ( from = start; from < end; from = to ) {
4609 + to = from + vc->vc_size_row;
4610 + say_from_to( vc, from, to, 1 );
4611 + }
4612 +}
4613 +
4614 +static void
4615 +say_screen (struct vc_data *vc )
4616 +{
4617 + say_screen_from_to( vc, 0, vc->vc_rows );
4618 +}
4619 +
4620 +static void
4621 +speakup_win_say (struct vc_data *vc )
4622 +{
4623 + u_long start, end, from, to;
4624 + if ( win_start < 2 ) {
4625 + synth_write_msg( "no window" );
4626 + return;
4627 + }
4628 + start = vc->vc_origin + ( win_top * vc->vc_size_row );
4629 + end = vc->vc_origin + ( win_bottom * vc->vc_size_row );
4630 + while ( start <= end ) {
4631 + from = start + ( win_left * 2 );
4632 + to = start + ( win_right * 2 );
4633 + say_from_to( vc, from, to, 1 );
4634 + start += vc->vc_size_row;
4635 + }
4636 +}
4637 +
4638 +static void
4639 +top_edge (struct vc_data *vc )
4640 +{
4641 + spk_parked |= 0x01;
4642 + spk_pos = vc->vc_origin + 2 * spk_x;
4643 + spk_y = 0;
4644 + say_line (vc );
4645 +}
4646 +
4647 +static void
4648 +bottom_edge (struct vc_data *vc )
4649 +{
4650 + spk_parked |= 0x01;
4651 + spk_pos += (vc->vc_rows - spk_y - 1 ) * vc->vc_size_row;
4652 + spk_y = vc->vc_rows - 1;
4653 + say_line (vc );
4654 +}
4655 +
4656 +static void
4657 +left_edge (struct vc_data *vc )
4658 +{
4659 + spk_parked |= 0x01;
4660 + spk_pos -= spk_x * 2;
4661 + spk_x = 0;
4662 + say_char (vc );
4663 +}
4664 +
4665 +static void
4666 +right_edge (struct vc_data *vc )
4667 +{
4668 + spk_parked |= 0x01;
4669 + spk_pos += (vc->vc_cols - spk_x - 1 ) * 2;
4670 + spk_x = vc->vc_cols - 1;
4671 + say_char (vc );
4672 +}
4673 +
4674 +static void
4675 +say_first_char (struct vc_data *vc )
4676 +{
4677 + int i, len = get_line( vc );
4678 + u_char ch;
4679 + spk_parked |= 0x01;
4680 + if ( len == 0 ) {
4681 + synth_write_msg( blank_msg );
4682 + return;
4683 + }
4684 + for ( i = 0; i < len; i++ ) if ( buf[i] != SPACE ) break;
4685 + ch = buf[i];
4686 + spk_pos -= ( spk_x-i ) * 2;
4687 + spk_x = i;
4688 + sprintf (buf, "%d, ", ++i );
4689 + synth_write_string (buf );
4690 + speak_char( ch );
4691 +}
4692 +
4693 +static void
4694 +say_last_char (struct vc_data *vc )
4695 +{
4696 + int len = get_line( vc );
4697 + u_char ch;
4698 + spk_parked |= 0x01;
4699 + if ( len == 0 ) {
4700 + synth_write_msg( blank_msg );
4701 + return;
4702 + }
4703 + ch = buf[--len];
4704 + spk_pos -= ( spk_x-len ) * 2;
4705 + spk_x = len;
4706 + sprintf (buf, "%d, ", ++len );
4707 + synth_write_string (buf );
4708 + speak_char( ch );
4709 +}
4710 +
4711 +static void
4712 +say_position (struct vc_data *vc )
4713 +{
4714 + sprintf (buf, "line %ld, col %ld, t t y %d\n", spk_y + 1,
4715 + spk_x + 1, vc->vc_num + 1 );
4716 + synth_write_string (buf );
4717 +}
4718 +
4719 +// Added by brianb
4720 +static void
4721 +say_char_num (struct vc_data *vc )
4722 +{
4723 + u_short ch = get_char(vc, (u_short * ) spk_pos);
4724 + ch &= 0x0ff;
4725 + sprintf (buf, "hex %02x, decimal %d", ch, ch );
4726 + synth_write_msg (buf );
4727 +}
4728 +
4729 +/* these are stub functions to keep keyboard.c happy. */
4730 +
4731 +static void
4732 +say_from_top (struct vc_data *vc )
4733 +{
4734 + say_screen_from_to (vc, 0, spk_y );
4735 +}
4736 +
4737 +static void
4738 +say_to_bottom (struct vc_data *vc )
4739 +{
4740 + say_screen_from_to (vc, spk_y, vc->vc_rows );
4741 +}
4742 +
4743 +static void
4744 +say_from_left (struct vc_data *vc )
4745 +{
4746 + say_line_from_to (vc, 0, spk_x, 1 );
4747 +}
4748 +
4749 +static void
4750 +say_to_right (struct vc_data *vc )
4751 +{
4752 + say_line_from_to (vc, spk_x, vc->vc_cols, 1 );
4753 +}
4754 +
4755 +/* end of stub functions. */
4756 +
4757 +static void
4758 +spkup_write (const char *in_buf, int count )
4759 +{
4760 + static int rep_count = 0;
4761 + static u_char ch = '\0', old_ch = '\0';
4762 + static u_short char_type = 0, last_type = 0;
4763 + static u_char *exn_ptr = NULL;
4764 + int in_count = count;
4765 + char rpt_buf[32];
4766 + spk_keydown = 0;
4767 + while ( count-- ) {
4768 + if ( cursor_track == read_all_mode ) {
4769 + // Insert Sentence Index
4770 + if (( in_buf == sentmarks[bn][currsentence] ) &&
4771 + ( currsentence <= numsentences[bn] ))
4772 + synth_insert_next_index(currsentence++);
4773 + }
4774 + ch = (u_char )*in_buf++;
4775 + char_type = spk_chartab[ch];
4776 + if (ch == old_ch && !(char_type&B_NUM ) ) {
4777 + if (++rep_count > 2 ) continue;
4778 + } else {
4779 + if ( (last_type&CH_RPT) && rep_count > 2 ) {
4780 + sprintf (rpt_buf, " times %d . ", ++rep_count );
4781 + synth_write_string (rpt_buf );
4782 + }
4783 + rep_count = 0;
4784 + }
4785 + if ( !( char_type&B_NUM ) )
4786 + exn_ptr = NULL;
4787 + if (ch == spk_lastkey ) {
4788 + rep_count = 0;
4789 + if ( key_echo == 1 && ch >= MINECHOCHAR )
4790 + speak_char( ch );
4791 + } else if ( ( char_type&B_ALPHA ) ) {
4792 + if ( (synth_flags&SF_DEC) && (last_type&PUNC) )
4793 + synth_buffer_add ( SPACE );
4794 + synth_write( &ch, 1 );
4795 + } else if ( ( char_type&B_NUM ) ) {
4796 + rep_count = 0;
4797 + if ( (last_type&B_EXNUM) && synth_buff_in == exn_ptr+1 ) {
4798 + synth_buff_in--;
4799 + synth_buffer_add( old_ch );
4800 + exn_ptr = NULL;
4801 + }
4802 + synth_write( &ch, 1 );
4803 + } else if ( (char_type&punc_mask) ) {
4804 + speak_char( ch );
4805 + char_type &= ~PUNC; /* for dec nospell processing */
4806 + } else if ( ( char_type&SYNTH_OK ) ) {
4807 +/* these are usually puncts like . and , which synth needs for expression.
4808 + * suppress multiple to get rid of long pausesand clear repeat count so if
4809 + *someone has repeats on you don't get nothing repeated count */
4810 + if ( ch != old_ch )
4811 + synth_write( &ch, 1 );
4812 + else rep_count = 0;
4813 + } else {
4814 + if ( ( char_type&B_EXNUM ) )
4815 + exn_ptr = (u_char *)synth_buff_in;
4816 +/* send space and record position, if next is num overwrite space */
4817 + if ( old_ch != ch ) synth_buffer_add ( SPACE );
4818 + else rep_count = 0;
4819 + }
4820 + old_ch = ch;
4821 + last_type = char_type;
4822 + }
4823 + spk_lastkey = 0;
4824 + if (in_count > 2 && rep_count > 2 ) {
4825 + if ( (last_type&CH_RPT) ) {
4826 + sprintf (rpt_buf, " repeated %d . ", ++rep_count );
4827 + synth_write_string (rpt_buf );
4828 + }
4829 + rep_count = 0;
4830 + }
4831 +}
4832 +
4833 +static char *ctl_key_ids[] = {
4834 + "shift", "altgr", "control", "ault", "l shift", "speakup",
4835 +"l control", "r control"
4836 +};
4837 +#define NUM_CTL_LABELS 8
4838 +
4839 +static void read_all_doc( struct vc_data *vc);
4840 +void cursor_stop_timer(void );
4841 +
4842 +static void
4843 +handle_shift( KBD_PROTO )
4844 +{
4845 + (*do_shift)( KBD_ARGS );
4846 + if ( synth == NULL || up_flag || spk_killed ) return;
4847 + if (cursor_track==read_all_mode) {
4848 + switch (value) {
4849 + case KVAL(K_SHIFT):
4850 + cursor_stop_timer( );
4851 + spk_shut_up &= 0xfe;
4852 + do_flush();
4853 + read_all_doc( vc );
4854 + break;
4855 + case KVAL(K_CTRL):
4856 + cursor_stop_timer( );
4857 + cursor_track=prev_cursor_track;
4858 + spk_shut_up &= 0xfe;
4859 + do_flush();
4860 + break;
4861 + }
4862 + }
4863 + else
4864 + {
4865 + spk_shut_up &= 0xfe;
4866 + do_flush();
4867 + }
4868 + if ( say_ctrl && value < NUM_CTL_LABELS )
4869 + synth_write_string ( ctl_key_ids[value] );
4870 +}
4871 +
4872 +static void
4873 +handle_latin( KBD_PROTO )
4874 +{
4875 + (*do_latin)( KBD_ARGS );
4876 + if ( up_flag ) {
4877 + spk_lastkey = spk_keydown = 0;
4878 + return;
4879 + }
4880 + if ( synth == NULL || spk_killed ) return;
4881 + spk_shut_up &= 0xfe;
4882 + spk_lastkey = value;
4883 + spk_keydown++;
4884 + spk_parked &= 0xfe;
4885 + if ( key_echo == 2 && value >= MINECHOCHAR )
4886 + speak_char( value );
4887 +}
4888 +
4889 +static int
4890 +set_key_info( u_char *key_info, u_char *k_buffer )
4891 +{
4892 + int i = 0, states, key_data_len;
4893 + u_char *cp = key_info, *cp1 = k_buffer;
4894 + u_char ch, version, num_keys;
4895 + version = *cp++;
4896 + if ( version != KEY_MAP_VER ) return -1;
4897 + num_keys = *cp;
4898 + states = (int)cp[1];
4899 + key_data_len = ( states+1 ) * ( num_keys+1 );
4900 + if ( key_data_len+SHIFT_TBL_SIZE+4 >= sizeof(key_buf ) ) return -2;
4901 + memset( k_buffer, 0, SHIFT_TBL_SIZE );
4902 + memset( our_keys, 0, sizeof( our_keys ) );
4903 + shift_table = k_buffer;
4904 + our_keys[0] = shift_table;
4905 + cp1 += SHIFT_TBL_SIZE;
4906 + memcpy( cp1, cp, key_data_len+3 );
4907 +/* get num_keys, states and data*/
4908 + cp1 += 2; /* now pointing at shift states */
4909 + for ( i = 1; i <= states; i++ ) {
4910 + ch = *cp1++;
4911 + if ( ch >= SHIFT_TBL_SIZE ) return -3;
4912 + shift_table[ch] = i;
4913 + }
4914 + keymap_flags = *cp1++;
4915 + while ( ( ch = *cp1 ) ) {
4916 + if ( ch >= MAX_KEY ) return -4;
4917 + our_keys[ch] = cp1;
4918 + cp1 += states+1;
4919 + }
4920 + return 0;
4921 +}
4922 +
4923 +num_var spk_num_vars[] = { /* bell must be first to set high limit */
4924 + { BELL_POS, 0, 0, 0, 0, 0, 0, 0 },
4925 + { SPELL_DELAY, 0, 0, 0, 5, 0, 0, 0 },
4926 + { ATTRIB_BLEEP, 0, 1, 0, 3, 0, 0, 0 },
4927 + { BLEEPS, 0, 3, 0, 3, 0, 0, 0 },
4928 + { BLEEP_TIME, 0, 30, 1, 200, 0, 0, 0 },
4929 + { PUNC_LEVEL, 0, 1, 0, 4, 0, 0, 0 },
4930 + { READING_PUNC, 0, 1, 0, 4, 0, 0, 0 },
4931 + { CURSOR_TIME, 0, 120, 50, 600, 0, 0, 0 },
4932 + { SAY_CONTROL, TOGGLE_0 },
4933 + { SAY_WORD_CTL, TOGGLE_0 },
4934 + { NO_INTERRUPT, TOGGLE_0 },
4935 + { KEY_ECHO, 0, 1, 0, 2, 0, 0, 0 },
4936 + V_LAST_NUM
4937 +};
4938 +
4939 +static char *cursor_msgs[] = { "cursoring off", "cursoring on",
4940 + "highlight tracking", "read windo",
4941 +"read all" };
4942 +
4943 +static void
4944 +toggle_cursoring( struct vc_data *vc )
4945 +{
4946 + if (cursor_track==read_all_mode)
4947 + cursor_track=prev_cursor_track;
4948 + if (++ cursor_track >= CT_Max )
4949 + cursor_track = 0;
4950 + synth_write_msg (cursor_msgs[cursor_track] );
4951 +}
4952 +
4953 +static void
4954 +reset_default_chars (void )
4955 +{
4956 + int i;
4957 + if (default_chars[(int )'a'] == NULL ) { /* lowers are null first time */
4958 + for (i = (int )'a'; default_chars[i] == NULL; i++ )
4959 + default_chars[i] = default_chars[i-32];
4960 + } else { /* free any non-default */
4961 + for (i = 0; i < 256; i++ ) {
4962 + if (characters[i] != default_chars[i] )
4963 + kfree (characters[i] );
4964 + }
4965 + }
4966 + memcpy( characters, default_chars, sizeof( default_chars ) );
4967 +}
4968 +
4969 +static void
4970 +reset_default_chartab (void )
4971 +{
4972 + memcpy( spk_chartab, default_chartab, sizeof( default_chartab ) );
4973 +}
4974 +
4975 +static void
4976 +handle_cursor( KBD_PROTO );
4977 +static void
4978 +handle_spec( KBD_PROTO );
4979 +static void
4980 +cursor_done(u_long data );
4981 +
4982 +declare_timer( cursor_timer );
4983 +
4984 +void __init speakup_open (struct vc_data *vc, spk_t *first_console )
4985 +{
4986 + int i;
4987 + num_var *n_var;
4988 +
4989 + reset_default_chars();
4990 + reset_default_chartab();
4991 + memset( speakup_console, 0, sizeof(speakup_console));
4992 + if ( first_console == NULL ) return;
4993 + memset( first_console, 0, spk_size);
4994 + speakup_console[vc->vc_num] = first_console;
4995 + speakup_date(vc);
4996 + pr_info ("%s: initialized\n", SPEAKUP_VERSION );
4997 + init_timer(&cursor_timer);
4998 + cursor_timer.entry.prev = NULL;
4999 + cursor_timer.function = cursor_done;
5000 + init_sleeper(synth_sleeping_list);
5001 + strlwr(synth_name);
5002 + spk_num_vars[0].high = vc->vc_cols;
5003 + for ( n_var = spk_num_vars; n_var->var_id >= 0; n_var++ )
5004 + speakup_register_var(n_var);
5005 + for (i = 1; punc_info[i].mask != 0; i++ )
5006 + set_mask_bits( 0, i, 2 );
5007 + do_latin = key_handler[KT_LATIN];
5008 + key_handler[KT_LATIN] = handle_latin;
5009 + do_spec = key_handler[KT_SPEC];
5010 + key_handler[KT_SPEC] = handle_spec;
5011 + do_cursor = key_handler[KT_CUR];
5012 + key_handler[KT_CUR] = handle_cursor;
5013 + do_shift = key_handler[KT_SHIFT];
5014 + key_handler[KT_SHIFT] = handle_shift;
5015 + set_key_info(key_defaults, key_buf);
5016 + if (quiet_boot) spk_shut_up |= 0x01;
5017 +}
5018 +
5019 +#ifdef CONFIG_PROC_FS
5020 +
5021 +// speakup /proc interface code
5022 +
5023 +/* Usage:
5024 +cat /proc/speakup/version
5025 +
5026 +cat /proc/speakup/characters > foo
5027 +less /proc/speakup/characters
5028 +vi /proc/speakup/characters
5029 +
5030 +cat foo > /proc/speakup/characters
5031 +cat > /proc/speakup/characters
5032 +echo 39 apostrophe > /proc/speakup/characters
5033 +echo 87 w > /proc/speakup/characters
5034 +echo 119 w > /proc/speakup/characters
5035 +echo defaults > /proc/speakup/characters
5036 +echo reset > /proc/speakup/characters
5037 +
5038 +
5039 +cat /proc/speakup/chartab > foo
5040 +less /proc/speakup/chartab
5041 +vi /proc/speakup/chartab
5042 +
5043 +cat foo > /proc/speakup/chartab
5044 +cat > /proc/speakup/chartab
5045 +echo 233 ALPHA > /proc/speakup/chartab
5046 +echo 46 A_PUNC > /proc/speakup/chartab
5047 +echo defaults > /proc/speakup/chartab
5048 +echo reset > /proc/speakup/chartab
5049 +*/
5050 +
5051 +// keymap handlers
5052 +
5053 +static int
5054 +keys_read_proc (PROC_READ_PROTOTYPE )
5055 +{
5056 + char *cp = page;
5057 + int i, n, num_keys, nstates;
5058 + u_char *cp1 = key_buf + SHIFT_TBL_SIZE, ch;
5059 + num_keys = (int)(*cp1);
5060 + nstates = (int)cp1[1];
5061 + cp += sprintf( cp, "%d, %d, %d,\n", KEY_MAP_VER, num_keys, nstates );
5062 + cp1 += 2; /* now pointing at shift states */
5063 +/* dump num_keys+1 as first row is shift states + flags,
5064 + each subsequent row is key + states */
5065 + for ( n = 0; n <= num_keys; n++ ) {
5066 + for ( i = 0; i <= nstates; i++ ) {
5067 + ch = *cp1++;
5068 + cp += sprintf( cp, "%d,", (int)ch );
5069 + *cp++ = ( i < nstates ) ? SPACE : '\n';
5070 + }
5071 + }
5072 + cp += sprintf( cp, "0, %d\n", KEY_MAP_VER );
5073 + *start = 0;
5074 + *eof = 1;
5075 + return (int)(cp-page);
5076 +}
5077 +
5078 +static char *
5079 +s2uchar ( char *start, char *dest )
5080 +{
5081 + int val = 0;
5082 + while ( *start && *start <= SPACE ) start++;
5083 + while ( *start >= '0' && *start <= '9' ) {
5084 + val *= 10;
5085 + val += ( *start ) - '0';
5086 + start++;
5087 + }
5088 + if ( *start == ',' ) start++;
5089 + *dest = (u_char)val;
5090 + return start;
5091 +}
5092 +
5093 +static int
5094 +keys_write_proc (PROC_WRITE_PROTOTYPE )
5095 +{
5096 + int i, ret = count;
5097 + char *in_buff, *cp;
5098 + u_char *cp1;
5099 + if (count < 1 || count > 1800 )
5100 + return -EINVAL;
5101 + in_buff = ( char * ) __get_free_page ( GFP_KERNEL );
5102 + if ( !in_buff ) return -ENOMEM;
5103 + if (copy_from_user (in_buff, buffer, count ) ) {
5104 + free_page ( ( unsigned long ) in_buff );
5105 + return -EFAULT;
5106 + }
5107 + if (in_buff[count - 1] == '\n' ) count--;
5108 + in_buff[count] = '\0';
5109 + if ( count == 1 && *in_buff == 'd' ) {
5110 + free_page ( ( unsigned long ) in_buff );
5111 + set_key_info( key_defaults, key_buf );
5112 + return ret;
5113 + }
5114 + cp = in_buff;
5115 + cp1 = (u_char *)in_buff;
5116 + for ( i = 0; i < 3; i++ ) {
5117 + cp = s2uchar( cp, cp1 );
5118 + cp1++;
5119 + }
5120 + i = (int)cp1[-2]+1;
5121 + i *= (int)cp1[-1]+1;
5122 + i+= 2; /* 0 and last map ver */
5123 + if ( cp1[-3] != KEY_MAP_VER || cp1[-1] > 10 ||
5124 + i+SHIFT_TBL_SIZE+4 >= sizeof(key_buf ) ) {
5125 +pr_warn( "i %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1] );
5126 + free_page ( ( unsigned long ) in_buff );
5127 + return -EINVAL;
5128 + }
5129 + while ( --i >= 0 ) {
5130 + cp = s2uchar( cp, cp1 );
5131 + cp1++;
5132 + if ( !(*cp) ) break;
5133 + }
5134 + if ( i != 0 || cp1[-1] != KEY_MAP_VER || cp1[-2] != 0 ) {
5135 + ret = -EINVAL;
5136 +pr_warn( "end %d %d %d %d\n", i, (int)cp1[-3], (int)cp1[-2], (int)cp1[-1] );
5137 + } else {
5138 + if ( set_key_info( in_buff, key_buf ) ) {
5139 + set_key_info( key_defaults, key_buf );
5140 + ret = -EINVAL;
5141 +pr_warn( "set key failed\n" );
5142 + }
5143 + }
5144 + free_page ( ( unsigned long ) in_buff );
5145 + return ret;
5146 +}
5147 +
5148 +// this is the handler for /proc/speakup/version
5149 +static int
5150 +version_read_proc (PROC_READ_PROTOTYPE )
5151 +{
5152 + int len = sprintf (page, "%s\n", SPEAKUP_VERSION );
5153 + if ( synth != NULL )
5154 + len += sprintf( page+len, "synth %s version %s\n",
5155 + synth->name, synth->version );
5156 + *start = 0;
5157 + *eof = 1;
5158 + return len;
5159 +}
5160 +
5161 +// this is the read handler for /proc/speakup/characters
5162 +static int
5163 +chars_read_proc (PROC_READ_PROTOTYPE )
5164 +{
5165 + int i, len = 0;
5166 + off_t begin = 0;
5167 + char *cp;
5168 + for (i = 0; i < 256; i++ ) {
5169 + cp = (characters[i] ) ? characters[i] : "NULL";
5170 + len += sprintf (page + len, "%d\t%s\n", i, cp );
5171 + if (len + begin > off + count )
5172 + break;
5173 + if (len + begin < off ) {
5174 + begin += len;
5175 + len = 0;
5176 + }
5177 + }
5178 + if (i >= 256 )
5179 + *eof = 1;
5180 + if (off >= len + begin )
5181 + return 0;
5182 + *start = page + (off - begin );
5183 + return ((count < begin + len - off ) ? count : begin + len - off );
5184 +}
5185 +
5186 +static volatile int chars_timer_active = 0; // indicates when timer is set
5187 +static declare_timer( chars_timer );
5188 +
5189 +static inline void
5190 +chars_stop_timer (void )
5191 +{
5192 + if (chars_timer_active )
5193 + stop_timer ( chars_timer );
5194 +}
5195 +
5196 +static int strings, rejects, updates;
5197 +
5198 +static void
5199 +show_char_results (u_long data )
5200 +{
5201 + int len;
5202 + char buf[80];
5203 + chars_stop_timer ( );
5204 + len = sprintf (buf, " updated %d of %d character descriptions\n",
5205 + updates, strings );
5206 + if (rejects )
5207 + sprintf (buf + (len-1), " with %d reject%s\n",
5208 + rejects, rejects > 1 ? "s" : "" );
5209 + printk( buf );
5210 +}
5211 +
5212 +// this is the read handler for /proc/speakup/chartab
5213 +static int
5214 +chartab_read_proc (PROC_READ_PROTOTYPE )
5215 +{
5216 + int i, len = 0;
5217 + off_t begin = 0;
5218 + char *cp;
5219 + for (i = 0; i < 256; i++ ) {
5220 + cp = "0";
5221 + if (IS_TYPE( i, B_CTL ))
5222 + cp = "B_CTL";
5223 + else if (IS_TYPE( i, WDLM ))
5224 + cp = "WDLM";
5225 + else if (IS_TYPE( i, A_PUNC ))
5226 + cp = "A_PUNC";
5227 + else if (IS_TYPE( i, PUNC ))
5228 + cp = "PUNC";
5229 + else if (IS_TYPE( i, NUM ))
5230 + cp = "NUM";
5231 + else if (IS_TYPE( i, A_CAP ))
5232 + cp = "A_CAP";
5233 + else if (IS_TYPE( i, ALPHA ))
5234 + cp = "ALPHA";
5235 + else if (IS_TYPE( i, B_CAPSYM ))
5236 + cp = "B_CAPSYM";
5237 + else if (IS_TYPE( i, B_SYM ))
5238 + cp = "B_SYM";
5239 +
5240 + len += sprintf (page + len, "%d\t%s\n", i, cp );
5241 + if (len + begin > off + count )
5242 + break;
5243 + if (len + begin < off ) {
5244 + begin += len;
5245 + len = 0;
5246 + }
5247 + }
5248 + if (i >= 256 )
5249 + *eof = 1;
5250 + if (off >= len + begin )
5251 + return 0;
5252 + *start = page + (off - begin );
5253 + return ((count < begin + len - off ) ? count : begin + len - off );
5254 +}
5255 +
5256 +static int
5257 +chartab_get_value (char* keyword)
5258 +{
5259 + int value = 0;
5260 +
5261 + if (!strcmp(keyword,"ALPHA"))
5262 + value = ALPHA;
5263 + else if (!strcmp(keyword,"B_CTL"))
5264 + value = B_CTL;
5265 + else if (!strcmp(keyword,"WDLM"))
5266 + value = WDLM;
5267 + else if (!strcmp(keyword,"A_PUNC"))
5268 + value = A_PUNC;
5269 + else if (!strcmp(keyword,"PUNC"))
5270 + value = PUNC;
5271 + else if (!strcmp(keyword,"NUM"))
5272 + value = NUM;
5273 + else if (!strcmp(keyword,"A_CAP"))
5274 + value = A_CAP;
5275 + else if (!strcmp(keyword,"B_CAPSYM"))
5276 + value = B_CAPSYM;
5277 + else if (!strcmp(keyword,"B_SYM"))
5278 + value = B_SYM;
5279 + return value;
5280 +}
5281 +
5282 +/* this is the write handler for /proc/speakup/silent */
5283 +static int
5284 +silent_write_proc (PROC_WRITE_PROTOTYPE )
5285 +{
5286 + struct vc_data *vc = vc_cons[fg_console].d;
5287 + char ch = 0, shut;
5288 + if (count > 0 || count < 3 ) {
5289 + get_user (ch, buffer );
5290 + if ( ch == '\n' ) ch = '0';
5291 + }
5292 + if ( ch < '0' || ch > '7' ) {
5293 + pr_warn ( "silent value not in range (0,7)\n" );
5294 + return count;
5295 + }
5296 + if ( (ch&2) ) {
5297 + shut = 1;
5298 + do_flush( );
5299 + } else shut = 0;
5300 + if ( (ch&4) ) shut |= 0x40;
5301 + if ( (ch&1) )
5302 + spk_shut_up |= shut;
5303 + else spk_shut_up &= ~shut;
5304 + return count;
5305 +}
5306 +
5307 +// this is the write handler for /proc/speakup/characters
5308 +static int
5309 +chars_write_proc (PROC_WRITE_PROTOTYPE )
5310 +{
5311 +#define max_desc_len 72
5312 + static int cnt = 0, state = 0;
5313 + static char desc[max_desc_len + 1];
5314 + static u_long jiff_last = 0;
5315 + short i = 0, num;
5316 + int len;
5317 + char ch, *cp, *p_new;
5318 + // reset certain vars if enough time has elapsed since last called
5319 + if (jiffies - jiff_last > 10 ) {
5320 + cnt = state = strings = rejects = updates = 0;
5321 + }
5322 + jiff_last = jiffies;
5323 +get_more:
5324 + desc[cnt] = '\0';
5325 + state = 0;
5326 + for (; i < count && state < 2; i++ ) {
5327 + get_user (ch, buffer + i );
5328 + if ( ch == '\n' ) {
5329 + desc[cnt] = '\0';
5330 + state = 2;
5331 + } else if (cnt < max_desc_len )
5332 + desc[cnt++] = ch;
5333 + }
5334 + if (state < 2 ) return count;
5335 + cp = desc;
5336 + while ( *cp && (unsigned char)(*cp) <= SPACE ) cp++;
5337 + if ((!cnt ) || strchr ("dDrR", *cp ) ) {
5338 + reset_default_chars ( );
5339 + pr_info( "character descriptions reset to defaults\n" );
5340 + cnt = 0;
5341 + return count;
5342 + }
5343 + cnt = 0;
5344 + if (*cp == '#' ) goto get_more;
5345 + num = -1;
5346 + cp = speakup_s2i(cp, &num );
5347 + while ( *cp && (unsigned char)(*cp) <= SPACE ) cp++;
5348 + if (num < 0 || num > 255 ) { // not in range
5349 + rejects++;
5350 + strings++;
5351 + goto get_more;
5352 + }
5353 + if (num >= 27 && num <= 31 ) goto get_more;
5354 + if (!strcmp(cp, characters[num] ) ) {
5355 + strings++;
5356 + goto get_more;
5357 + }
5358 + len = strlen(cp );
5359 + if (characters[num] == default_chars[num] )
5360 + p_new = (char * ) kmalloc (sizeof (char ) * len+1, GFP_KERNEL );
5361 + else if ( strlen(characters[num] ) >= len )
5362 + p_new = characters[num];
5363 + else {
5364 + kfree(characters[num] );
5365 + characters[num] = default_chars[num];
5366 + p_new = (char * ) kmalloc (sizeof (char ) * len+1, GFP_KERNEL );
5367 + }
5368 + if (!p_new ) return -ENOMEM;
5369 + strcpy ( p_new, cp );
5370 + characters[num] = p_new;
5371 + updates++;