From c44a5f54f52efb37859c60741029156631b000eb Mon Sep 17 00:00:00 2001 From: Fortunate-MAN Date: Tue, 17 Jan 2017 18:13:38 +0530 Subject: [PATCH] Control + N support #159 --- bin/boneshell/boneshell.c | 11 +++++++++-- include/bin/boneshell/boneshell.h | 1 + platform/pc/drv/ps2/kbd/kbd.c | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bin/boneshell/boneshell.c b/bin/boneshell/boneshell.c index 8fd6c57..74d1c7d 100644 --- a/bin/boneshell/boneshell.c +++ b/bin/boneshell/boneshell.c @@ -49,10 +49,10 @@ struct cmd_opt_t* cmd_boneshell_opts[] = int __found = 0; volatile bool exit_set__shell = false; +volatile bool new_set__shell = false; volatile bool tab_multiple_opts = false; volatile bool tab_one_opt = false; volatile bool tab_zero_opt = false; -volatile bool exit_shell = false; bool executed_internally=false; void removeSpaces(char* source) @@ -120,7 +120,7 @@ void loop_terminal() scank (true, true, "%s", cmd_active.value + (strlen (cmd_active.value))); } - if(strcmp(cmd_active.value, "exit")==0 || exit_set__shell == true) + if(strcmp(cmd_active.value, "exit") == 0 || exit_set__shell == true) //if (exit_set__shell == true) { shell_instance_cnt--; @@ -130,6 +130,13 @@ void loop_terminal() goto end_shell; } + if (new_set__shell == true) + { + new_set__shell = false; + loop_terminal(); + goto start_shell; + } + for(int i=0; cmds[i]; i++) { if(termcmp(cmds[i]->name, cmd_active.value)==0) diff --git a/include/bin/boneshell/boneshell.h b/include/bin/boneshell/boneshell.h index db45dd3..cb7ee90 100644 --- a/include/bin/boneshell/boneshell.h +++ b/include/bin/boneshell/boneshell.h @@ -3,6 +3,7 @@ #include +extern volatile bool new_set__shell; extern struct cmd_t cmd_boneshell; extern volatile bool exit_shell; diff --git a/platform/pc/drv/ps2/kbd/kbd.c b/platform/pc/drv/ps2/kbd/kbd.c index 160f483..3df655d 100644 --- a/platform/pc/drv/ps2/kbd/kbd.c +++ b/platform/pc/drv/ps2/kbd/kbd.c @@ -214,6 +214,14 @@ void key_handler_util(int key) key_handler(); kbd_info.key = ' '; return; + } + else if (key == 'n' || key == 'N') + { + new_set__shell = true; + kbd_info.key = KBD_ENTER_PRESS_ID; + key_handler(); + kbd_info.key = ' '; + return; } }