kexts: ps2kbd: send events to devices outside of interrupt context
This commit is contained in:
@@ -47,6 +47,12 @@ static const enum input_keycode *keymaps[] = {
|
|||||||
static struct driver *ps2_driver = NULL;
|
static struct driver *ps2_driver = NULL;
|
||||||
static struct input_device *keyboard = NULL, *mouse = 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)
|
static void send_cmd(uint8_t cmd)
|
||||||
{
|
{
|
||||||
/* prevent the compiler from optimising this away */
|
/* prevent the compiler from optimising this away */
|
||||||
@@ -105,6 +111,12 @@ static void set_config(uint8_t cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int int_handler(void)
|
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 int scancode_level = 0;
|
||||||
static bool released = false;
|
static bool released = false;
|
||||||
@@ -112,7 +124,7 @@ static int int_handler(void)
|
|||||||
if (scancode_level == PS2_SC2_PSBRK) {
|
if (scancode_level == PS2_SC2_PSBRK) {
|
||||||
/* TODO pause break keycode */
|
/* TODO pause break keycode */
|
||||||
scancode_level = 0;
|
scancode_level = 0;
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (data_avail()) {
|
while (data_avail()) {
|
||||||
@@ -150,10 +162,9 @@ static int int_handler(void)
|
|||||||
input_device_report_event(keyboard, &ev, true);
|
input_device_report_event(keyboard, &ev, true);
|
||||||
released = false;
|
released = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int init_controller(void)
|
static int init_controller(void)
|
||||||
{
|
{
|
||||||
/* disable ps2 devices */
|
/* disable ps2 devices */
|
||||||
|
|||||||
Reference in New Issue
Block a user