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/BrlAPI-HTML/ drwxr-xr-x |
Viewing file: BrlAPI-6.html (13.25 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | 6. Writing (BrlAPI-compliant) drivers for brlttyIn this chapter, we will describe in details how to write a driver for brltty. We begin with a general description of the structure the driver should have, before explaining more precisely what each function is supposed to do. 6.1 Overview of the driver's structureA braille driver is in fact a library that is either
dynamically loaded by brltty at startup, or statically linked to
it during the compilation, depending on the options given to the
This library has to provide every function needed by the core, plus some additional functions, that are not mandatory, but which improve communication with BrlAPI 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. 6.2 Basic driver structureEvery brltty driver must 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
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 The The The The The
6.3 Enhancements for BrlAPITo improve the level of service provided to client applications communicating with braille drivers through BrlAPI, 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 BrlAPI:
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. Reading braille key codesWhen 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 brltty. This assumes the existence of a conversion mechanism from key codes to brltty 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_CODESand the following functions: static int brl_readKey(BrailleDisplay *) int brl_keyToCommand(BrailleDisplay *brl, DriverCommandContext caller, int code) The semantics of The RemarksWhen these two functions are present, the only thing
Exchanging raw data packetsUnder 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)
Remarks.
Next Previous Contents |
:: 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.0151 ]-- |