Skip to content

Commit

Permalink
Control + D support #159
Browse files Browse the repository at this point in the history
  • Loading branch information
double-fault committed Jan 16, 2017
1 parent 0b6e252 commit 43eac59
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
9 changes: 8 additions & 1 deletion bin/boneshell/boneshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
** @contributors:
** Amanuel Bogale <amanuel2> : start
** Ashish Ahuja <Fortunate-MAN>
**/

#include <stdio/stdio.h>
Expand All @@ -34,6 +35,7 @@
#include <drv/ps2/kbd/kbd.h>
#include <drv/cmos/rtc/rtc.h>
#include <../platform/pc/drv/ps2/kbd/kbd.c>
#include <var/cpu/cpu_info.h>

extern volatile bool TAB_PREVIOUS_VALUE_SET;
extern volatile char* TAB_PREVIOUS_VALUE;
Expand All @@ -50,6 +52,7 @@ volatile bool exit_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)
Expand All @@ -74,6 +77,7 @@ void loop_terminal()
printk ("%s release %s started at ", VAR_OSNAME, VAR_RELEASE);
start_time = rtc_get_time();
rtc_print_struct(start_time);
//__debug_print_cpu_info();
while(1)
{
start_shell:;
Expand Down Expand Up @@ -116,9 +120,12 @@ void loop_terminal()
scank (true, true, "%s", cmd_active.value + (strlen (cmd_active.value)));
}

if(strcmp(cmd_active.value, "exit")==0)
if(strcmp(cmd_active.value, "exit")==0 || exit_set__shell == true)
//if (exit_set__shell == true)
{
shell_instance_cnt--;
exit_set__shell = false;
strcpy (cmd_active.value, " ");
printk("Exited shell instance #%d\n",shell_instance_cnt+1);
goto end_shell;
}
Expand Down
1 change: 1 addition & 0 deletions include/bin/boneshell/boneshell.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <unistd/unistd.h>

extern struct cmd_t cmd_boneshell;
extern volatile bool exit_shell;

#endif /*_BIN_BONE_SHELL_H_*/

Expand Down
10 changes: 10 additions & 0 deletions platform/pc/drv/ps2/kbd/kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <cpu/interrupts/interrupts.h>
#include <cpu/interrupts/irq.h>
#include <libc/stdio/stdio.h>
#include <boneshell/boneshell.h>
#include <string/string.h>
#include <stdint.h>
#include <stddef.h>
Expand Down Expand Up @@ -196,6 +197,7 @@ void key_handler_util(int key)
printk (" ");
kbd_info.key = KBD_ENTER_PRESS_ID;
key_handler();
kbd_info.key = ' ';
cmds [CMD_CLEAR_INDEX]->handler ("clear");
return;
}
Expand All @@ -204,6 +206,14 @@ void key_handler_util(int key)
key_handler_util_backspace();
return;
}
else if (key == 'd' || key == 'D')
{
cmds [CMD_EXIT_INDEX]->handler ("exit");
kbd_info.key = KBD_ENTER_PRESS_ID;
key_handler();
kbd_info.key = ' ';
return;
}
}

if(isalpha(key)==0)
Expand Down
20 changes: 10 additions & 10 deletions var/cpu/cpu_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
** along with BoneOS. If not, see <http://www.gnu.org/licenses/>.
**
** @main_author : Amanuel Bogale
**
**
** @contributors:
** Amanuel Bogale <amanuel2> : start
**/
**/

#include <cpu/cpuid.h>
#include <var/cpu/cpu_info.h>
#include <misc/status_codes.h>
#include <misc/status_codes.h>
#include <string/string.h>
#include <stdio/stdio.h>

cpu_info_t cpu_info;

static const char* vendor_id_strings[] = {
Expand Down Expand Up @@ -91,7 +91,7 @@ static void signature_proccessing(uint32_t sig)
{
if(strcmp(cpu_info.companyName, "Intel")==0)
{
int bit_twelve = (sig >> 12) & 1;
int bit_twelve = (sig >> 12) & 1;
int bit_thirteen = (sig >> 13) & 1;
if(bit_twelve == 0 && bit_thirteen == 0)
cpu_info.proccecor_type = "Original OEM Proccecor";
Expand All @@ -115,7 +115,7 @@ int init_cpu_info()
find_comp(cpu_info.vendorID);
signature_proccessing(cpu_info.signature);


return STATUS_OK;
}

Expand All @@ -127,8 +127,8 @@ void __debug_print_cpu_info()
#ifdef DEBUG
printk("CPU\n");
printk("---\n");
printk("COMPANY : %s\n", cpu_info.companyName);
printk("COMPANY : %s\n", cpu_info.companyName);
printk("VENDOR_ID : %s\n", cpu_info.vendorID);
printk("PROCCECOR TYPE : %s\n", cpu_info.proccecor_type);
#endif
}
#endif
}

0 comments on commit 43eac59

Please sign in to comment.