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_t * | trans_lookup (gsp_t *p, int state, int input) |
Transition function lookup. | |
static gsp_trans_t * | trans_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_t * | layout [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 |
anonymous enum |
int gsp_insert_defs | ( | gsp_t * | p, | |
const int * | defs | |||
) |
Insert a series of definitions into the parser.
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. |
int gsp_insert_seq | ( | gsp_t * | p, | |
const int * | seq, | |||
unsigned | mods, | |||
unsigned | key | |||
) |
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.
p | The parser. | |
state | Old state. | |
input | Input symbol (scancode). | |
mods | Output value (modifier). | |
key | Output value (key). |
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.
Definition at line 69 of file keybuffer.c.
bool keybuffer_empty | ( | keybuffer_t * | keybuffer | ) |
bool keybuffer_pop | ( | keybuffer_t * | keybuffer, | |
console_event_t * | edst | |||
) |
Pop event from buffer.
edst | Pointer to where the event should be saved. |
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.
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] |
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.
p | Parser. | |
state | Current state. | |
input | Input value. |
NULL
if not defined.
unsigned lock_keys [static] |