generic
[Keyboard Service]

HelenOS generic uspace keyboard handler. More...


Files

file  gsp.c
 Generic scancode parser.
file  gsp.h
file  kbd.c
file  kbd.h
file  kbd.h
file  kbd_ctl.h
file  kbd_port.h
file  keybuffer.c
file  keybuffer.h
file  layout.h
file  stroke.h
file  sun.h

Data Structures

struct  gsp_t
 Scancode parser description. More...
struct  gsp_trans_t
 Scancode parser transition. More...
struct  keybuffer_t
struct  layout_op_t

Defines

#define KEYBUFFER_SIZE   128
 Size of buffer for pressed keys.
#define NAME   "kbd"
#define NAMESPACE   "hid_in"
#define NUM_LAYOUTS   3
#define TRANS_TABLE_CHAINS   256

Enumerations

enum  { GSP_END = -1, GSP_DEFAULT = -2 }
enum  kbd_notif_t
enum  kbd_request_t

Functions

static void client_connection (ipc_callid_t iid, ipc_call_t *icall)
void gsp_init (gsp_t *p)
 Initialise scancode parser.
int gsp_insert_defs (gsp_t *p, const int *defs)
 Insert a series of definitions into the parser.
int gsp_insert_seq (gsp_t *p, const int *seq, unsigned mods, unsigned key)
 Insert one sequence into the parser.
int gsp_step (gsp_t *p, int state, int input, unsigned *mods, unsigned *key)
 Compute one parser step.
int kbd_ctl_init (void)
void kbd_ctl_parse_scancode (int)
void kbd_ctl_set_ind (unsigned)
void kbd_port_reclaim (void)
void kbd_port_write (uint8_t)
void kbd_port_yield (void)
void kbd_push_ev (int type, unsigned int key)
void kbd_push_scancode (int scancode)
size_t keybuffer_available (keybuffer_t *keybuffer)
 Get free space in buffer.
bool keybuffer_empty (keybuffer_t *keybuffer)
void keybuffer_free (keybuffer_t *keybuffer)
 Clear key buffer.
void keybuffer_init (keybuffer_t *keybuffer)
 Key buffer initialization.
bool keybuffer_pop (keybuffer_t *keybuffer, console_event_t *edst)
 Pop event from buffer.
void keybuffer_push (keybuffer_t *keybuffer, const console_event_t *ev)
 Push key event to key buffer.
int main (int argc, char **argv)
int ns16550_port_init (void)
void stroke_sim (unsigned, unsigned)
 Simulate keystroke using sequences of key presses and releases.
static void trans_insert (gsp_t *p, gsp_trans_t *t)
 Define a new transition.
static gsp_trans_ttrans_lookup (gsp_t *p, int state, int input)
 Transition function lookup.
static gsp_trans_ttrans_new (void)
 Allocate transition structure.
static int trans_op_compare (unsigned long key[], hash_count_t keys, link_t *item)
static hash_index_t trans_op_hash (unsigned long key[])
static void trans_op_remove_callback (link_t *item)
int z8530_port_init (void)

Variables

static int active_layout = 0
int client_phone = -1
layout_op_t cz_op
int irc_phone
int irc_phone = -1
bool irc_service
bool irc_service = false
atomic_t keybuffer_futex = FUTEX_INITIALIZER
static layout_op_tlayout [NUM_LAYOUTS]
static unsigned lock_keys
 Currently pressed lock keys.
static unsigned mods = KM_NUM_LOCK
 Currently active modifiers.
static hash_table_operations_t trans_ops
layout_op_t us_dvorak_op
layout_op_t us_qwerty_op

Detailed Description

HelenOS generic uspace keyboard handler.


Enumeration Type Documentation

anonymous enum

Enumerator:
GSP_END  Terminates a sequence.
GSP_DEFAULT  Wildcard, catches unhandled cases.

Definition at line 42 of file gsp.h.


Function Documentation

int gsp_insert_defs ( gsp_t p,
const int *  defs 
)

Insert a series of definitions into the parser.

Parameters:
p The parser.
defs Definition list. Each definition starts with two output values (mods, key) and continues with a sequence of input values terminated with GSP_END. The definition list is terminated with two zeroes (0, 0) for output values.

Definition at line 92 of file gsp.c.

int gsp_insert_seq ( gsp_t p,
const int *  seq,
unsigned  mods,
unsigned  key 
)

Insert one sequence into the parser.

Parameters:
p The parser.
seq Sequence of input values terminated with GSP_END.
mods Corresponsing output value.
key Corresponsing output value.

Definition at line 127 of file gsp.c.

int gsp_step ( gsp_t p,
int  state,
int  input,
unsigned *  mods,
unsigned *  key 
)

Compute one parser step.

Computes the next state and output values for a given state and input. This handles everything including restarts and default branches.

Parameters:
p The parser.
state Old state.
input Input symbol (scancode).
mods Output value (modifier).
key Output value (key).
Returns:
New state.

Definition at line 189 of file gsp.c.

size_t keybuffer_available ( keybuffer_t keybuffer  ) 

Get free space in buffer.

This function is useful for processing some scancodes that are translated to more than one character.

Returns:
empty buffer space

Definition at line 69 of file keybuffer.c.

bool keybuffer_empty ( keybuffer_t keybuffer  ) 

Returns:
nonzero, if buffer is not empty.

Definition at line 79 of file keybuffer.c.

bool keybuffer_pop ( keybuffer_t keybuffer,
console_event_t edst 
)

Pop event from buffer.

Parameters:
edst Pointer to where the event should be saved.
Returns:
True if an event was popped.

Definition at line 112 of file keybuffer.c.

void keybuffer_push ( keybuffer_t keybuffer,
const console_event_t ev 
)

Push key event to key buffer.

If the buffer is full, the event is ignored.

Parameters:
keybuffer The keybuffer.
ev The event to push.

Definition at line 92 of file keybuffer.c.

static void trans_insert ( gsp_t p,
gsp_trans_t t 
) [static]

Define a new transition.

Parameters:
p The parser.
t Transition with all fields defined.

Definition at line 240 of file gsp.c.

static gsp_trans_t * trans_lookup ( gsp_t p,
int  state,
int  input 
) [static]

Transition function lookup.

Returns the value of the transition function for the given state and input. Note that the transition must be specified precisely, to obtain the default branch use input = GSP_DEFAULT.

Parameters:
p Parser.
state Current state.
input Input value.
Returns:
The transition or NULL if not defined.

Definition at line 221 of file gsp.c.


Variable Documentation

unsigned lock_keys [static]

Currently pressed lock keys.

We track these to tackle autorepeat.

Definition at line 67 of file kbd.c.


Generated on Thu Jun 2 07:45:57 2011 for HelenOS/USB by  doxygen 1.4.7