1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 15:57:34 +00:00

USB: Store devices in globally accessible array

USB Devices are now stored so that they may be later retrieved and
operated on (i.e, fetching their assigned device address via
ProcFS)
This commit is contained in:
Jesse Buhagiar 2021-06-08 00:08:41 +10:00 committed by Ali Mohammad Pur
parent 0e680cb17a
commit 7b42146f33
4 changed files with 38 additions and 7 deletions

View file

@ -26,6 +26,7 @@ class UHCIController final : public PCI::Device {
public:
static void detect();
static UHCIController& the();
virtual ~UHCIController() override;
virtual const char* purpose() const override { return "UHCI"; }
@ -39,6 +40,9 @@ public:
KResultOr<size_t> submit_control_transfer(Transfer& transfer);
RefPtr<USB::Device> const get_device_at_port(USB::Device::PortNumber);
RefPtr<USB::Device> const get_device_from_address(u8 device_address);
private:
UHCIController(PCI::Address, PCI::ID);
@ -89,6 +93,8 @@ private:
OwnPtr<Region> m_framelist;
OwnPtr<Region> m_qh_pool;
OwnPtr<Region> m_td_pool;
Array<RefPtr<USB::Device>, 2> m_devices; // Devices connected to the root ports (of which there are two)
};
}