| 97 | return 1; |
| 98 | ASSERT_NOT_REACHED(); |
| 99 | } |
| 100 | |
| 101 | bool PS2Controller::append_command_queue(PS2Device* device, uint8_t command, uint8_t response_size) |
| 102 | { |
| 103 | SpinLockGuard _(m_command_lock); |
| 104 | if (m_command_queue.size() + 1 >= m_command_queue.capacity()) |
| 105 | { |
| 106 | dprintln("PS/2 command queue full"); |
| 107 | return false; |
| 108 | } |
| 109 | m_command_queue.push(Command { |
| 110 | .state = Command::State::NotSent, |
| 111 | .device_index = get_device_index(device), |
| 112 | .out_data = { command, 0x00 }, |
| 113 | .out_count = 1, |
| 114 | .in_count = response_size, |
| 115 | .send_index = 0 |
| 116 | }); |
| 117 | return true; |
| 118 | } |
| 119 | |