Kernel: PS/2 device automatically sends commands when appended
This commit is contained in:
parent
891ced4da2
commit
c2957d8761
|
@ -21,7 +21,7 @@ namespace Kernel::Input
|
|||
virtual BAN::StringView name() const final override { return m_name; }
|
||||
virtual dev_t rdev() const final override { return m_rdev; }
|
||||
|
||||
protected:
|
||||
private:
|
||||
void update();
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,17 +18,25 @@ namespace Kernel::Input
|
|||
bool PS2Device::append_command_queue(uint8_t command)
|
||||
{
|
||||
if (m_command_queue.size() + 1 >= m_command_queue.capacity())
|
||||
{
|
||||
dprintln("PS/2 command queue full");
|
||||
return false;
|
||||
}
|
||||
m_command_queue.push(command);
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PS2Device::append_command_queue(uint8_t command, uint8_t data)
|
||||
{
|
||||
if (m_command_queue.size() + 2 >= m_command_queue.capacity())
|
||||
{
|
||||
dprintln("PS/2 command queue full");
|
||||
return false;
|
||||
}
|
||||
m_command_queue.push(command);
|
||||
m_command_queue.push(data);
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <kernel/FS/DevFS/FileSystem.h>
|
||||
#include <kernel/Input/PS2Config.h>
|
||||
#include <kernel/Input/PS2Keyboard.h>
|
||||
#include <kernel/Timer/Timer.h>
|
||||
|
||||
#define SET_MASK(byte, mask, on_off) ((on_off) ? ((byte) | (mask)) : ((byte) & ~(mask)))
|
||||
#define TOGGLE_MASK(byte, mask) ((byte) ^ (mask))
|
||||
|
@ -28,7 +27,6 @@ namespace Kernel::Input
|
|||
append_command_queue(Command::SET_LEDS, 0x00);
|
||||
append_command_queue(Command::SCANCODE, PS2::KBScancode::SET_SCANCODE_SET2);
|
||||
append_command_queue(Command::ENABLE_SCANNING);
|
||||
update();
|
||||
}
|
||||
|
||||
void PS2Keyboard::handle_device_command_response(uint8_t byte)
|
||||
|
@ -130,12 +128,6 @@ namespace Kernel::Input
|
|||
event.modifier = m_modifiers | (released ? (uint8_t)Input::KeyEvent::Modifier::Released : 0);
|
||||
event.key = key;
|
||||
|
||||
if (event.pressed() && event.key == Input::Key::F11)
|
||||
{
|
||||
auto time = SystemTimer::get().time_since_boot();
|
||||
dprintln("{}.{9} s", time.tv_sec, time.tv_nsec);
|
||||
}
|
||||
|
||||
if (m_event_queue.full())
|
||||
{
|
||||
dwarnln("PS/2 event queue full");
|
||||
|
|
Loading…
Reference in New Issue