ingnore invalid scancodes

This commit is contained in:
Eggert Jung
2025-04-28 01:49:09 +02:00
parent bccd23c0c6
commit 2c60b88849
4 changed files with 10 additions and 8 deletions

View File

@@ -112,15 +112,15 @@ bool fetch(Key &pressed) {
uint8_t status_reg = ctrl_port.inb();
if(status_reg & IS_MOUSE || !(status_reg & HAS_OUTPUT) )
return false; // TODO Remove mouse events from buffer
DBG_VERBOSE << "status: " << hex << static_cast<int>(status_reg) << "\n" << flush;
uint8_t out_buffer = data_port.inb();
DBG_VERBOSE << "scancode: " << hex << static_cast<int>(out_buffer) << "\n" << flush;
pressed = key_decoder.decode(out_buffer);
if (pressed.alt() || pressed.ctrl() || pressed.shift) {
if (pressed.alt() || pressed.ctrl() || pressed.shift || !pressed.valid())
return false;
}
else
return true;
}