kexts: ps2kbd: send events to devices outside of interrupt context

This commit is contained in:
2023-06-14 17:37:11 +01:00
parent 4a1c6cae69
commit 16d0a398b3

View File

@@ -47,6 +47,12 @@ static const enum input_keycode *keymaps[] = {
static struct driver *ps2_driver = NULL;
static struct input_device *keyboard = NULL, *mouse = NULL;
static void process_input(struct work_item *w);
static struct work_item ps2_work_item = {
.w_func = process_input,
};
static void send_cmd(uint8_t cmd)
{
/* prevent the compiler from optimising this away */
@@ -105,6 +111,12 @@ static void set_config(uint8_t cfg)
}
static int int_handler(void)
{
schedule_work(&ps2_work_item);
return 0;
}
static void process_input(struct work_item *w)
{
static int scancode_level = 0;
static bool released = false;
@@ -112,7 +124,7 @@ static int int_handler(void)
if (scancode_level == PS2_SC2_PSBRK) {
/* TODO pause break keycode */
scancode_level = 0;
return 0;
return;
}
while (data_avail()) {
@@ -150,10 +162,9 @@ static int int_handler(void)
input_device_report_event(keyboard, &ev, true);
released = false;
}
return 0;
}
static int init_controller(void)
{
/* disable ps2 devices */