62 if (*offset >= nameLen)
#define MAX_NAME
Maximum length of names.
#define KBD_MAX_EVENT
Maximum number of queued keyboard events.
void kbd_push(kbd_t *kbd, kbd_event_type_t type, keycode_t code)
Push a keyboard event to the keyboard event queue.
void kbd_free(kbd_t *kbd)
Free and deinitialize a keyboard structure.
kbd_t * kbd_new(const char *name)
Allocate and initialize a keyboard structure.
#define BUFFER_READ(buffer, count, offset, src, size)
Helper macros for implementing file operations dealing with simple buffers.
uint64_t wait_unblock(wait_queue_t *waitQueue, uint64_t amount, errno_t err)
Unblock threads waiting on a wait queue.
void wait_queue_init(wait_queue_t *waitQueue)
Initialize wait queue.
#define WAIT_ALL
Wait for all.
#define WAIT_BLOCK_LOCK(waitQueue, lock, condition)
Block with a spinlock.
void wait_queue_deinit(wait_queue_t *waitQueue)
Deinitialize wait queue.
static void lock_init(lock_t *lock)
Initializes a lock.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
clock_t timer_uptime(void)
Time since boot.
#define DEREF(ptr)
Decrement reference count.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
poll_events_t
Poll events type.
@ POLLIN
File descriptor is ready to read.
keycode_t
Keyboard keycode type.
kbd_mods_t
Keyboard modifiers type.
kbd_event_type_t
Keyboard event type.
@ KBD_RIGHT_SUPER
Right Super key.
@ KBD_LEFT_ALT
Left Alt key.
@ KBD_LEFT_SHIFT
Left Shift key.
@ KBD_RIGHT_SHIFT
Right Shift key.
@ KBD_LEFT_CTRL
Left Control key.
@ KBD_RIGHT_ALT
Right Alt key.
@ KBD_CAPS_LOCK
Caps Lock key.
@ KBD_RIGHT_CTRL
Right Control key.
@ KBD_LEFT_SUPER
Left Super key.
@ KBD_MOD_SUPER
Super (Windows/Command) modifier.
@ KBD_MOD_CAPS
Caps Lock modifier.
@ KBD_MOD_NONE
No modifier.
@ KBD_MOD_CTRL
Control modifier.
@ KBD_MOD_ALT
Alt modifier.
@ KBD_MOD_SHIFT
Shift modifier.
@ KBD_RELEASE
Key release event.
@ KBD_PRESS
Key press event.
#define ROUND_DOWN(number, multiple)
#define NULL
Pointer error value.
#define ERR
Integer error value.
static atomic_uint64_t newId
static uint64_t kbd_name_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
static void kbd_dir_cleanup(inode_t *inode)
static void kbd_update_mod(kbd_t *kbd, kbd_event_type_t type, kbd_mods_t mod)
static wait_queue_t * kbd_events_poll(file_t *file, poll_events_t *revents)
static file_ops_t nameOps
static inode_ops_t dirInodeOps
static file_ops_t eventsOps
static uint64_t kbd_events_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
EFI_PHYSICAL_ADDRESS buffer
#define ATOMIC_VAR_INIT(value)
#define atomic_fetch_add(object, operand)
_PUBLIC int snprintf(char *_RESTRICT s, size_t n, const char *_RESTRICT format,...)
_PUBLIC void * calloc(size_t nmemb, size_t size)
_PUBLIC void free(void *ptr)
_PUBLIC char * strncpy(char *_RESTRICT s1, const char *_RESTRICT s2, size_t n)
size_t strnlen_s(const char *s, size_t maxsize)
Directory entry structure.
File operations structure.
uint64_t(* read)(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
void(* cleanup)(inode_t *inode)
Keyboard event structure.
clock_t time
Timestamp of the event.
kbd_event_t events[KBD_MAX_EVENT]
dentry_t * sysfs_dir_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, void *private)
Create a new directory inside a mounted SysFS instance.
dentry_t * sysfs_file_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, const file_ops_t *fileOps, void *private)
Create a new file inside a mounted SysFS instance.