---
name: "brlapi_ignoreKeyRange"
section: "3"
platform: "linux"
package: "libbrlapi1-dev"
version: "3.7.2-7.1"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/brlapi_keys"
---

# brlapi\_ignoreKeyRange(3)

How to read key presses from the braille terminal.

Part of [brlapi\_keys(3)](/brlapi_keys/3.md).

## NAME

Reading key presses - How to read key presses from the braille terminal.

### Defines

\#define **BRL\_KEYCODE\_MAX**   ((**brl\_keycode\_t**) (UINT32\_MAX))\
 \#define **BRLAPI\_MAXKEYSETSIZE**   (BRLAPI\_MAXPACKETSIZE / sizeof(**brl\_keycode\_t**))\

### Typedefs

typedef uint32\_t **brl\_keycode\_t**\

### Functions

int **brlapi\_readKey** (int block, **brl\_keycode\_t** \*code)\
 int **brlapi\_ignoreKeyRange** (**brl\_keycode\_t** x, **brl\_keycode\_t** y)\
 int **brlapi\_ignoreKeySet** (const **brl\_keycode\_t** \*s, unsigned int n)\
 int **brlapi\_unignoreKeyRange** (**brl\_keycode\_t** x, **brl\_keycode\_t** y)\
 int **brlapi\_unignoreKeySet** (const **brl\_keycode\_t** \*s, unsigned int n)\

## Detailed Description

Once **brlapi\_getTty()** is called, the application can call **brlapi\_readKey()** to read key presses. Either key codes or commands will be returned, depending on parameters given to **brlapi\_getTty()**.

Key presses are buffered, so that calling **brlapi\_readKey()** in non-blocking mode from times to times should suffice.

## Define Documentation

### #define BRL\_KEYCODE\_MAX ((brl\_keycode\_t) (UINT32\_MAX))

Brl\_keycode\_t's biggest value

As defined in `<stdint.h>`

### #define BRLAPI\_MAXKEYSETSIZE (BRLAPI\_MAXPACKETSIZE / sizeof(brl\_keycode\_t))

Maximum keyset size, i.e. maximum number of keys allowed in a key set

## Typedef Documentation

### typedef uint32\_t brl\_keycode\_t

Type for key codes

Its size is 32 bits, so driver implementors have to restrict themselves to a 32 bit space.

## Function Documentation

### int brlapi\_ignoreKeyRange (brl\_keycode\_t x, brl\_keycode\_t y)

Ignore some key presses from the braille keyboard

This function asks the server to give keys between x and y to *brltty*, rather than returning them to the application via **brlapi\_readKey()**

**Note:**

The given codes are either raw keycodes if some driver name was given to **brlapi\_getTty()**, or *brltty* commands if NULL or '' was given.

### int brlapi\_ignoreKeySet (const brl\_keycode\_t \* s, unsigned int n)

Ignore some key presses from the braille keyboard

This function asks the server to give the n keys in set s to *brltty*, rather than returning them to the application via **brlapi\_readKey()**

**Note:**

The given codes are either raw keycodes if some driver name was given to **brlapi\_getTty()**, or *brltty* commands if NULL or '' was given.

### int brlapi\_readKey (int block, brl\_keycode\_t \* code)

Read a key from the braille keyboard

This function returns one key press's code.

If NULL or '' was given to **brlapi\_getTty()**, a *brltty* command is returned, as described in `<brltty/brldefs`.h\> . It is hence pretty driver-independent, and should be used by default when no other option is possible.

By default, all commands but those which restart drivers and switch virtual terminals are returned to the application and not to brltty. If the application doesn't want to see some command events, it should call either **brlapi\_ignoreKeySet()** or **brlapi\_ignoreKeyRange()**

If some driver name was given to **brlapi\_getTty()**, a raw keycode is returned, as specified by the terminal driver, usually in \<brltty/brldefs-xy\> where xy is the driver's code. It generally corresponds to the very code that the terminal tells to the driver. This should only be used by applications which are dedicated to a particular braille terminal. Hence, checking the terminal type thanks to a call to **brlapi\_getDriverId()** or even **brlapi\_getDriverName()** before getting tty control is a pretty good idea.

By default, all the keypresses will be passed to the client, none will go through brltty, so the application will have to handle console switching itself for instance.

**Parameters:**

*block* tells whether the call should block until a key is pressed (1) or should only probe key presses (0); \
 *code* holds the key code if a key press is indeed read.

**Returns:**

\-1 on error and \*code is then undefined, 0 if block was 0 and no key was pressed so far, or 1 and \*code holds the key code.

### int brlapi\_unignoreKeyRange (brl\_keycode\_t x, brl\_keycode\_t y)

Unignore some key presses from the braille keyboard

This function asks the server to return keys between x and y to the application, and not give them to *brltty*.

**Note:**

You shouldn't ask the server to give you key presses which are usually used to switch between TTYs, unless you really know what you are doing!

The given codes are either raw keycodes if some driver name was given to **brlapi\_getTty()**, or *brltty* commands if NULL or '' was given.

### int brlapi\_unignoreKeySet (const brl\_keycode\_t \* s, unsigned int n)

Unignore some key presses from the braille keyboard

This function asks the server to return all n keys in set s to the application, and not give them to *brltty*.

**Note:**

You shouldn't ask the server to give you key presses which are usually used to switch between TTYs, unless you really know what you are doing!

The given codes are either raw keycodes if some driver name was given to **brlapi\_getTty()**, or *brltty* commands if NULL or '' was given.
