mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 17:25:07 +00:00

We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
39 lines
865 B
C++
39 lines
865 B
C++
/*
|
|
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Error.h>
|
|
#include <AK/NonnullOwnPtr.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <Kernel/Bus/USB/USBHub.h>
|
|
#include <Kernel/Bus/USB/USBTransfer.h>
|
|
|
|
namespace Kernel::USB {
|
|
|
|
class UHCIController;
|
|
|
|
class UHCIRootHub {
|
|
public:
|
|
static ErrorOr<NonnullOwnPtr<UHCIRootHub>> try_create(NonnullRefPtr<UHCIController>);
|
|
|
|
UHCIRootHub(NonnullRefPtr<UHCIController>);
|
|
~UHCIRootHub() = default;
|
|
|
|
ErrorOr<void> setup(Badge<UHCIController>);
|
|
|
|
u8 device_address() const { return m_hub->address(); }
|
|
|
|
ErrorOr<size_t> handle_control_transfer(Transfer& transfer);
|
|
|
|
void check_for_port_updates() { m_hub->check_for_port_updates(); }
|
|
|
|
private:
|
|
NonnullRefPtr<UHCIController> m_uhci_controller;
|
|
RefPtr<Hub> m_hub;
|
|
};
|
|
|
|
}
|