135 lines
5.6 KiB
HTML
135 lines
5.6 KiB
HTML
<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>
|