|
|
|
|
@ -108,18 +108,20 @@ void init() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool fetch(Key &pressed) {
|
|
|
|
|
// TODO: You have to implement this method
|
|
|
|
|
uint8_t status_reg = ctrl_port.inb();
|
|
|
|
|
if(status_reg & IS_MOUSE || !(status_reg & HAS_OUTPUT) )
|
|
|
|
|
if(!(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;
|
|
|
|
|
|
|
|
|
|
if (status_reg & IS_MOUSE)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
pressed = key_decoder.decode(out_buffer);
|
|
|
|
|
|
|
|
|
|
if (pressed.alt() || pressed.ctrl() || pressed.shift || !pressed.valid())
|
|
|
|
|
if (pressed.alt() || pressed.ctrl() || !pressed.valid())
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
return true;
|
|
|
|
|
|