Software: Apache/2.2.3 (CentOS). PHP/5.1.6 uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/doc/brlapi-0.4.1/ drwxr-xr-x | |
| Viewing file: Select action/file-type: BrlAPI Reference manual
Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
Samuel Thibault <Samuel.Thibault@ens-lyon.org>
V1.3, May 2005
This document describes BrlAPI.
______________________________________________________________________
Table of Contents
1. Introduction
1.1 Concepts
1.2 How to read this manual
2. General description of BrlAPI
2.1 Historical notes.
2.2 Why BrlAPI is part of brltty.
2.3 How it works.
2.3.1 Connection.
2.3.2 Authentication.
2.3.3 Real use of the braille terminal.
2.3.3.1 Braille display and braille key presses processing.
2.3.3.2 Raw mode.
2.3.3.3 Remarks.
2.3.4 Disconnection.
3. Concurrency management between BrlAPI clients
3.1 VT switching
3.2 A pile of "paper sheets" Let's look at VT 2 by itself. What is shown on the braille display can be seen as the result of a pile of two paper sheets. brltty is represented by the bottom sheet on which its screen reading is written, and client A by the top sheet on which its output is written. A's sheet hence "covers" brltty's sheet: A's output "mask" brltty's screen reading.
3.3 Hierarchy
3.4 The X-window case
3.5 Detaching
4. Installation and configuration of BrlAPI
5. Library description
5.1 Connecting to BrlAPI
5.2 Getting driver id and name
5.3 Getting display size
5.4 Entering raw mode, immediately leaving raw mode.
5.5 Getting tty control
5.6 Writing something on the display
5.7 Waiting for a key press
5.8 Leaving tty control
5.9 Disconnecting from BrlAPI
5.10 Putting everything together...
6. Writing (BrlAPI-compliant) drivers for brltty
6.1 Overview of the driver's structure
6.2 Basic driver structure
6.3 Enhancements for BrlAPI
6.3.1 Reading braille key codes
6.3.1.1 Remarks
6.3.2 Exchanging raw data packets
6.3.2.1 Remarks.
7. Protocol reference
7.1 Reliable packet transmission channel
7.2 Responses from the server
7.3 Operating modes
7.4 Details for each type of packet
7.4.1 BRLPACKET_AUTHKEY (see brlapi_loadAuthKey())
7.4.2 BRLPACKET_GETDRIVERID (see brlapi_getDriverId())
7.4.3 BRLPACKET_GETDRIVERNAME (see brlapi_getDriverName())
7.4.4 BRLPACKET_GETDISPLAYSIZE (see brlapi_getDisplaySize())
7.4.5 BRLPACKET_GETTTY (see brlapi_getTty())
7.4.6 BRLPACKET_KEY (see brlapi_readKey())
7.4.7 BRLPACKET_SETFOCUS (see brlapi_setFocus())
7.4.8 BRLPACKET_LEAVETTY (see brlapi_leaveTty())
7.4.9 BRLPACKET_IGNOREKEYRANGE, BRLPACKET_UNIGNOREKEYRANGE, BRLPACKET_IGNOREKEYSET and BRLPACKET_UNIGNOREKEYSET (see brlapi_ignoreKeyRange(), brlapi_unignoreKeyRange, brlapi_ignoreKeySet(), and brlapi_unignoreKeySet())
7.4.10 BRLPACKET_WRITE (see brlapi_write())
7.4.11 BRLPACKET_GETRAW (see brlapi_getRaw())
7.4.12 BRLPACKET_LEAVERAW (see brlapi_leaveRaw())
7.4.13 BRLPACKET_PACKET (see brlapi_sendRaw() and brlapi_recvRaw())
______________________________________________________________________
[1m1. Introduction[0m
[4mBrlAPI[24m is a service provided by the [4mbrltty[24m daemon.
Its purpose is to allow programmers to write applications that take
advantage of a braille terminal in order to deliver a blind user
suitable information for his/her specific needs.
While an application communicates with the braille terminal,
everything [4mbrltty[24m sends to the braille terminal in the application's
console is ignored, whereas each piece of data coming from the braille
terminal is sent to the application, rather than to [4mbrltty[24m.
[1m1.1. Concepts[0m
All throughout this manual, a few terms will be used which are either
specific to braille terminals, or introduced because of [4mBrlAPI[24m. They
are defined below. Taking a few minutes to go through this glossary
will save a lot of time and questions later.
[1mAuthentication key[0m
A file containing arbitrary data, that has to be sent to the
server by the client, to prove it is allowed to establish a
connection and then control the braille terminal.
[1mBraille display[0m
The small screen on the braille terminal that is able to display
braille text.
[1mBraille keyboard[0m
The keyboard of the braille terminal.
[1mBraille terminal[0m
A computer designed to display text in braille. In this case,
the text is supposed to come from another computer running Linux
or any other Unix system.
[1mBrltty[0m
The background process that gives a blind person access to the
console screen thanks to a braille terminal or speech
synthetizer.
[1mClient[0m
An application designed to handle a braille terminal thanks to
[4mBrlAPI[24m.
[1mCommand[0m
A code returned by the driver, indicating an action to do, for
instance "go to previous line", "go to next line", etc.
[1mDriver[0m
A library that has functions to communicate with a braille
terminal. Basically, a driver has functions to open
communication with the braille terminal, close the
communication, write on the braille display, and read keypresses
from the braille keyboard, plus some special functions that will
be described in detail in this manual.
[1mKey[0m
A code that is returned by the driver when a key is pressed.
This is different from a command, because the command concept is
driver-independent (all drivers use the same command codes -
those defined by [4mbrltty[24m), whereas codes used for returning
keypresses may vary between drivers.
[1mBrlAPI's Library[0m
This library helps clients to connect and use [4mBrlAPI[24m's server
thanks to a series of brlapi_-prefixed functions.
[1mPacket[0m
A sequence of bytes making up the atomic unit in communications,
either between braille drivers and braille terminals or between
the server and clients.
[1mRaw mode[0m
Mode in which the client application exchanges packets with the
driver. Normal operations like sending text for display or
reading keypresses are not available in this mode. It lets
applications take advantage of advanced functionalities of the
driver's communication protocol.
[1mServer[0m
The part of [4mbrltty[24m that controls incoming connections and
communication between clients and braille drivers.
[1mTty[0m
Synonym for console, terminal, ... Linux' console consist of
several Virtual Ttys (VTs). The screen program's windows also
are Ttys. X-window system's xterms emulate Ttys as well.
[1m1.2. How to read this manual[0m
This manual is split in five parts.
[1m``General description''[0m
Describes more precisely what [4mBrlAPI[24m is and how it works in
collaboration with [4mbrltty[24m's core, the braille driver and
clients. In this part, a "connection-use-disconnection" scenario
will be described step by step, explaining for each step what
[4mBrlAPI[24m does in reaction to client instructions. These
explanations will take place at a user level.
[1m``Concurrency management''[0m
This part explains how concurrency between [4mBrlAPI[24m clients is
handled thanks to focus tellers.
[1m``Installation and configuration''[0m
This part explains in detail how to install and configure the
API. For instructions on how to install and configure [4mbrltty[24m,
please report to the [4mbrltty[24m documentation.
[1m``Library description''[0m
This part describes how client applications can communicate with
the server using the [4mBrlAPI[24m library that comes with [4mbrltty[24m. Each
function will be briefly described, classified by categories.
More exhaustive descriptions of every function are available in
the corresponding online manual pages.
[1m``Writing braille drivers''[0m
This part describes how the braille drivers included in [4mbrltty[0m
should be written in order to take advantage of [4mBrlAPI[24m's
services.
[1m``Protocol reference''[0m
This part describes in detail the communication protocol that is
used to communicate between server and clients.
What should be read probably depends on what should be done by
applications with [4mBrlAPI[24m.
Reading chapters ``General description'', ``Concurrency management''
and ``Installation and configuration'' is recommended, since they
provide useful information and (hopefully) lead to a good
understanding of [4mBrlAPI[24m, for an efficient use.
Chapter ``Library description'' concerns writing applications that
take advantage of braille terminals so as to bring specific (and more
useful) information to blind people.
Chapter ``Drivers'' is for braille driver implementation: either
adding a braille driver to [4mbrltty[24m or modifying an existing one so that
it can benefit from [4mBrlAPI[24m's features, this chapter will be of
interest, since it describes exactly what is needed to write a driver
for [4mbrltty[24m: the core of drivers interface for instance.
Finally, chapter ``Protocol reference'' is for [4mnot[24m [4musing[24m the library,
but using the [4mBrlAPI[24m server directly, when the library might not be
sufficient: it describes the underlying protocol that will have to be
used to do so.
[1m2. General description of BrlAPI[0m
Here is explained what [4mBrlAPI[24m is, and what it precisely does. These
explanations should be simple enough to be accessible to every user.
For a more technical review of [4mBrlAPI[24m's functionalities, please see
chapter ``Libary description''.
[1m2.1. Historical notes.[0m
Originally, [4mbrltty[24m was designed to give access to the Linux console to
visually impaired people, through a braille terminal or a speech
synthetizer. At that time, applications running in the console were
not taking care of the presence of a braille terminal (most
applications didn't even know what a braille terminal was).
This situation where applications are not aware of the presence of a
special device is elegant of course, since it lets use an unlimited
number of applications which don't need to be specially designed for
visually impaired people.
However, it appeared that applications specially designed to take
advantage of a braille terminal could be wanted, to provide the
suitable information to blind users, for instance. The idea of [4mBrlAPI[0m
is to propose an efficient communication mechanism, to control the
braille display, read keys from the braille keyboard, or to exchange
data with the braille terminal at a lower level (e.g. to write file
transfer protocols between braille terminals and Linux systems).
[1m2.2. Why BrlAPI is part of brltty .[0m
Instead of rewriting a whole communication program from scratch, we
chose to add communication mechanisms to [4mbrltty[24m. This choice has two
main justifications.
On the one hand, integration to [4mbrltty[24m allows us to use the increasing
number of drivers written for [4mbrltty[24m, thus handling a large number of
braille terminals without having to rewrite any piece of existing
code.
On the other hand, if an application chooses to send its own
information to the braille display, and to process braille keys,
[4mbrltty[24m has to be warned, so that it won't try to communicate with the
braille terminal while the application already does. To make this
synchronzation between [4mbrltty[24m and client applications possible, it
seemed easier to add the communication mechanisms to [4mbrltty[24m's core,
instead of writing an external program providing them.
[1m2.3. How it works.[0m
We are now going to describe the steps an application should go
through to get control of the braille terminal, and what happens on
[4mbrltty[24m's side at each step. This step-by-step description will let us
introduce more precisely some concepts that are useful for every
[4mBrlAPI[24m user.
[1m2.3.1. Connection.[0m
The first thing any client application has to do is to connect (in the
Unix sense of the word) to [4mBrlAPI[24m which is an mere application server.
If this is not clear, the only thing to be remembered is that this
step allows the client application to let the server know about its
presence. At this stage, nothing special is done on [4mbrltty[24m's side.
[1m2.3.2. Authentication.[0m
Since Unix is designed to allow many users to work on the same
machine, it's quite possible that there are more than one user
accounts on the system. Most probably, one doesn't want any user with
an account on the machine to be able to communicate with the braille
terminal (just imagine what would happen if, while somebody was
working with the braille terminal, another user connected to the
system began to communicate with it, preventing the first one from
doing his job...). That's why [4mBrlAPI[24m has to provide a way to determine
whether a user who established a connection is really allowed to
communicate with the braille terminal. To achieve this, [4mBrlAPI[0m
requires that each application that wants to control a braille
terminal sends an authentication key before doing anything else. The
control of the braille terminal will only be possible for the client
once it has sent the proper authentication key. What is called
authentication key is in fact a Unix file containing data (it must be
non-empty) on your system. All the things you have to do is to give
read permissions on this file to users that are allowed to communicate
with the braille terminal, and only to them. This way, only authorized
users will have access to the authentication key and then be able to
send it to [4mBrlAPI[24m. To see how to do that, please see chapter
``Installation and configuration''.
At the end of this step, the user is authorized to take control of the
braille terminal. On [4mbrltty[24m's side, some data structures are allocated
to store information on the client, but this has no user-level side-
effect.
[1m2.3.3. Real use of the braille terminal.[0m
Once the client is properly connected and authenticated, there are two
possible types of communication with the braille terminal. The chosen
type of communication depends on what the client plans to do. If its
purpose is to display information on the braille display or to process
braille keys, it will have to take control of the Linux tty on which
it is running. If its purpose is to exchange data with the braille
terminal (e.g. for file transfer), it will enter what is called "raw
mode".
[1m2.3.3.1. Braille display and braille key presses processing.[0m
If the client wants to display something on the braille display or to
process braille keys itself, rather than letting [4mbrltty[24m process them,
it has to take control of the Linux terminal it is running on.
Once a client has obtained the control of his tty, [4mBrlAPI[24m will
completely discard [4mbrltty[24m's display on this tty (and only this one),
leaving the braille display free for the client.
At the same time, if a key is pressed on the braille keyboard, [4mBrlAPI[0m
checks whether the client application is interested in this key or
not. If it is, the key is passed to it, either as a key code or as a
[4mbrltty[24m command. If it is not, the key code is converted into a [4mbrltty[0m
command and returned to [4mbrltty[24m.
Once the client is not interested in displaying text or reading
braille keys any more, it has to leave the tty, so that either [4mbrltty[0m
can continue its job, or another client can take control of it.
[1m2.3.3.2. Raw mode.[0m
Only one client can be in raw mode at the same time. In this mode,
data coming from the braille terminal are checked by the driver (to
ensure they are valid), but instead of being processed, they are
delivered "as-is" to the client that is in raw mode.
In the other direction, packets sent to [4mBrlAPI[24m by the client that is
in raw mode are passed to the driver which is expected to deliver them
to the braille terminal without any modification.
[1m2.3.3.3. Remarks.[0m
ˇ The operations described in the two previous subsections are not
completely mutually exclusive. An application that controls its
current tty can enter raw mode, provided that no other application
already is in this mode. However, the contrary is not possible: an
application which has entered raw mode cannot take control of its
tty before having left raw mode. Indeed, it would make no sense to
take control of a tty during raw mode since in this mode, braille
display and reading of braille keys are impossible.
ˇ Not every braille driver supports raw mode. It has to be specially
(re)written to support it, since it has to provide special
functions to process incoming and outgoing packets. The same
restriction is true (but less strong) concerning the ability to
deliver/convert keycodes into commands: not every driver has this
ability, it has to be modified to get it.
ˇ Operations previously described can be repeated. You can, for
instance, use raw mode to transfer data onto your braille terminal,
display text in braille, return to raw mode..., all that without
having to reconnect to [4mBrlAPI[24m before each operation.
[1m2.3.4. Disconnection.[0m
Once the client has finished using the braille terminal, it has to
disconnect from the API, so that the memory structures allocated for
the connection can be freed and eventually used by another client.
This step is transparent for the user, in the sense that it involves
no change on the braille display.
[1m3. Concurrency management between BrlAPI clients[0m
An essential purpose of [4mBrlAPI[24m is to manage concurrent access to the
braille display between the [4mbrltty[24m daemon and applications. This
concurrency is managed "per Tty". We first describe this with a flat
view, and then consider Tty hierarchy.
[1m3.1. VT switching[0m
Let's first describe how things work with the simple case of a single
series of Virtual Ttys (VTs), the linux console for instance.
As described in ``General Description'', before being able to write
output, a [4mBrlAPI[24m client has to "get" a tty, i.e. it sends to the
[4mBrlAPI[24m server the number of the linux' Virtual Tty on which it is
running. The [4mBrlAPI[24m server uses this information so as to know which
client's output should be shown on the braille display, according to
the focus teller's information.
Let's say some client [4mA[24m is running on VT 2. It "got" VT 2 and wrote
some output on its [4mBrlAPI[24m connection. The focus teller is [4mbrltty[0m
here: it always tells to the [4mBrlAPI[24m server which VT is currently shown
on the screen and gets usual keyboard presses (it is "active").
Let's say VT 1 is active, then the [4mBrlAPI[24m server shows [4mbrltty[24m's output
on the braille display. I.e. the usual [4mbrltty[24m screen reading appears.
Moreover, when braille keys are pressed, they are passed to [4mbrltty[24m, so
that usual screen reading can be performed. When the user switches to
VT 2, [4mbrltty[24m (as focus teller) tells it to the [4mBrlAPI[24m server, which
then remembers that client [4mA[24m has got it and has produced some output.
The server then displays this output on the braille display. Note
that [4mA[24m doesn't need to re-submit its output: the server had recorded
it so as to be able to show it as soon as the focus switches to VT 2.
Whenever some key of the braille device is pressed, [4mBrlAPI[24m looks
whether it is in the list of keys that client [4mA[24m said to be of his
interest. If it is, it is passed to [4mA[24m (and not to [4mbrltty[24m). If it
isn't, it is passed to [4mbrltty[24m (and not to [4mA[24m).
As a consequence, whenever clients get and release Ttys and the user
switches between Ttys, either the [4mbrltty[24m screen reading or the
client's output is automatically shown according to rather natural
rules.
[1m3.2. A pile of "paper sheets" Let's look at VT 2 by itself. What is[0m
[1mshown on the braille display can be seen as the result of a pile of[0m
[1mtwo paper sheets. brltty is represented by the bottom sheet on which[0m
[1mits screen reading is written, and client A by the top sheet on which[0m
[1mits output is written. A 's sheet hence "covers" brltty 's sheet: A 's[0m
[1moutput "mask" brltty 's screen reading.[0m
[4mA[24m may yet want to temporarily let [4mbrltty[24m's screen reading appear on VT
2, while still receiving some key presses, for instance. For this, it
sends a "void" write. The server then clears the recorded output for
this connection (in the sheet representation, the sheet becomes
"transparent"). As a consequence, [4mbrltty[24m's output is automatically
shown (by transparency in the sheet representation), just like if [4mA[0m
had released the Tty.
Keypresses are handled in a similar way: [4mA[24m's desire to get key presses
is satisfied first before [4mbrltty[24m.
Let's say some other client [4mB[24m (probably launched by [4mA[24m) also gets VT 2
and outputs some text on its [4mBrlAPI[24m connection. This adds a third
sheet, on top of the two previous ones. It means that the [4mBrlAPI[0m
server will show [4mB[24m's output on the braille device. If [4mA[24m then outputs
some text, the server will record it (on [4mA[24m's sheet which hence becomes
opaque again), but it won't be displayed on the braille device, since
[4mB[24m's sheet is still at the top and opaque (i.e. with some text on it).
But if [4mB[24m issues a void write, the server clears its ouput buffer (i.e.
[4mB[24m's sheet becomes transparent), and as a result [4mA[24m's output appear on
the braille display (by transparency through [4mB[24m's sheet).
The sheet order is determined by the Tty "get"ting order. Some
mecanism will be added in near future for clients to precise "at which
level its sheet should be inserted" so as to avoid race conditions on
the "get"ting order.
[1m3.3. Hierarchy[0m
Now, what happens when running some [4mscreen[24m program on, say, VT 3? It
emulates a series of Ttys, whose output actually appear on the same VT
3. That's where a hierarchy level appears: the focus information is
not only the VT number but also, in the case of VT 3, which [4mscreen[0m
window is active. This hence forms a [4mtree[24m of Ttys: the "root" being
the vga driver's output, whose sons are VTs, and VT 3 has the [4mscreen[0m
windows as sons. [4mBrltty[24m is a focus teller for the root, [4mscreen[24m will
have to be a focus teller for VT 3. [4mScreen[24m should then get VT 3, not
display anything (so that the usual [4mbrltty[24m screen reading will be
shown by transparency), and tell the [4mBrlAPI[24m server which [4mscreen[24m window
is active (at startup and at each window switch). This is not
implemented directly in [4mscreen[24m yet, but this may be achieved via a
second [4mbrltty[24m daemon running the Screen driver (but it isn't yet able
to get the current window number though) and the [4mBrlAPI[24m driver.
A [4mBrlAPI[24m client [4mC[24m running in some [4mscreen[24m window number 1 would then
have to get the Tty path "VT 3 then window 1", which is merely
expressed as "3 1". The window number is available in the WINDOW
environment variable, set by [4mscreen[24m. The VT number, which actually
represents the "path to screen's output" should be available in the
WINDOWSPATH environment variable, also set by [4mscreen[24m. The client can
thus merely concatenates the content of WINDOWSPATH (which could hold
many levels of window numbers) and of WINDOW and give the result as
tty path to the [4mBrlAPI[24m server, which then knows precisely where the
client's usual output resides.
Whenever the user switches to VT 3, the [4mBrlAPI[24m server remembers the
window that [4mscreen[24m told to be active. If it was window 1, it then
displays [4mC[24m's output (if any). Else [4mbrltty[24m's usual screen reading is
shown. Of course, several clients may be run in window 1 as well, and
the "sheet pile" mecanism applies: [4mbrltty[24m's sheet first (at the root
of the Ttys tree), then [4mscreen[24m's sheet (which is transparent, on VT
3), then [4mC[24m's sheet (on window 1 of VT 3), then other clients' sheets
(on the same window).
Ttys are hence organized in a tree, each client adding its sheet at
some tty in the tree.
[1m3.4. The X-window case[0m
Let's say some X server is running on VT 7. The user should also
launch [4mxbrlapi[24m, which is a focus teller for X-window as well as a
keyboard simulator ([4mbrltty[24m can't reliably simulate them at the kernel
level in such situation). For accessing AT-SPI contents (like gnome
or kde applications), gnopernicus should also be launched. For
accessing AT-SPI terminals (like gnome-terminal), a second [4mbrltty[0m
daemon running the at-spi screen driver and the [4mBrlAPI[24m driver should
also be launched. All three would get VT 7, in that order (for now):
[4mxbrlapi[24m first, then [4mgnopernicus[24m and [4mbrltty[24m at last. When the X focus
is on an AT-SPI terminal, [4mbrltty[24m will hence be able to grab the
braille display and key presses. Else [4mgnopernicus[24m would get them.
And [4mxbrlapi[24m would finally get remaining key presses and simulate them.
The user should also set in his ~/.xsession, ~/.xinitrc, ~/.gdmrc...
the WINDOWSPATH environment variable to "7", so that clients running
in xterms will be able to prepend it to the content of the WINDOWID
variable (set by xterms) and give this Tty path to the [4mBrlAPI[24m server.
Any [4mscreen[24m run in some xterm should then concatenate these WINDOWSPATH
and WINDOWID variables to form a new WINDOWSPATH variable to give to
sessions running in it.
[1m3.5. Detaching[0m
Several programs allow detaching: [4mscreen[24m and [4mVNC[24m for instance. In such
situation, an intermediate [4mBrlAPI[24m server should be run for each such
session. Clients would connect to it, and it would prepend the
"current tty" path on the fly while forwarding things to the root
[4mBrlAPI[24m server. This intermediate server is yet to be written (but it
is actually relatively close to be).
[1m4. Installation and configuration of BrlAPI[0m
make install will install libbrlapi.so in /lib, and include files in
/usr/include/brltty. An authentication key will also typically be set
in /etc/brlapi.key, but won't be readable by anybody else than root.
It is up to you to define a group of users who will have the right to
read it and hence be able to connect to the server. For instance, you
may want to do:
______________________________________________________________________
# addgroup brlapi
# chgrp brlapi /etc/brlapi.key
# chmod g+r /etc/brlapi.key
# addgroup user1 brlapi
# addgroup user2 brlapi
...
______________________________________________________________________
[1m5. Library description[0m
Let's now see how one can write dedicated applications. Basic notions
will be seen, along with a very simple client. Greater details are
given as online manual pages.
The historical test program for [4mBrlAPI[24m was something like:
ˇ connect to [4mBrlAPI[0m
ˇ get driver id
ˇ get driver name
ˇ get display size
ˇ try entering raw mode, immediately leave raw mode.
ˇ get tty control
ˇ write something on the display
ˇ wait for a key press
ˇ leave tty control
ˇ disconnect from [4mBrlAPI[0m
It is here rewritten, its working briefly explained.
[1m5.1. Connecting to BrlAPI[0m
Connection to [4mBrlAPI[24m is needed first, thanks to the
brlapi_initializeConnection call. For this, a brlapi_settings_t
variable must be filled which will hold the settings the library needs
to connect to the server. Just giving NULL will work for local use.
The other parameter lets you get back the parameters which were
actually used to initialize connection. NULL will also be nice for
now.
______________________________________________________________________
if (brlapi_initializeConnection(NULL,NULL)<0)
{
brlapi_perror("brlapi_initializeConnection");
exit(1);
}
______________________________________________________________________
The connection might fail, so testing is needed.
[1m5.2. Getting driver id and name[0m
Knowing the type of the braille device might be useful:
______________________________________________________________________
unsigned char id[3], name[21];
if (brlapi_getDriverId(id, sizeof(id))<0) {
brlapi_perror("getDriverId");
} else printf("Driver id: %s\n",id);
if (brlapi_getDriverName(name, sizeof(name))<0) {
brlapi_perror("getDriverName");
______________________________________________________________________
This is particularly useful before entering raw mode to achieve file
transfers for instance, just to check that the device is really the
one expected.
[1m5.3. Getting display size[0m
Before writing on the braille display, the size should be always first
checked to be sure everything will hold on it:
______________________________________________________________________
if (brlapi_getDisplaySize(&x, &y)<0)
brlapi_perror("brlapi_getDisplaySize");
else
printf("Braille display has %d line%s of %d column%s\n",y,y>1?"s":"",x,x>1?"s":"");
______________________________________________________________________
[1m5.4. Entering raw mode, immediately leaving raw mode.[0m
Entering raw mode is very simple:
______________________________________________________________________
fprintf(stderr,"Trying to enter in raw mode... ");
if (brlapi_getRaw()<0)
brlapi_perror("brlapi_getRaw");
else {
fprintf(stderr,"Ok, leaving raw mode immediately\n");
brlapi_leaveRaw();
}
______________________________________________________________________
Not every driver supports raw mode (actually only one does for the
moment ;-), so testing is needed.
While in raw mode, brlapi_sendRaw and brlapi_recvRaw can be used to
send and get data directly to and from the device. It should be used
with care, improper use might completely thrash the device!
[1m5.5. Getting tty control[0m
Let's now display something on the device. control of the tty must be
get first:
______________________________________________________________________
fprintf(stderr,"Taking control of the tty... ");
if (brlapi_getTty(-1,NULL)>=0)
{
printf("Ok\n");
______________________________________________________________________
The first parameter tells the server the number of the tty to take
control of. Setting -1 lets the library determine it for us.
The server is asked to send [4mbrltty[24m commands, which are device-
independent.
Getting control might fail if, for instance, another application
already took control of this tty, so testing is needed.
From now on, the braille display is detached from the screen.
[1m5.6. Writing something on the display[0m
The application can now write things on the braille display without
altering the screen display:
______________________________________________________________________
fprintf(stderr,"Writing to braille display... ");
if (brlapi_writeText(0,"Press a braille key to continue...")>=0)
{
fprintf(stderr,"Ok\n");
______________________________________________________________________
The cursor is also asked [4mnot[24m to be shown: its position is set to 0.
"Writing to braille display... Ok" is now displayed on the screen, and
"Press a braille key to continue..." on the braille display.
[1m5.7. Waiting for a key press[0m
To have a break for the user to be able to read these messages, a key
press (a command here, which is driver-independent) may be waited for:
______________________________________________________________________
fprintf(stderr,"Waiting until a braille key is pressed to continue... ");
if (brlapi_readKey(1,&key)>0)
fprintf(stderr,"got it! (code=%d)\n",key);
______________________________________________________________________
The command code is returned, as described in <brltty/brldefs.h>. It
is not transmitted to [4mbrltty[24m: it is up to the application to define
the behavior, here cleanly exitting, as described below.
The first parameter tells the lib to block until a key press is indeed
read.
[1m5.8. Leaving tty control[0m
Let's now leave the tty:
______________________________________________________________________
fprintf(stderr,"Leaving tty... ");
if (brlapi_leaveTty()>=0)
fprintf(stderr,"Ok\n");
______________________________________________________________________
But control of another tty can still be get for instance, by calling
brlapi_getTty() again...
[1m5.9. Disconnecting from BrlAPI[0m
Let's disconnect from [4mBrlAPI[24m:
______________________________________________________________________
brlapi_closeConnection();
______________________________________________________________________
The application can as well still need to connect to another server on
another computer for instance, by calling
brlapi_initializeConnection() again...
[1m5.10. Putting everything together...[0m
______________________________________________________________________
#include <stdio.h>
#include <stdlib.h>
#include <brltty/api.h>
int main()
{
brl_keycode_t key;
char *p,*c;
int x, y;
/* Connect to BrlAPI */
if (brlapi_initializeConnection(NULL,NULL)<0)
{
brlapi_perror("brlapi_initializeConnection");
exit(1);
}
/* Get driver id & name */
p = brlapi_getDriverId();
if (!p)
brlapi_perror("brlapi_getDriverId");
else
printf("Driver id: %s\n",p);
p = brlapi_getDriverName();
if (!p)
brlapi_perror("brlapi_getDriverName");
else
printf("Driver name: %s\n",p);
/* Get display size */
if (brlapi_getDisplaySize(&x, &y)<0)
brlapi_perror("brlapi_getDisplaySize");
else
printf("Braille display has %d line%s of %d column%s\n",y,y>1?"s":"",x,x>1?"s":"");
/* Try entering raw mode, immediately go out from raw mode */
printf("Trying to enter in raw mode... ");
if (brlapi_getRaw()<0)
brlapi_perror("brlapi_getRaw");
else {
printf("Ok, leaving raw mode immediately\n");
brlapi_leaveRaw();
}
/* Get tty control */
printf("Taking control of the tty... ");
if (brlapi_getTty(-1,NULL)>=0)
{
printf("Ok\n");
/* Write something on the display */
fprintf(stderr,"Writing to braille display... ");
if (brlapi_writeText(0,"Press a braille key to continue...")>=0)
{
fprintf(stderr,"Ok\n");
/* Wait for a key press */
fprintf(stderr,"Waiting until a braille key is pressed to continue... ");
if (brlapi_readKey(1,&key)>0)
fprintf(stderr,"got it! (code=%d)\n",key);
else brlapi_perror("brlapi_readKey");
} else brlapi_perror("brlapi_writeText");
/* Leave tty control */
fprintf(stderr,"Leaving tty... ");
if (brlapi_leaveTty()>=0)
fprintf(stderr,"Ok\n");
else brlapi_perror("brlapi_leaveTty");
} else brlapi_perror("brlapi_getTty");
/* Disconnect from BrlAPI */
brlapi_closeConnection();
return 0;
}
______________________________________________________________________
This should compile well thanks to gcc apiclient.c -o apiclient
-lbrlapi
[1m6. Writing ( BrlAPI -compliant) drivers for brltty[0m
In this chapter, we will describe in details how to write a driver for
[4mbrltty[24m. We begin with a general description of the structure the
driver should have, before explaining more precisely what each
function is supposed to do.
[1m6.1. Overview of the driver's structure[0m
A braille driver is in fact a library that is either dynamically
loaded by [4mbrltty[24m at startup, or statically linked to it during the
compilation, depending on the options given to the ./configure script.
This library has to provide every function needed by the core, plus
some additional functions, that are not mandatory, but which improve
communication with [4mBrlAPI[24m and the service level provided to client
applications.
Basically, a driver library needs to provide a function to open the
communication with the braille terminal, one to close this
communication, one to read key codes from the braille keyboard, and
one to write text on the braille display. As we will see in a moment,
other functions are required.
Moreover, a driver can provide additional functionalities, by defining
some macros asserting that it has these functionalities, and by
defining associated functions.
[1m6.2. Basic driver structure[0m
[4mEvery[24m [4mbrltty[24m driver [4mmust[24m consist in at least a file called braille.c,
located in an appropriate subdirectory of the BrailleDrivers
subdirectory. This braille.c file must have the following layout
#include "prologue.h"
/* Include standard C headers */
#include "Programs/brl.h"
#include "Programs/misc.h"
#include "Programs/scr.h"
#include "Programs/message.h"
/* Include other files */
static void brl_identify() { }
static int brl_open(BrailleDisplay *brl, char **parameters, const char *tty) { ... }
static void brl_close(BrailleDisplay *brl) { ... }
static void brl_writeWindow(BrailleDisplay *brl) { ... }
static void brl_writeStatus(BrailleDisplay *brl) { ... }
static int brl_readCommand(BrailleDisplay *brl, DriverCommandContext context) { ... }
Before giving a detailed description of what each function is supposed
to do, we define the BrailleDisplay structure, since each function has
an argument of type BrailleDisplay *. The BrailleDisplay structure is
defined like this:
typedef struct {
int x, y; /* The dimensions of the display */
int helpPage; /* The page number within the help file */
unsigned char *buffer; /* The contents of the display */
unsigned isCoreBuffer:1; /* The core allocated the buffer */
unsigned resizeRequired:1; /* The display size has changed */
unsigned int writeDelay;
void (*bufferResized)(int rows, int columns);
} BrailleDisplay;
We now describe each function's semantics and calling convention.
The brl_identify() function takes no argument and returns nothing. It
is called as soon as the driver is loaded, and its purpose is to print
some information about the driver in the system log. To achieve this,
the only thing this function has to do is to call LOG_PRINT with
appropriate arguments (log level and string to put in the syslog).
The brl_open() function takes 3 arguments and returns an int. Its
purpose is to initialize the communication with the braille terminal.
Generally, this function has to open the file referred to by the tty
argument, and to configure the associated communication port. The
parameters argument contains parameters passed to the driver with the
-B command-line option. It's up to the driver's author to decide
wether or not he/she wants to use this argument, and what for. The
function can perform some additional tasks such as trying to identify
precisely which braille terminal model is connected to the computer,
by sending it a request and analyzing its answer. The value that is
finally returned depends on the success of the initialization process.
If it fails, th function has to return -1. The function returns 0 on
success.
The brl_close() function takes just one argument, and returns nothing.
The name of this function should be self-explanatory; it's goal is to
close (finish) the communication between the computer and the braille
terminal. In general, the only thing this function has to do is to
close the file descriptor associated to the braille terminal's
communication port.
The brl_writeWindow() function takes just one argument of type
BrailleDisplay, and returns nothing. This function displays the
specified text on the braille window. This routine is the right place
to check if the text that has to be displayed is not already on the
braille display, to send it only if necessary. More generally, if the
braille terminal supports partial refresh of the display, the calculus
of what exactly has to be sent to the braille display to have a proper
display, according to what was previously displayed should be done in
this function.
The brl_writeStatus() function is very similar to brl_writeWindow().
The only difference is that whereas brl_writeWindow() writes on the
main braille display, brl_writeStatus() writes on an auxiliary braille
display, which occasionaly appears on some braille terminals. The
remarks that have been done concerning optimizations for refreshing
the display still apply here.
The brl_readCommand() function takes two arguments, and returns an
integer. Its purpose is to read commands from the braille keyboard and
to pass them to [4mbrltty[24m's core, which in turn will process them. The
first argument, of type BrailleDisplay, is for future use, and can
safely be ignored for the moment. The second argument indicates in
which context (state) [4mbrltty[24m is. For instance, it specifies if [4mbrltty[0m
is in a menu, displays a help screen, etc. This information can indeed
be of some interest when translating a key into a command, especially
if the keys can have different meanings, depending on the context. So,
this function has to read keypresses from the braille keyboard, and to
convert them into commands, according to the given context, these
commands then being returned to [4mbrltty[24m. For a complete list of
available command codes, please have a look at brl.h in the Programs
subdirectory. Two codes have special meanings:
[1meof[0m
specifies that no command is available now, and that no key is
waiting to be converted into command in a near future.
[1mCMD_NOOP[0m
specifies that no command is available, but that one will be,
soon. As a consequence, brl_readCommand will be called again
immediately. Returning CMD_NOOP is appropriate for instance when
a key is composed of two consecutive data packets. When the
first of them is received, one can expect that the second will
arrive quickly, so that trying to read it as soon as possible is
a good idea.
[1m6.3. Enhancements for BrlAPI[0m
To improve the level of service provided to client applications
communicating with braille drivers through [4mBrlAPI[24m, the drivers should
declare some additional functions that will then be called by the API
when needed.
For each additional feature that has to be implemented in a driver, a
specific macro must be defined, in addition to the functions
implementing that feature. For the moment, two features are supported
by [4mBrlAPI[24m:
ˇ reading braille terminal specific key codes,
ˇ exchanging raw data packets between the braille terminal and a
client application running on the PC.
For each feature presented below, only a short description of each
concerned macro and function will be given. For a more complete
description of concepts used here, please refer to chapters
``Introduction'' and ``General description''.
[1m6.3.1. Reading braille key codes[0m
When a client takes control of a tty and asks for getting raw key
codes, it has, like in command mode, the possibility to mask some
keys. The masked keys will then be passed to [4mbrltty[24m. This assumes the
existence of a conversion mechanism from key codes to [4mbrltty[24m commands.
This conversion mechanism can only be implemented by the braille
driver, since it is the only piece of code that knows about braille
terminal specific key codes. So, to make it possible for client
applications to read raw key codes, the driver has to define the
following macro:
#define BRL_HAVE_KEY_CODES
and the following functions:
static int brl_readKey(BrailleDisplay *)
int brl_keyToCommand(BrailleDisplay *brl, DriverCommandContext caller, int code)
The semantics of brl_readKey() is very similar to brl_readCommand()'s,
with one essential difference: a key code is not context-dependant, so
no context argument needs to be given to this function. Moreover, the
code this function returns is driver-specific, and has to be properly
defined by the driver's author so that client applications can rely on
it.
The brl_keyToCommand() function's purpose is to convert a key code as
delivered by brl_readKey() into a [4mbrltty[24m command. As explained above,
this function is called by brlapi when a key is pressed on the braille
keyboard that is ignored by the client application. The corresponding
command is then returned to [4mbrltty[24m.
[1m6.3.1.1. Remarks[0m
When these two functions are present, the only thing brl_readCommand()
has to do is to call brl_readKey() and then call brl_keyToCommand()
with the value returned by the first function as argument.
[1m6.3.2. Exchanging raw data packets[0m
Under some circumstances, an application running on the PC can be
interested in a raw level communication with the braille terminal. For
instance, to implement a file transfer protocol, commands to display
braille or to read keys are not enough. In such a case, one must have
a way to send raw data to the terminal, and to receive them from it.
A driver that wants to provide such a mechanism has to define three
functions: one to send packets, another one to receive them, and the
last one to reset the communication when problems occur.
The macro that declares that a driver is able to transmit packets is:
#define BRL_HAVE_PACKET_IO
The prototypes of the functions the driver should define are:
static int brl_writePacket(BrailleDisplay *brl, const unsigned char *packet, int size);
static int brl_readPacket(BrailleDisplay *brl, unsigned char *p, int size);
static void brl_rescue(BrailleDisplay *brl)
brl_writePacket() sends a packet of size bytes, stored at packet, to
the braille terminal. If the communication protocol allows to
determined if a packet has been send properly (e.g. the terminal sends
back an acknowledgement for each packet he receives), then this
function should wait the acknowledgement, and, if it is not received,
retransmission of the packet should take place.
brl_readPacket() reads a packet of at most size bytes, and stores it
at the specified address. The read must not block. I.e., if no packet
is available, the function should return immediately, returning 0.
brl_rescue() is called by [4mBrlAPI[24m when a client application terminates
without properly leaving the raw mode. This function should restore
the terminal's state, so that it is able to display text in braille
again.
[1m6.3.2.1. Remarks.[0m
ˇ If the driver provides such functions, every other functions should
use them, instead of trying to communicate directly with the
braille terminal. For instance, readCommand() should call
readPacket(), and then extract a key from the packet, rather than
reading directly from the communication port's file descriptor. The
same applies for brl_writeWindow(), which should use
brl_writePacket(), rather than writing on the communication port's
file descriptor.
ˇ For the moment, the argument of type BrailleDisplay can safely be
ignored by the functions described here.
[1m7. Protocol reference[0m
Under some circumstances, it may be preferable to communicate directly
with [4mBrlAPI[24m's server rather than using [4mBrlAPI[24m's library. Here are the
needed details to be able to do this. This chapter is also of interest
if a precise understanding of how the communication stuff works is
desired, to be sure to understand how to write multithreaded clients,
for instance.
In all the following, [4minteger[24m will mean an unsigned 32 bits integer in
network byte order (ie most significant bytes first).
[1m7.1. Reliable packet transmission channel[0m
The protocol between [4mBrlAPI[24m's server and clients is based on exchanges
of packets. So as to avoid locks due to packet loss, these exchanges
are supposed reliable, and ordering must be preserved, thus [4mBrlAPI[0m
needs a reliable packet transmission channel.
To achieve this, [4mBrlAPI[24m uses a TCP-based connection, on which packets
are transmitted this way:
ˇ the size in bytes of the packet is transmitted first as an integer,
ˇ then the type of the packet, as an integer,
ˇ and finally the packet data.
The size does not include the { size, type } header, so that packets
which don't need any data have a size of 0 byte. The type of the
packet can be either of BRLPACKET_* constants defined in
api_protocol.h. Each type of packet will be further discussed below.
[4mBrlAPI[24m's library ships two functions to achieve packets sending and
receiving using this protocol: brlapi_writePacket and
brlapi_readPacket. It is a good idea to use these functions rather
than rewriting them, since this protocol might change one day in favor
of a real reliable packet transmission protocol such as the
experimental RDP.
[1m7.2. Responses from the server[0m
As described below, many packets are `acknowledged'. It means that
upon reception, the server sends either:
ˇ a BRLPACKET_ACK packet, with no data, which means the operation
corresponding to the received packet was successful,
ˇ or a BRLPACKET_ERROR packet, the data being an integer which should
be one of BRLERR_* constants. This means the operation
corresponding to the received packet failed.
Some other packets need some information as a response. Upon
reception, the server will send either:
ˇ a packet of the same type, its data being the response,
ˇ or a BRLPACKET_ERROR packet.
If at some point an ill-formed or non-sense packet is received by the
server, and BRLPACKET_EXCEPTION is returned, holding the guilty packet
for further analysis.
[1m7.3. Operating modes[0m
The connection between the client and the server can be in either of
the four following modes:
ˇ authentication mode: this is the initial mode, when the client
hasn't authenticated itself to the server yet. Only one
BRLPACKET_AUTHKEY packet will be accepted, which makes the
connection enter normal mode.
ˇ normal mode: the client is authenticated, but didn't ask for a tty
or raw mode. The client can send either of these types of packet:
ˇ BRLPACKET_GETDRIVERID, BRLPACKET_GETDRIVERNAME or
BRLPACKET_GETDISPLAYSIZE to get pieces of information from the
server,
ˇ BRLPACKET_GETTTY to enter tty handling mode,
ˇ BRLPACKET_GETRAW to enter raw mode,
ˇ tty handling mode: the client holds the control of a tty: [4mbrltty[0m
has no power on it any more, masked keys excepted. It's up to the
client to manage display and keypresses. For this, it can send
either of these types of packet:
ˇ BRLPACKET_GETTTY to switch to another tty, but how key presses
should be sent mustn't change,
ˇ BRLPACKET_LEAVETTY to leave tty handling mode and go back to
normal mode,
ˇ BRLPACKET_IGNOREKEYRANGE, BRLPACKET_UNIGNOREKEYRANGE,
BRLPACKET_IGNOREKEYSET, BRLPACKET_UNIGNOREKEYSET to mask and
unmask keys,
ˇ BRLPACKET_WRITE to display text on this tty,
ˇ BRLPACKET_GETRAW to enter raw mode,
ˇ BRLPACKET_GETDRIVERID, BRLPACKET_GETDRIVERNAME or
BRLPACKET_GETDISPLAYSIZE to get pieces of information from the
server,
And the server might send BRLPACKET_KEY packets to signal key
presses.
ˇ raw mode: the client wants to exchange packets directly with the
braille terminal. Only these types of packet will be accepted.
ˇ BRLPACKET_LEAVERAW to get back to previous mode, either normal
or tty handling mode.
ˇ BRLPACKET_PACKET to send a packet to the braille terminal.
And the server might send BRLPACKET_PACKET packets to give received
packets from the terminal to the client.
Termination of the connection is initiated by the client in normal
mode by simply closing its side of the socket. The server will then
close the connection.
[1m7.4. Details for each type of packet[0m
Here is described the semantics of each type of packet. Most of them
are directly linked to some of [4mBrlAPI[24m's library's functions. Reading
their online manual page as well will hence be of good help for
understanding.
[1m7.4.1. BRLPACKET_AUTHKEY (see brlapi_loadAuthKey() )[0m
This must be the first packet ever transmitted from the client to the
server. It lets the client authenticate itself to the server. Data is
first an integer indicating a protocol version, then comes the
authentication key itself.
If the protocol version is not the same as the server's, a
BRLERR_PROTOCOL_VERSION error packet is returned and the connection is
closed.
If the authentication key matches the servers', it is acknowledged,
and other types of packets might be used, other BRLPACKET_AUTHKEY
shouldn't be sent by the client.
If the authentication key doesn't match, the server sends a
BRLERR_CONNREFUSED and closes the connection.
[1m7.4.2. BRLPACKET_GETDRIVERID (see brlapi_getDriverId() )[0m
This should be sent by the client when it needs the 2-char identifier
of the current brltty driver. The returned string is \0 terminated.
[1m7.4.3. BRLPACKET_GETDRIVERNAME (see brlapi_getDriverName() )[0m
This should be sent by the client when it needs the full name of the
current brltty driver. The returned string is \0 terminated.
[1m7.4.4. BRLPACKET_GETDISPLAYSIZE (see brlapi_getDisplaySize() )[0m
This should be sent by the client when it needs to know the braille
display size. The returned data are two integers: width and then
height.
[1m7.4.5. BRLPACKET_GETTTY (see brlapi_getTty() )[0m
This should be sent by the client to get control of a tty. Sent data
are first a series of integers: the first one gives the number of
following integers, which are the numbers of ttys that leads to the
tty that the application wants to take control of (it can be empty if
the tty is one of the machine's VT). The last integer of this series
tells the number of the tty to get control of. Finaly, how key presses
should be reported is sent: either a driver name or "", preceded by
the number of caracters in the driver name (0 in the case of ""), as
an unsigned byte. This packet is then acknowledged by the server.
[1m7.4.6. BRLPACKET_KEY (see brlapi_readKey() )[0m
As soon as the client gets a tty, it must be prepared to handle
BRLPACKET_KEY incoming packets at any time (as soon as the key was
pressed on the braille terminal, hopefuly). The data holds the key or
command code as an integer, depending on what has been request in the
BRLPACKET_GETTTY packet.
[1m7.4.7. BRLPACKET_SETFOCUS (see brlapi_setFocus() )[0m
For the server to know which tty is active, one particular client is
responsible for sending BRLPACKET_SETFOCUS packets. They hold a single
integer telling the new current tty. For instance, when running an X
server on VT 7, the xbrlapi client would have sent a
BRLPACKET_GETTTY(7) and will send window IDs whenever X focus changes,
allowing display and keypresses switching between xterms.
[1m7.4.8. BRLPACKET_LEAVETTY (see brlapi_leaveTty() )[0m
This should be sent to free the tty and masked keys lists. This is
acknowledged by the server.
[1m7.4.9. BRLPACKET_IGNOREKEYRANGE , BRLPACKET_UNIGNOREKEYRANGE , BRL-[0m
[1mPACKET_IGNOREKEYSET and BRLPACKET_UNIGNOREKEYSET (see[0m
[1mbrlapi_ignoreKeyRange() , brlapi_unignoreKeyRange , brlapi_ignoreKey-[0m
[1mSet() , and brlapi_unignoreKeySet() )[0m
If the client doesn't want every key press to be signaled to it, but
some of them to be given to brltty for normal processing, it can send
BRLPACKET_IGNOREKEYRANGE (resp. BRLPACKET_IGNOREKEYSET) packets to
tell ranges (resp. sets) of key codes which shouldn't be sent to it,
but given to brltty, and BRLPACKET_UNIGNOREKEYRANGE (resp.
BRLPACKET_UNIGNOREKEYSET) packets to tell ranges (resp. sets) of key
codes which should be sent to it, and not given to brltty. The server
keeps a dynamic list of ranges, so that arbitrary sequences of such
packets can be sent. For ranges, Data are 2 integers: the lower and
the upper boundaries; lower and upper must be equal to tell one key,
for instance. For Sets, Data simply consists of integers, one per key
in the set.
[1m7.4.10. BRLPACKET_WRITE (see brlapi_write() )[0m
To display text on the braille terminal and set the position of the
cursor, the client can send a BRLPACKET_WRITE packet. The packet
begins with an integer holding flags (see BRLAPI_WF_*). These flags
indicate which data will then be available, in the following order
(corresponding to flag weight):
ˇ A display number can be given as a integer, in case the braille
display has several. If not given, usual display is used.
ˇ A region can be given as two integers indicating the beginning and
the number of characters of the part of the braille display which
is to be updated, the first cell of the display being numbered 1.
If not given, the whole display is considered to be updated (and
hence the following three fields should exactly fit the braille
display ie hold [4mheight[24m*[4mwidth[24m bytes, where [4mheight[24m and [4mwidth[24m must be
got by sending a BRLPACKET_GETDISPLAYSIZE packet.
ˇ The text to display can then be given, preceded by its size in
bytes expressed as an integer.
ˇ Then an AND field can be given, one byte per character: the 8-dot
representation of the above text will be AND-ed with this field,
hence allowing to erase some unwanted parts of characters. Dots are
coded as described in ISO/TR 11548-1: dot 1 is set iff bit 0 is
set, dot 2 is set iff bit 1 is set, ... dot [4mi+1[24m is set if bit [4mi[24m is
set. This also corresponds to the low-order byte of the coding of
unicode's braille row U+2800.
ˇ As well, an OR field may be given, one byte per character: the
8-dot result of the AND operation above (or the 8-dot
representation of the text if no AND operation was performed) is
OR-ed with this field, hence allowing to set some dots, to
underline characters for instance.
ˇ A cursor position can be specified. 1 representing the first
character of the display, 0 turning the cursor off. If not given,
the cursor (if any) is left unmodified.
ˇ Last but not least, the charset of the text can be specified. If it
is not, an 8-bit charset is assumed, and it is assumed to be the
same as the server's. Multibyte charsets may be used, AND and OR
fields' bytes will correspond to each text's wide [4mcharacter[24m, be it
a composing or a double-width character.
A BRLPACKET_WRITE packet without any flag (and hence no data) means a
"void" WRITE: the server clears the output buffer for this connection.
[1m7.4.11. BRLPACKET_GETRAW (see brlapi_getRaw() )[0m
To enter raw mode, the client must send a BRLPACKET_GETRAW packet,
which is acknowledged. Once in raw mode, no other packet than
BRLPACKET_LEAVERAW or BRLPACKET_PACKET will be accepted. The data must
hold the special value BRLRAW_MAGIC: 0xdeadbeef, to avoid erroneous
raw mode activating.
[1m7.4.12. BRLPACKET_LEAVERAW (see brlapi_leaveRaw() )[0m
To leave raw mode, the client must send a BRLPACKET_LEAVERAW packet,
which is acknowledged.
[1m7.4.13. BRLPACKET_PACKET (see brlapi_sendRaw() and brlapi_recvRaw()[0m
[1m)[0m
While in raw mode, only BRLPACKET_PACKET packets can be exchanged
between the client and the server: to send a packet to the braille
terminal, the client merely sends a BRLPACKET_PACKET packet, its data
being the packet to send to the terminal. Whenever its receives a
packet from the terminal, the server does exactly the same, so that
packet exchanges between the terminal and the server are exactly
reproduced between the server and the client.
Packets' content depends on the braille driver, so that the client
should check for its id or name thanks to a BRLPACKET_GETDRIVERID
packet or a BRLPACKET_GETDRIVERNAME packet, prior to sending any
BRLPACKET_GETRAW packet.
|
:: Command execute :: | |
:: Shadow's tricks :D :: | |
Useful Commands
|
|
:: Preddy's tricks :D :: | |
Php Safe-Mode Bypass (Read Files)
|
|
--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0134 ]-- |