Skip to content

Commit 06f5dc5

Browse files
author
Diego Ferrari
committed
Making input an (optional) driver
1 parent 14a7f6b commit 06f5dc5

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

kernel/input/input_dispatch.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,17 @@ void init_input_process(){
143143

144144
void handle_input_interrupt(){
145145
if (input_driver->use_interrupts) input_driver->handle_interrupt();
146-
}
146+
}
147+
148+
driver_module input_module = (driver_module){
149+
.name = "input",
150+
.mount = "/in",
151+
.version = VERSION_NUM(0, 1, 0, 1),
152+
.init = input_init,
153+
.fini = 0,
154+
.open = 0,
155+
.read = 0,
156+
.write = 0,
157+
.seek = 0,
158+
.readdir = 0,
159+
};

kernel/input/input_dispatch.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "input_keycodes.h"
44
#include "keypress.h"
5+
#include "dev/driver_base.h"
56

67
#ifdef __cplusplus
78
extern "C" {
@@ -25,12 +26,12 @@ bool sys_shortcut_triggered(uint16_t pid, uint16_t sid);
2526

2627
bool is_new_keypress(keypress* current, keypress* previous);
2728

28-
bool input_init();
29-
3029
void handle_input_interrupt();
3130

3231
void init_input_process();
3332

33+
extern driver_module input_module;
34+
3435
#ifdef __cplusplus
3536
}
3637
#endif

kernel/kernel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ void kernel_main() {
6060
panic("Disk initialization failure");
6161

6262
// xhci_enable_verbose();
63-
if (!input_init())
64-
panic("Input initialization error");
63+
bool input_available = load_module(&input_module);
6564

6665
bool network_available = load_module(&net_module);
6766

6867
load_module(&audio_module);
6968

70-
init_input_process();
69+
if (input_available)
70+
init_input_process();
7171

7272
mmu_init();
7373
kprint("MMU Mapped");

0 commit comments

Comments
 (0)