|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "input.h"#include "common/memory.h"#include "common/string.h"#include "kernel/device/device.h"#include "kernel/errno.h"#include "kernel/memory/heap.h"#include "kernel/process/process.h"#include "kernel/signal/signal.h"#include "kernel/sync/spinlock.h"#include "kernel/sync/wait_queue.h"#include "kernel/time/timer.h"#include "kernel/usermode/uaccess.h"#include "kernel/vfs/file.h"#include "kernel/vfs/poll.h"#include "kernel/vfs/stat.h"Macros | |
| #define | MAX_READERS 8 |
| the input core (see input.h). | |
| #define | RING_EVENTS 256 |
Functions | |
| void | input_report (uint16_t type, uint16_t code, int32_t value) |
| report one change. | |
| void | input_sync (void) |
| end a group of events (EV_SYN / SYN_REPORT). | |
| bool | input_keyboard_grabbed (void) |
| true while a reader holds the keyboard (INPUT_IOC_GRAB): the keyboard driver then gives its keys only to /dev/input, not to the console. | |
| void | input_init (void) |
| make /dev/input. | |
| #define MAX_READERS 8 |
the input core (see input.h).
each open of /dev/input is a reader (from the heap) with a ring of events. a report goes into every reader's ring; a full ring drops its oldest event and marks the reader, so its next read starts with SYN_DROPPED.
locking: one spinlock (interrupts off), shared with the drivers' interrupt handlers.
| #define RING_EVENTS 256 |
report one change.
safe in an interrupt handler.
| type | EV_KEY, EV_REL or EV_ABS. |
| code | the key, button or axis. |
| value | the new state or the change. |
| void input_sync | ( | void | ) |
end a group of events (EV_SYN / SYN_REPORT).
safe in an interrupt handler.
| bool input_keyboard_grabbed | ( | void | ) |
true while a reader holds the keyboard (INPUT_IOC_GRAB): the keyboard driver then gives its keys only to /dev/input, not to the console.
| void input_init | ( | void | ) |
make /dev/input.
call once, after device_registry_init.