File: brlapi_keys.3

package info (click to toggle)
brltty 3.4.1-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,268 kB
  • ctags: 4,537
  • sloc: ansic: 54,295; sh: 3,470; makefile: 793; tcl: 398; yacc: 300; awk: 57; python: 29
file content (184 lines) | stat: -rw-r--r-- 6,889 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
.TH "Reading key presses" 3 "15 Jan 2004" "BrlAPI" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Reading key presses \- How to read key presses from the braille terminal. 
More...
.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBbrlapi_keybinding_t\fP"
.br
.RI "\fIKey binding structure.\fP"
.in -1c
.SS "Defines"

.in +1c
.ti -1c
.RI "#define \fBBRL_KEYBUF_SIZE\fP   256"
.br
.ti -1c
.RI "#define \fBBRL_KEYCODE_MAX\fP   ((\fBbrl_keycode_t\fP) (UINT32_MAX))"
.br
.ti -1c
.RI "#define \fBBRLAPI_HOMEKEYDIR\fP   '.brlkeys'"
.br
.ti -1c
.RI "#define \fBBRLAPI_HOMEKEYEXT\fP   '.kbd'"
.br
.ti -1c
.RI "#define \fBBRLAPI_ETCKEYFILE\fP   'brlkeys'"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef uint32_t \fBbrl_keycode_t\fP"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBbrlapi_readKey\fP (int block, \fBbrl_keycode_t\fP *code)"
.br
.ti -1c
.RI "int \fBbrlapi_readCommand\fP (int block, \fBbrl_keycode_t\fP *code)"
.br
.ti -1c
.RI "int \fBbrlapi_readBinding\fP (int block, const char **code)"
.br
.ti -1c
.RI "int \fBbrlapi_ignoreKeys\fP (\fBbrl_keycode_t\fP x, \fBbrl_keycode_t\fP y)"
.br
.ti -1c
.RI "int \fBbrlapi_unignoreKeys\fP (\fBbrl_keycode_t\fP x, \fBbrl_keycode_t\fP y)"
.br
.in -1c
.SH "DETAILED DESCRIPTION"
.PP 
Once \fBbrlapi_getTty()\fP is called, the application can call \fBbrlapi_readKey()\fP, \fBbrlapi_readCommand()\fP or \fBbrlapi_readBinding()\fP to read key presses. Not everyone can be called, it depends on parameters given to \fBbrlapi_getTty()\fP.
.PP
key presses are buffered, so that calling \fBbrlapi_readKey()\fP in non-blocking mode from times to times should suffice. 
.SH "DEFINE DOCUMENTATION"
.PP 
.SS "#define BRL_KEYBUF_SIZE   256"
.PP
buffer size
.PP
key presses won't be lost provided no more than BRL_KEYBUF_SIZE key presses are done between two calls to brlapi_read* if a call to another function is done in the meanwhile (which needs somewhere to put them before being able to get responses from the server) 
.SS "#define BRL_KEYCODE_MAX   ((\fBbrl_keycode_t\fP) (UINT32_MAX))"
.PP
brl_keycode_t's biggest value
.PP
As defined in \fC<inttypes.h>\fP 
.SS "#define BRLAPI_ETCKEYFILE   'brlkeys'"
.PP
Prefix for driver-dependent key names header files
.PP
Driver-dependent key names header files are stored in BRLAPI_ETCDIR/BRLAPI_ETCKEYFILE-xy.h where \fCxy\fP is the driver code, as returned by \fBbrlapi_getDriverId()\fP 
.SS "#define BRLAPI_HOMEKEYDIR   '.brlkeys'"
.PP
\fIBrlAPI\fP 's $HOME settings directory
.PP
this directory will contain per-user configuration 
.SS "#define BRLAPI_HOMEKEYEXT   '.kbd'"
.PP
\fIBrlAPI\fP 's key binding suffix 
.SH "TYPEDEF DOCUMENTATION"
.PP 
.SS "typedef uint32_t brl_keycode_t"
.PP
type for key codes
.PP
Its size is 32 bits, so driver implementors have to restrict themselves to a 32 bit space. 
.SH "FUNCTION DOCUMENTATION"
.PP 
.SS "int brlapi_ignoreKeys (\fBbrl_keycode_t\fP x, \fBbrl_keycode_t\fP y)"
.PP
Ignore some key presses from the braille keyboard
.PP
This function asks the server to give keys between x and y to \fIbrltty\fP, rather than returning them to the application via brlapi_read(Key|Command|Binding)()
.PP
\fBNote: \fP
.in +1c
The given codes are either raw keycodes if BRLKEYCODES was given to \fBbrlapi_getTty()\fP, or \fIbrltty\fP commands if BRLCOMMANDS was given. 
.SS "int brlapi_readBinding (int block, const char ** code)"
.PP
read a key binding from the braille keyboard
.PP
This function returns a command name, as bound in user's configuration file: if the read is successful, a pointer on a string is returned, this is the string defined in $HOME/.brlkeys/appli-xy.kbd for the key which was read, else \fCNULL\fP is returned
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIblock\fP\fP
tells whether the call should block until a key is pressed (1) or should only probe key presses (0). 
.TP
\fB\fIcode\fP\fP
holds the key string if a key press is indeed read.It can be called only if a \fBbrlapi_keybinding_t\fP structure was filled and given to \fBbrlapi_getTty()\fP
.PP
\fBReturns: \fP
.in +1c
-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 string. 
.SS "int brlapi_readCommand (int block, \fBbrl_keycode_t\fP * code)"
.PP
Read a command from the braille keyboard
.PP
This function returns \fIbrltty\fP commands, as described in \fC<brltty/brldefs.h>\fP . These are hence pretty driver-independent, and should be used by default when no other option is possible.
.PP
It can be called only if BRLCOMMANDS was given to \fBbrlapi_getTty()\fP
.PP
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 \fBbrlapi_ignoreKeys()\fP
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIblock\fP\fP
tells whether the call should block until a key is pressed (1) or should only probe key presses (0). 
.TP
\fB\fIcode\fP\fP
holds the command code if a key press is indeed read.
.PP
\fBReturns: \fP
.in +1c
-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 command code. 
.SS "int brlapi_readKey (int block, \fBbrl_keycode_t\fP * code)"
.PP
Read a key from the braille keyboard
.PP
This function returns raw keycodes, as specified by the terminal driver. It generally corresponds to the code the terminal tells to the driver.
.PP
This should only be used to application which are dedicated to a particular braille terminal. Hence, checking the terminal type thanks to a call to \fBbrlapi_getDriverId()\fP or even \fBbrlapi_getDriverName()\fP before getting tty control is a pretty good idea.
.PP
It can be called only if BRLKEYCODES was given to \fBbrlapi_getTty()\fP
.PP
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.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIblock\fP\fP
tells whether the call should block until a key is pressed (1) or should only probe key presses (0), 
.TP
\fB\fIcode\fP\fP
holds the key code if a key press is indeed read.
.PP
\fBReturns: \fP
.in +1c
-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. 
.SS "int brlapi_unignoreKeys (\fBbrl_keycode_t\fP x, \fBbrl_keycode_t\fP y)"
.PP
Unignore some key presses from the braille keyboard
.PP
This function asks the server to return keys between x and y to the application, and not give them to \fIbrltty\fP.
.PP
\fBNote: \fP
.in +1c
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 !
.PP
\fBNote: \fP
.in +1c
The given codes are either raw keycodes if BRLKEYCODES was given to \fBbrlapi_getTty()\fP, or \fIbrltty\fP commands if BRLCOMMANDS was given.