|
PatchworkOS
19e446b
A non-POSIX operating system.
|
Keyboard abstraction. More...
Keyboard abstraction.
Keyboard devices are exposed as a /dev/kbd/[id]/ directory, containing the below files.
A read-only file that contains the driver defined name of the keyboard device.
A readable and pollable file that provides a stream of keyboard events represented as integer keycodes suffixed with a _ or ^ to indicate press or release respectively.
The below example shows a press of the 1 key, its subsequent release, and then a press of the A key.
If no events are available to read, the read call will block until an event is available unless the file is opened in non-blocking mode in which case the read will fail with EAGAIN.
scan() is used with "%u%c" the scan() call does not require any "ungets".Data Structures | |
| struct | kbd_client_t |
| Keyboard event client structure. More... | |
| struct | kbd_t |
| Keyboard structure. More... | |
Macros | |
| #define | KBD_CLIENT_BUFFER_SIZE 512 |
| Size of the keyboard client buffer. | |
Functions | |
| kbd_t * | kbd_new (const char *name) |
| Allocate and initialize a new keyboard. | |
| void | kbd_free (kbd_t *kbd) |
| Frees a keyboard. | |
| void | kbd_press (kbd_t *kbd, keycode_t code) |
| Push a keyboard press event to the keyboard event queue. | |
| void | kbd_release (kbd_t *kbd, keycode_t code) |
| Push a keyboard release event to the keyboard event queue. | |
| #define KBD_CLIENT_BUFFER_SIZE 512 |
| kbd_t * kbd_new | ( | const char * | name | ) |
| void kbd_free | ( | kbd_t * | kbd | ) |