Kernel/USB: Add the USB 1.x/2.0 hub descriptor

There is a different hub descriptor for USB 3.0, but this isn't
included here.
This commit is contained in:
Luke 2021-08-10 02:14:36 +01:00 committed by Andreas Kling
parent 14da080dcf
commit 9dcd146ab4
Notes: sideshowbarker 2024-07-18 05:43:53 +09:00

View File

@ -94,11 +94,25 @@ struct [[gnu::packed]] USBEndpointDescriptor {
u8 poll_interval_in_frames;
};
//
// USB 1.1/2.0 Hub Descriptor
// ==============
//
struct [[gnu::packed]] USBHubDescriptor {
USBDescriptorCommon descriptor_header;
u8 number_of_downstream_ports;
u16 hub_characteristics;
u8 power_on_to_power_good_time;
u8 hub_controller_current;
// NOTE: This does not contain DeviceRemovable or PortPwrCtrlMask because a struct cannot have two VLAs in a row.
};
static constexpr u8 DESCRIPTOR_TYPE_DEVICE = 0x01;
static constexpr u8 DESCRIPTOR_TYPE_CONFIGURATION = 0x02;
static constexpr u8 DESCRIPTOR_TYPE_STRING = 0x03;
static constexpr u8 DESCRIPTOR_TYPE_INTERFACE = 0x04;
static constexpr u8 DESCRIPTOR_TYPE_ENDPOINT = 0x05;
static constexpr u8 DESCRIPTOR_TYPE_DEVICE_QUALIFIER = 0x06;
static constexpr u8 DESCRIPTOR_TYPE_HUB = 0x29;
}