Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

Tty getting & leaving

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

Functions

int brlapi_getTty (int tty, const char *how)
int brlapi_getTtyPath (int *ttys, int nttys, const char *how)
int brlapi_leaveTty (void)
int brlapi_setFocus (int tty)

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: key codes and commands:


Function Documentation

int brlapi_getTty int  tty,
const char *  how
 

Ask for some tty, with some key mechanism

Parameters:
tty 
  • If tty>=0, application takes control of the specified tty;
  • if tty==-1, the library first tries to get the tty number from the WINDOWID environment variable (for xterm case), then the CONTROLVT variable, and at last reads /proc/self/stat (on linux).
how tells how the application wants brlapi_readKey() to return key presses. NULL or "" means BRLTTY commands are required, whereas a driver name means that raw key codes returned by this driver are expected.
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() brlapi_readKey()

int brlapi_getTtyPath int *  ttys,
int  nttys,
const char *  how
 

Ask for some tty path, with some key mechanism

Parameters:
ttys points on the array of ttys representing the tty path to be got. Can be NULL if nttys is 0.
nttys gives the number of elements in ttys.
how has the same meaning as in brlapi_getTty()
Providing nttys == 0 means to get the root.

See also:
brlapi_getTty()

int brlapi_leaveTty void   ) 
 

Stop controlling the tty

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

int brlapi_setFocus int  tty  ) 
 

Tell the current tty to brltty

This is intended for focus tellers, such as brltty, xbrlapi, screen, ... brlapi_getTty() must have been called beforehand to tell where this focus applies in the tty tree.

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


Generated on Mon Dec 26 09:55:17 2005 for BrlAPI by  doxygen 1.4.4