1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

Kernel/Devices/HID: Propagate errors of HIDDevices properly

Some error indication was done by returning bool. This was changed to
propagate the error by ErrorOr from the underlying functions. The
returntype of the underlying functions was also changed to propagate the
error.
This commit is contained in:
Lorenz Steinert 2022-02-23 22:09:39 +01:00 committed by Andreas Kling
parent 83e96569ed
commit d3ce97e8b2
8 changed files with 103 additions and 110 deletions

View file

@ -20,8 +20,8 @@ class PS2MouseDevice : public IRQHandler
friend class DeviceManagement;
public:
static RefPtr<PS2MouseDevice> try_to_initialize(const I8042Controller&);
bool initialize();
static ErrorOr<NonnullRefPtr<PS2MouseDevice>> try_to_initialize(const I8042Controller&);
ErrorOr<void> initialize();
virtual ~PS2MouseDevice() override;
@ -47,12 +47,12 @@ protected:
};
};
u8 read_from_device();
u8 send_command(u8 command);
u8 send_command(u8 command, u8 data);
ErrorOr<u8> read_from_device();
ErrorOr<u8> send_command(u8 command);
ErrorOr<u8> send_command(u8 command, u8 data);
MousePacket parse_data_packet(const RawPacket&);
void set_sample_rate(u8);
u8 get_device_id();
ErrorOr<void> set_sample_rate(u8);
ErrorOr<u8> get_device_id();
u8 m_data_state { 0 };
RawPacket m_data;