class Interface
Defined at line 358 of file ../../src/devices/usb/lib/usb/include/usb/usb.h
Interface is accessed by iterating on InterfaceList. It contains a pointer to an interface
descriptor. The returned descriptor pointer is valid for the lifetime of the InterfaceList used
to create the Interface.
If the interface is part of an interface association, it contains an assoc_ member that points to
the association descriptor, from which you can find the start of the association. While iterating
through interfaces, if an Interface has the assoc_ member, you may start keeping track of members
in the association. The assoc_.assoc_desc refers to the association that it is part of. When
assoc_.assoc_desc changes, a new association has started. If assoc_ disappears, the interface is
not part of the association anymore.
Example Usage of association():
std::optional
<InterfaceList
> interfaces;
status = InterfaceList::Create(my_client, true,
&interfaces
);
if (status != ZX_OK) {
...
}
usb_interface_assoc_descriptor_t* prev_assoc = nullptr;
for (const auto
&
interface : *interfaces) {
if (interface.association()) {
if (prev_assoc != interface.association()->assoc_desc) {
// A new association is found!
prev_assoc = interface.association()->assoc_desc;
}
// I am an interface part of prev_assoc
...
continue;
}
prev_assoc = nullptr;
// I am an interface not associated with an associations.
...
}
Public Methods
DescriptorList GetDescriptorList ()
Defined at line 114 of file ../../src/devices/usb/lib/usb/usb-wrapper.cc
EndpointList GetEndpointList ()
Defined at line 112 of file ../../src/devices/usb/lib/usb/usb-wrapper.cc
const usb_interface_descriptor_t * descriptor ()
Defined at line 365 of file ../../src/devices/usb/lib/usb/include/usb/usb.h
const usb_interface_assoc_descriptor_t * association ()
Defined at line 366 of file ../../src/devices/usb/lib/usb/include/usb/usb.h
size_t length (bool skip_alt)
Returns length of Interface Descriptor including Association Descriptor before it.
Defined at line 370 of file ../../src/devices/usb/lib/usb/include/usb/usb.h
Friends
class UnownedInterfaceList