From bf47323ce10a8ffd47450baaad6d9c20f41142e1 Mon Sep 17 00:00:00 2001 From: Fortunate-MAN Date: Mon, 16 Jan 2017 12:32:08 +0530 Subject: [PATCH] CTRL + L support #159 --- include/platform/pc/drv/ps2/kbd/kbd.h | 3 ++- platform/pc/drv/ps2/kbd/kbd.c | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/platform/pc/drv/ps2/kbd/kbd.h b/include/platform/pc/drv/ps2/kbd/kbd.h index 7fb2b4d..5e20ee3 100644 --- a/include/platform/pc/drv/ps2/kbd/kbd.h +++ b/include/platform/pc/drv/ps2/kbd/kbd.h @@ -76,7 +76,8 @@ extern int uninit_kbd(); */ extern const char QWERTY_EN_NOSHIFT[] ; extern const char QWERTY_EN_SHIFT[]; -extern int key_press(uint8_t scancode); +extern int key_press(uint8_t scancode); +extern void key_handler(); extern uint8_t kbd_ctrl_read_status_reg(); extern void kbd_ctrl_send_cmd(uint8_t cmd); extern uint8_t kbd_enc_read_input_buf(); diff --git a/platform/pc/drv/ps2/kbd/kbd.c b/platform/pc/drv/ps2/kbd/kbd.c index 02f6bc9..329fac1 100644 --- a/platform/pc/drv/ps2/kbd/kbd.c +++ b/platform/pc/drv/ps2/kbd/kbd.c @@ -107,8 +107,11 @@ void key_release(uint8_t scancode) if ( kbd_layouts[kbd_info.current_kbd_layout_index]->scancode_no_shift[scancode] == KBD_LEFT_SHIFT_PRESS_ID || kbd_layouts[kbd_info.current_kbd_layout_index]->scancode_no_shift[scancode] == KBD_RIGHT_SHIFT_PRESS_ID - ) + ) { kbd_info.is_shift = false; + } + + kbd_info.is_ctrl = false; } /* @@ -183,6 +186,20 @@ static inline void inc_al() */ void key_handler_util(int key) { + //First checking for shortcut commands + if (kbd_info.is_ctrl == true) + { + if (key == 'l' || key == 'L') + { + cmds [CMD_CLEAR_INDEX]->handler ("clear"); + printk (" "); + kbd_info.key = KBD_ENTER_PRESS_ID; + key_handler(); + cmds [CMD_CLEAR_INDEX]->handler ("clear"); + return; + } + } + if(isalpha(key)==0) { if(print_scank == true && active_scank == true)