summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Buhagiar <jooster669@gmail.com>2021-06-08 22:31:32 +1000
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-18 17:04:57 +0430
commit71c9572e744a8d11b03347d97558cb8f57eb1e69 (patch)
tree15d1f2732ffcf50586b4cd668b3028fb31e4e142
parent7b42146f332a9d68ca1a56f73771b29a550be66a (diff)
downloadserenity-71c9572e744a8d11b03347d97558cb8f57eb1e69.zip
USB: Store device descriptor on enumeration
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.
-rw-r--r--Kernel/Devices/USB/USBDevice.cpp1
-rw-r--r--Kernel/Devices/USB/USBDevice.h3
2 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Devices/USB/USBDevice.cpp b/Kernel/Devices/USB/USBDevice.cpp
index fcb5773a81..53fce1a49e 100644
--- a/Kernel/Devices/USB/USBDevice.cpp
+++ b/Kernel/Devices/USB/USBDevice.cpp
@@ -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;
}
diff --git a/Kernel/Devices/USB/USBDevice.h b/Kernel/Devices/USB/USBDevice.h
index bcf95a4dcb..d884e13b3d 100644
--- a/Kernel/Devices/USB/USBDevice.h
+++ b/Kernel/Devices/USB/USBDevice.h
@@ -42,7 +42,8 @@ public:
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