aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2019-11-10 22:05:44 +0100
committerMarvin Borner2019-11-10 22:05:44 +0100
commit765559cab48a27be66f40f1b081c79fe32bee8c7 (patch)
tree389bdb54407f622de81636b1358617e5ecdbdddb
parent7e06dfe06a0f7847eed105bc4f7ccb22df5228fc (diff)
Fixed some strange bugs and reimplemented mode detection
-rw-r--r--src/kernel/commands/command.c4
-rw-r--r--src/kernel/graphics/vesa.c4
-rw-r--r--src/kernel/input/ps2/keyboard.c3
-rw-r--r--src/kernel/kernel.c3
4 files changed, 9 insertions, 5 deletions
diff --git a/src/kernel/commands/command.c b/src/kernel/commands/command.c
index 1118b29..4ae8836 100644
--- a/src/kernel/commands/command.c
+++ b/src/kernel/commands/command.c
@@ -20,7 +20,7 @@ void exec_command(char *command) {
vesa_draw_string("pong!\n");
else if (starts_with(command, "clear"))
vesa_clear();
- else if (starts_with(command, "shutdown"))
+ else if (starts_with(command, "shutdown") || starts_with(command, "exit"))
acpi_poweroff();
else if (starts_with(command, "zzz"))
vesa_draw_string("Not implemented\n");
@@ -31,6 +31,6 @@ void exec_command(char *command) {
write_time();
else if (starts_with(command, "reboot"))
reboot();
- else
+ else if (command[0] != 0)
vesa_draw_string("Command not found!\n");
}
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c
index 447c447..a43d486 100644
--- a/src/kernel/graphics/vesa.c
+++ b/src/kernel/graphics/vesa.c
@@ -98,7 +98,7 @@ void set_optimal_resolution() {
uint16_t highest = 0;
- /*for (uint16_t *mode = video_modes; *mode != 0xFFFF; mode++) {
+ for (uint16_t *mode = video_modes; *mode != 0xFFFF; mode++) {
struct vbe_mode_info *mode_info = vbe_get_mode_info(*mode);
if (mode_info == 0 || (mode_info->attributes & 0x90) != 0x90 ||
@@ -125,7 +125,7 @@ void set_optimal_resolution() {
vbe_bpl = mode_info->bpp >> 3;
fb = (unsigned char *) mode_info->framebuffer;
}
- }*/
+ }
if (highest == 0) {
serial_write("Mode detection failed!\nTrying common modes...\n");
diff --git a/src/kernel/input/ps2/keyboard.c b/src/kernel/input/ps2/keyboard.c
index e7f789a..2a093e5 100644
--- a/src/kernel/input/ps2/keyboard.c
+++ b/src/kernel/input/ps2/keyboard.c
@@ -2,7 +2,7 @@
#include <kernel/io/io.h>
#include <kernel/graphics/vesa.h>
-int shift_pressed = 0;
+int shift_pressed;
char keymap[128] = {
0 /*E*/, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b',
@@ -101,5 +101,6 @@ void keyboard_rate() {
void keyboard_install() {
keyboard_rate();
irq_install_handler(1, keyboard_handler);
+ shift_pressed = 0;
info("Installed keyboard handler");
}
diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c
index 70f9d60..3bef5c6 100644
--- a/src/kernel/kernel.c
+++ b/src/kernel/kernel.c
@@ -34,6 +34,9 @@ void kernel_main() {
// Get hardware information
get_smbios();
+ // Booting process complete - emulate newline key
+ vesa_keyboard_char('\n');
+
// Setup initial ramdisk
/*assert(mboot_ptr->mods_count > 0);
uint32_t initrd_location = *((uint32_t *) mboot_ptr->mods_addr);