GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
KEYBOARD(3) FreeBSD Library Functions Manual KEYBOARD(3)

initkeyboard, ctlkeyboard, closekeyboard - keyboard control

#include <u.h>
#include <libc.h>
#include <thread.h>
#include <keyboard.h>
Keyboardctl	*initkeyboard(char *file)
int			ctlkeyboard(Keyboardctl *kc, char *msg)
void			closekeyboard(Keyboard *kc)

These functions access and control a keyboard interface for character-at-a-time I/O in a multi-threaded environment, usually in combination with They use the message-passing Channel interface in the threads library (see programs that wish a more event-driven, single-threaded approach should use

Initkeyboard opens a connection to the keyboard and returns a Keyboardctl structure:

typedef struct Keyboardct Keyboardctl;
struct Keyboardctl
{
	Channel	*c;	/* chan(Rune[20]) */
	char	*file;
	int	consfd;		/* to cons file */
	int	ctlfd;		/* to ctl file */
	int	pid;		/* of slave proc */
};
    

The argument to initkeyboard is ignored (on Plan 9, it is the name of the keyboard device).

Once the Keyboardctl is set up a message containing a Rune will be sent on the Channel Keyboardctl.c to report each character read from the device.

Ctlkeyboard is used to set the state of the interface, typically to turn raw mode on and off. It writes the string msg to the control file associated with the device, which is assumed to be the regular device file name with the string ctl appended.

Closekeyboard closes the file descriptors associated with the keyboard, kills the slave processes, and frees the Keyboardctl structure.

/src/libdraw

Because the interface delivers complete runes, there is no way to report lesser actions such as shift keys or even individual bytes.

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.