Kernel: TTY now reads input byte by byte

This allows correct behaviour for character streams / keyboard
handling. Serial input can now send working ^C :D
This commit is contained in:
2023-09-07 15:06:27 +03:00
parent 5e1725abb2
commit b30af0edca
3 changed files with 55 additions and 82 deletions

View File

@@ -244,12 +244,13 @@ namespace Kernel
if (m_serial.port() != COM1_PORT && m_serial.port() != COM2_PORT)
return;
static uint8_t buffer[128];
auto update_com =
[&](auto& device, auto& input_queue)
{
if (input_queue.empty())
return;
uint8_t buffer[128];
uint8_t* ptr = buffer;
while (!input_queue.empty())
{
@@ -262,7 +263,10 @@ namespace Kernel
ptr++;
}
*ptr = '\0';
device->handle_input(buffer);
ptr = buffer;
while (*ptr)
device->handle_input_byte(*ptr++);
};
CriticalScope _;