mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:58:12 +00:00
Kernel: Introduce a new super class called HIDController
Use the new class in HID code, because all other HID device controllers will be using this class as their parent class. Hence, we no longer keep a reference to any PS/2 device in HIDManagement and rely on HIDController derived classes to do this for us. It also means that we removed another instance of a LockRefPtr, which is designated to be removed and is replaced by the better pattern of SpinlockProtected<RefPtr<>> instead.
This commit is contained in:
parent
6c4a47d916
commit
d76c08c9b0
5 changed files with 39 additions and 25 deletions
|
@ -152,13 +152,11 @@ UNMAP_AFTER_INIT ErrorOr<void> HIDManagement::enumerate()
|
|||
// Note: If we happen to not have i8042 just return "gracefully" for now.
|
||||
if (!has_i8042_controller)
|
||||
return {};
|
||||
m_i8042_controller = i8042_controller;
|
||||
TRY(m_i8042_controller->detect_devices());
|
||||
if (m_i8042_controller->mouse())
|
||||
m_hid_devices.append(m_i8042_controller->mouse().release_nonnull());
|
||||
|
||||
if (m_i8042_controller->keyboard())
|
||||
m_hid_devices.append(m_i8042_controller->keyboard().release_nonnull());
|
||||
if (auto result_or_error = i8042_controller->detect_devices(); result_or_error.is_error())
|
||||
return {};
|
||||
m_hid_controllers.with([&](auto& list) {
|
||||
list.append(i8042_controller);
|
||||
});
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue