#pragma once #include #include #include /* ------------------------------------------------------------------ * * Generic input event types * ------------------------------------------------------------------ */ typedef enum { INPUT_EV_NONE = 0, INPUT_EV_KEY, /* key press / release */ INPUT_EV_MOUSE_REL, /* relative mouse movement */ INPUT_EV_MOUSE_BTN, /* mouse button press/release */ INPUT_EV_MOUSE_WHEEL, } input_ev_type_t; typedef struct { input_ev_type_t type; union { /* INPUT_EV_KEY */ struct { uint8_t scancode; /* raw set-1 scancode (break bit cleared) */ char ascii; /* 0 if non-printable */ bool pressed; } key; /* INPUT_EV_MOUSE_REL */ struct { int16_t dx, dy; } rel; /* INPUT_EV_MOUSE_BTN */ struct { uint8_t button; /* 0=left 1=right 2=middle */ bool pressed; } btn; /* INPUT_EV_MOUSE_WHEEL */ struct { int8_t delta; } wheel; }; } input_event_t; /* ------------------------------------------------------------------ * * Public API * ------------------------------------------------------------------ */ void input_init(void); /* Called by drivers (PS/2, USB HID, …) to publish events */ void input_push_key(uint8_t scancode, char ascii, bool pressed); void input_push_mouse_rel(int16_t dx, int16_t dy); void input_push_mouse_btn(uint8_t button, bool pressed); void input_push_mouse_wheel(int8_t delta); void input_push_char(char c); int input_read_console(void *buf, size_t len); /* Consumer API */ bool input_poll(input_event_t *out); /* non-blocking; false if empty */ bool input_has_event(void); /* VFS helpers — call after VFS is ready */ void input_register_devnodes(void); /* creates /dev/input/event0 */