summaryrefslogtreecommitdiff
path: root/Kernel/Bus/USB/USBInterface.h
diff options
context:
space:
mode:
authorJesse Buhagiar <jooster669@gmail.com>2022-04-15 01:11:15 +1000
committerAndreas Kling <kling@serenityos.org>2022-04-22 15:16:56 +0200
commit300dcb6f5e2c548fa3339947ff531d3fa17cbd38 (patch)
tree7143a12f2c1b9c71075dc78ce1f57021d3200748 /Kernel/Bus/USB/USBInterface.h
parentd313fa98ecd2ebd68c8c50bd803105de1517fcff (diff)
downloadserenity-300dcb6f5e2c548fa3339947ff531d3fa17cbd38.zip
Kernel/USB: Get all interface descriptors on enumeration
This creates all interfaces when the device is enumerated, with a link to the configuration that it is a part of. As such, a new class, `USBInterface` has been introduced to express this state.
Diffstat (limited to 'Kernel/Bus/USB/USBInterface.h')
-rw-r--r--Kernel/Bus/USB/USBInterface.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/Kernel/Bus/USB/USBInterface.h b/Kernel/Bus/USB/USBInterface.h
new file mode 100644
index 0000000000..d0131464cd
--- /dev/null
+++ b/Kernel/Bus/USB/USBInterface.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2022, Jesse Buhagiar <jesse.buhagiar@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Vector.h>
+
+namespace Kernel::USB {
+
+class USBConfiguration;
+
+class USBInterface final {
+public:
+ USBInterface() = delete;
+ USBInterface(USBConfiguration const& configuration, USBInterfaceDescriptor const descriptor, Vector<USBEndpointDescriptor> const& endpoint_descriptors)
+ : m_configuration(configuration)
+ , m_descriptor(descriptor)
+ , m_endpoint_descriptors(endpoint_descriptors)
+ {
+ m_endpoint_descriptors.ensure_capacity(descriptor.number_of_endpoints);
+ }
+
+private:
+ USBConfiguration const& m_configuration; // Configuration that this interface belongs to
+ USBInterfaceDescriptor const m_descriptor; // Descriptor backing this interface
+ Vector<USBEndpointDescriptor> m_endpoint_descriptors; // Endpoint descriptors for this interface (that we can use to open an endpoint)
+};
+
+}