mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-18 17:12:54 +00:00
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.
32 lines
1,009 B
C++
32 lines
1,009 B
C++
/*
|
|
* 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)
|
|
};
|
|
|
|
}
|