Main Page   Modules   Data Structures   File List   Data Fields   Globals  

Tty getting & leaving

How to take control of ttys for direct braille display / read. More...

Defines

#define BRLKEYCODES   1
#define BRLCOMMANDS   2

Functions

int brlapi_getTty (int tty, int how)
int brlapi_leaveTty (void)

Detailed Description

Before being able to write on the braille display, the application must tell the server which tty it will handle. Some checking is done just to be sure that only one client gets control of each tty.

The application must also specify how braille keys will be delivered to it. Two ways are possible: KEYCODES and COMMANDS

See also:
brlapi_readKey() brlapi_readCommand()

Define Documentation

#define BRLCOMMANDS   2
 

ask for brltty commands

#define BRLKEYCODES   1
 

ask for raw driver keycodes


Function Documentation

int brlapi_getTty int    tty,
int    how
 

ask for some tty, with some key mechanism

Parameters:
tty  * - If tty>0, application takes control of the specified tty;
  • if tty<=0, the library first looks at a CONTROLVT environment variable to get the tty number. If none is found, the WINDOWID is tried (for an xterm case), and if none is found, it tries to get it from /proc/self/stat
Parameters:
how  tells whether the application wants brlapi_readKey() to return keycodes or brltty commands: either BRLKEYCODES or BRLCOMMANDS;
In an X window environment, CONTROLVT might be useful. XFree86 >=4.4 defines an XFree86_VT root window property which exactly holds the used VT, so that it should be given to brlapi_getTty. If it isn't available, one may, right into .xsession and .xinitrc, grep X's log, for instance:

CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number \([0-9]*\).*$/\1/")"

CONTROLVT should also be propagated when running remote applications via ssh, for instance, along with BRLAPI_HOSTNAME and the authentication key.

Returns:
the used tty number on success, -1 on error
See also:
brlapi_leaveTty()

int brlapi_leaveTty void   
 

stop controlling the tty

Returns:
0 on success, -1 on error.
See also:
brlapi_getTty()


Generated on Tue Jul 13 07:08:03 2004 for BrlAPI by doxygen1.2.18