diff --git a/device/ps2controller.cc b/device/ps2controller.cc index 7d9edb2..a2d541f 100644 --- a/device/ps2controller.cc +++ b/device/ps2controller.cc @@ -110,7 +110,7 @@ void init() { bool fetch(Key &pressed) { uint8_t status_reg = ctrl_port.inb(); if(!(status_reg & HAS_OUTPUT) ) - return false; // TODO Remove mouse events from buffer + return false; DBG_VERBOSE << "status: " << hex << static_cast(status_reg) << "\n" << flush; uint8_t out_buffer = data_port.inb(); @@ -142,6 +142,8 @@ void setLed(enum LED led, bool on) { sendData(leds); // Parameter } -void drainBuffer() {} - +void drainBuffer() { + while(ctrl_port.inb() & HAS_OUTPUT) + data_port.inb(); +} } // namespace PS2Controller diff --git a/device/ps2controller.h b/device/ps2controller.h index 62a19f6..f3d292d 100644 --- a/device/ps2controller.h +++ b/device/ps2controller.h @@ -146,7 +146,6 @@ void setLed(enum LED led, bool on); * should be emptied once right before allowing keyboard interrupts * (even if keystrokes might be lost). * - * \todo(12) Implement method */ void drainBuffer();