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

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

Parent Directory Parent Directory | Revision Log Revision Log


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