---
name: "BRLKEYCODES"
section: "3"
platform: "linux"
package: "libbrlapi-dev"
version: "3.4.1-4"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/brlapi_tty"
---

# BRLKEYCODES(3)

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

Part of [brlapi\_tty(3)](/brlapi_tty/3.md).

## NAME

Tty getting & leaving - How to take control of ttys for direct braille display / read.

### Defines

\#define **BRLKEYCODES**   ((uint32\_t) 1)\
 \#define **BRLCOMMANDS**   ((uint32\_t) 2)\

### Functions

int **brlapi\_getTty** (uint32\_t tty, uint32\_t how, **brlapi\_keybinding\_t** \*keybinding)\
 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

- •

  KEYCODES are specific to each braille driver, since the raw keycode, as defined in the driver will be given for each key press. Using them leads to building highly driver-dependent applications, which can yet sometimes be useful to mimic existing proprietary applications for instance.

- •

  COMMANDS means that applications will get exactly the same values as *brltty*. This allows driver-independent clients, which will hopefully be nice to use with a lot of different terminals

**See also:**

**brlapi\_readKey()** **brlapi\_readCommand()** **brlapi\_readBinding()**

## Define Documentation

### #define BRLCOMMANDS ((uint32\_t) 2)

ask for *brltty* commands

### #define BRLKEYCODES ((uint32\_t) 1)

ask for raw driver keycodes

## Function Documentation

### int brlapi\_getTty (uint32\_t tty, uint32\_t how, brlapi\_keybinding\_t \* keybinding)

ask for some tty, with some key mechanism

**Parameters:**

*tty* .IP "•" 2 If tty\>0, application takes control of the specified tty;

- •

  if tty==0, the library calls **brlapi\_getControllingTty()** itself and takes control of the result.

*how* tells whether the application wants **brlapi\_readKey()** to return keycodes or *brltty* commands: either BRLKEYCODES or BRLCOMMANDS;\
 *keybinding* tells settings for bindings. This is only necessary if **brlapi\_readBinding()** will be called; else `NULL` can be given.

**Returns:**

0 on success, -1 on error

### int brlapi\_leaveTty (void)

stop controlling the tty

**Returns:**

0 on success, -1 on error.
