Charles.Forsyth20060303-partialeea662d19 years agoHistory
105 lines · 2.0 KB · Text
RawDownload
.TH KBDPUTC 10.2.SH NAMEkbdputc, kbdrepeat, kbdclock, kbdq \- keyboard interface to \fIcons\fP(3).SH SYNOPSIS.ta \w'\f5extern\ \ \f1'u.B#include "keyboard.h".PP.Bvoid	kbdputc(Queue *q, int c).PP.Bvoid	kbdrepeat(int on).PP.Bvoid	kbdclock(void).PP.Bextern	Queue *kbdq;.SH DESCRIPTIONThis is the internal interface between.B /dev/keyboardof.IR cons (3)and the architecture-dependent keyboard driver.Before calling any of these functions,the global variable.B kbdqmust be initialised;.IR cons (3)does not initialise it.This is usually done during system initialisation by the keyboard driver's.I kbdinitfunction ,as follows:.IP.EXkbdq = qopen(4*1024, 0, 0, 0);qnoblock(kbdq, 1);.EE.PP.I Kbdputcputs a 16-bit Unicode character.I c(ie, a `rune')on the given.IR q ,as a sequence of bytes in UTF-8 encoding(see.IR utf (6)).If.I cis the special value.B Latin(defined by.BR keyboard.h ),.I kbdputcstarts collecting characters, looking for the typeable representations ofUnicode characters defined by.IR keyboard (6);at the end of a complete such sequence,.I kbdputcqueues the UTF-8 encoding of the corresponding Unicode character.It is up to the keyboard driver to map a suitable physical keyboard character(or combination of characters) to the code.BR Latin ..PPDrivers that need to implement repeat of keypresses in softwareshould call.IP.EXaddclock0link(kbdclock);.EE.PPat the end of.IR kbdinit ,to cause.I kbdclockto be called each clock tick..I Kbdrepeatcan then be called to enable.RI ( onis non-zero)or disable it.RI ( onis zero).When repeat is on,.I kbdclock(when called) will periodically call.BI "kbdputc(" kbdq , c )where.I cis the last rune given to.IR kbdputc .The driver is responsible for enabling and disabling repeat appropriately;for instance, function keys and certainly.B Latinshould typically not be repeated..SH SOURCE.B /os/*/kbd*.c.SH SEE ALSO.IR cons (3),.IR utf (6),.IR qio (10.2)