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
|
<head>
<title>keyboard(3) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>KEYBOARD(3)</b><td align=right><b>KEYBOARD(3)</b>
<tr><td width=20><td colspan=2>
<br>
<p><font size=+1><b>NAME </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
initkeyboard, ctlkeyboard, closekeyboard – keyboard control<br>
</table>
<p><font size=+1><b>SYNOPSIS </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>#include <u.h><br>
#include <libc.h><br>
#include <thread.h><br>
#include <keyboard.h><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
</font></tt>
<tt><font size=+1>Keyboardctl *initkeyboard(char *file)<br>
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
</font></tt>
<tt><font size=+1>int ctlkeyboard(Keyboardctl *kc, char *msg)<br>
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
</font></tt>
<tt><font size=+1>void closekeyboard(Keyboard *kc)<br>
</font></tt>
</table>
<p><font size=+1><b>DESCRIPTION </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
These functions access and control a keyboard interface for character-at-a-time
I/O in a multi-threaded environment, usually in combination with
<a href="../man3/mouse.html"><i>mouse</i>(3)</a>. They use the message-passing <tt><font size=+1>Channel</font></tt> interface in the
threads library (see <a href="../man3/thread.html"><i>thread</i>(3)</a>); programs that wish a more event-driven,
single-threaded approach
should use <a href="../man3/event.html"><i>event</i>(3)</a>.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Initkeyboard</i> opens a connection to the keyboard and returns a
<tt><font size=+1>Keyboardctl</font></tt> structure:<br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>typedef struct Keyboardct Keyboardctl;<br>
struct Keyboardctl<br>
{<br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
Channel *c; /* chan(Rune[20]) */<br>
char *file;<br>
int consfd; /* to cons file */<br>
int ctlfd; /* to ctl file */<br>
int pid; /* of slave proc */<br>
</table>
};<br>
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
</font></tt>
</table>
The argument to <i>initkeyboard</i> is ignored (on Plan 9, it is the
name of the keyboard device).
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
Once the <tt><font size=+1>Keyboardctl</font></tt> is set up a message containing a <tt><font size=+1>Rune</font></tt> will
be sent on the <tt><font size=+1>Channel Keyboardctl.c</font></tt> to report each character
read from the device.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Ctlkeyboard</i> is used to set the state of the interface, typically
to turn raw mode on and off. It writes the string <i>msg</i> to the control
file associated with the device, which is assumed to be the regular
device file name with the string <tt><font size=+1>ctl</font></tt> appended.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Closekeyboard</i> closes the file descriptors associated with the
keyboard, kills the slave processes, and frees the <tt><font size=+1>Keyboardctl</font></tt>
structure.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
</table>
<p><font size=+1><b>SOURCE </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>/usr/local/plan9/src/libdraw<br>
</font></tt>
</table>
<p><font size=+1><b>SEE ALSO </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<a href="../man3/graphics.html"><i>graphics</i>(3)</a>, <a href="../man3/draw.html"><i>draw</i>(3)</a>, <a href="../man3/event.html"><i>event</i>(3)</a>, <a href="../man3/thread.html"><i>thread</i>(3)</a>.<br>
</table>
<p><font size=+1><b>BUGS </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
Because the interface delivers complete runes, there is no way
to report lesser actions such as shift keys or even individual
bytes.<br>
</table>
<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>
|