Skip to content

Commit

Permalink
USB: Store device descriptor on enumeration
Browse files Browse the repository at this point in the history
We now store the device descriptor obtained from the device
during enumeration in the device's object in memory instead
of exposing all of the different members contained within it.
  • Loading branch information
Quaker762 authored and alimpfard committed Jun 18, 2021
1 parent 7b42146 commit 71c9572
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Kernel/Devices/USB/USBDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ KResult Device::enumerate()
VERIFY(transfer_length > 0);
m_address = s_next_usb_address++;

memcpy(&m_device_descriptor, &dev_descriptor, sizeof(USBDeviceDescriptor));
return KSuccess;
}

Expand Down
3 changes: 2 additions & 1 deletion Kernel/Devices/USB/USBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class Device : public RefCounted<Device> {

u8 address() const { return m_address; }

private:
const USBDeviceDescriptor& device_descriptor() const { return m_device_descriptor; }

private:
PortNumber m_device_port; // What port is this device attached to
DeviceSpeed m_device_speed; // What speed is this device running at
Expand Down

0 comments on commit 71c9572

Please sign in to comment.