PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
Keyboard Abstraction

Keyboard abstraction. More...

Collaboration diagram for Keyboard Abstraction:

Detailed Description

Keyboard abstraction.

Keyboard devices are exposed as /dev/kbd/[id] directories, containing the following files:

Data Structures

struct  kbd_t
 Keyboard structure. More...
 

Macros

#define KBD_MAX_EVENT   32
 Maximum number of queued keyboard events.
 

Functions

kbd_tkbd_new (const char *name)
 Allocate and initialize a keyboard structure.
 
void kbd_free (kbd_t *kbd)
 Free and deinitialize a keyboard structure.
 
void kbd_push (kbd_t *kbd, kbd_event_type_t type, keycode_t code)
 Push a keyboard event to the keyboard event queue.
 

Macro Definition Documentation

◆ KBD_MAX_EVENT

#define KBD_MAX_EVENT   32

Maximum number of queued keyboard events.

Definition at line 24 of file kbd.h.

Function Documentation

◆ kbd_new()

kbd_t * kbd_new ( const char *  name)

Allocate and initialize a keyboard structure.

Will make the keyboard available under /dev/kbd/[id].

Parameters
nameDriver specified name of the keyboard device.
Returns
On success, the new keyboard structure. On failure, NULL and errno is set.

Definition at line 87 of file kbd.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kbd_free()

void kbd_free ( kbd_t kbd)

Free and deinitialize a keyboard structure.

Removes the keyboard from /dev/kbd/[id].

Parameters
kbdPointer to the keyboard structure to free.

Definition at line 154 of file kbd.c.

Here is the caller graph for this function:

◆ kbd_push()

void kbd_push ( kbd_t kbd,
kbd_event_type_t  type,
keycode_t  code 
)

Push a keyboard event to the keyboard event queue.

The event will be made available to user space by reading the stream file.

Parameters
kbdPointer to the keyboard structure.
typeThe type of the keyboard event.
codeThe keycode of the keyboard event.

Definition at line 179 of file kbd.c.

Here is the call graph for this function:
Here is the caller graph for this function: