mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +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:
parent
0e680cb17a
commit
7b42146f33
4 changed files with 38 additions and 7 deletions
|
@ -17,7 +17,7 @@ namespace Kernel::USB {
|
|||
// glues together:
|
||||
//
|
||||
// https://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_113_Simplified%20Description%20of%20USB%20Device%20Enumeration.pdf
|
||||
class Device {
|
||||
class Device : public RefCounted<Device> {
|
||||
public:
|
||||
enum class PortNumber : u8 {
|
||||
Port1 = 0,
|
||||
|
@ -30,8 +30,7 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
static KResultOr<NonnullOwnPtr<Device>> try_create(PortNumber, DeviceSpeed);
|
||||
static Device* get(PortNumber);
|
||||
static KResultOr<NonnullRefPtr<Device>> try_create(PortNumber, DeviceSpeed);
|
||||
|
||||
Device(PortNumber, DeviceSpeed, NonnullOwnPtr<Pipe> default_pipe);
|
||||
~Device();
|
||||
|
@ -50,8 +49,9 @@ private:
|
|||
u8 m_address { 0 }; // USB address assigned to this device
|
||||
|
||||
// Device description
|
||||
u16 m_vendor_id { 0 }; // This device's vendor ID assigned by the USB group
|
||||
u16 m_product_id { 0 }; // This device's product ID assigned by the USB group
|
||||
u16 m_vendor_id { 0 }; // This device's vendor ID assigned by the USB group
|
||||
u16 m_product_id { 0 }; // This device's product ID assigned by the USB group
|
||||
USBDeviceDescriptor m_device_descriptor; // Device Descriptor obtained from USB Device
|
||||
|
||||
NonnullOwnPtr<Pipe> m_default_pipe; // Default communication pipe (endpoint0) used during enumeration
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue