Home | History | Annotate | Download | only in mbim_compliance

Lines Matching defs:Descriptor

66     Metaclass for creating a USB descriptor class.
68 A derived descriptor class takes raw descriptor data as an array of unsigned
70 as instance attributes. A derived class of |Descriptor| should specify the
73 DESCRIPTOR_TYPE: An unsigned 8-bit number specifying the descriptor
77 DESCRIPTOR_SUBTYPE: An unsigned 8-bit number specifying the descriptor
83 in the USB descriptor. Each inner tuple is a field definition and
86 field from the raw descriptor data. The second element specifies the
88 derived descriptor class for storing the field. Each derived descriptor
96 # The Descriptor base class, which inherits from 'object', is merely
98 # raw descriptor data.
107 # USB descriptor data are in the little-endian format.
113 Creates a descriptor instance with the given descriptor data.
115 @param cls: The descriptor class of the instance to be created.
116 @param data: The raw descriptor data as an array of unsigned bytes.
117 @returns The descriptor instance.
124 'Expected %d or more bytes of descriptor data, got %d' %
135 'Expected descriptor type 0x%02X, got 0x%02X' %
142 'Expected descriptor subtype 0x%02X, got 0x%02X' %
147 'Expected descriptor length %d, got %d' %
151 # |data_length| > |unpack_length|, which happens if the descriptor
164 # As Descriptor.__subclasses__() only reports its direct subclasses,
165 # we keep track of all subclasses of Descriptor using the
171 class Descriptor(object):
173 USB Descriptor base class.
181 class UnknownDescriptor(Descriptor):
183 Unknown USB Descriptor.
185 This class is a catch-all descriptor for unsupported or unknown descriptor
192 class DeviceDescriptor(Descriptor):
193 """ Device Descriptor. """
211 class ConfigurationDescriptor(Descriptor):
212 """ Configuration Descriptor. """
224 class InterfaceDescriptor(Descriptor):
225 """ Interface Descriptor. """
238 class EndpointDescriptor(Descriptor):
239 """ Endpoint Descriptor. """
249 class InterfaceAssociationDescriptor(Descriptor):
250 """ Interface Asscociation Descriptor. """
262 class FunctionalDescriptor(Descriptor):
263 """ Functional Descriptor. """
271 """ Header Functional Descriptor. """
280 """ Union Functional Descriptor. """
290 """ MBIM Functional Descriptor. """
304 """ MBIM Extended Functional Descriptor. """
314 class SuperSpeedEndpointCompanionDescriptor(Descriptor):
315 """ SuperSpeed Endpoint Companion Descriptor. """
326 A class for extracting USB descriptors from raw descriptor data.
328 This class takes raw descriptor data as an array of unsigned bytes via its
330 descriptors via instances derived from a subclass of Descriptor.
343 # The position of each descriptor in the list.
351 Returns the next descriptor found in the descriptor data.
353 @returns An instance of a subclass of Descriptor.
354 @raises StopIteration if no more descriptor is found,
360 # Identify the descriptor class based on bDescriptorType, and if
361 # available, bDescriptorSubtype. The descriptor data has a standard
379 descriptor = descriptor_class(self._data[self._index:next_index])
381 descriptor.index = self._descriptor_index
383 return descriptor
390 @param descriptor_type: The target descriptor type.
392 Type: Array of |Descriptor| objects.
398 return filter(lambda descriptor: isinstance(descriptor, descriptor_type),
407 Type: Array of |Descriptor| objects.
408 @returns True if distinct descriptor are found, False otherwise.
411 return not all(descriptor == descriptors[0] for descriptor in descriptors)
414 def get_descriptor_bundle(descriptors, descriptor):
416 Get the bundle for the |descriptor|. For example, if |descriptor| is of
421 Type: Array of |Descriptor| objects.
422 @param descriptor: The starting point of the bundle.
423 @returns The bundle for |descriptor|.
426 index = descriptor.index + 1
428 type(descriptor) != type(descriptors[index])):
430 return descriptors[descriptor.index: index]
438 Type: Array of |Descriptor| objects.
446 Match fields for a given interface descriptor.
448 The descriptor is matched based on the fields provided in
451 @param interface: An interface descriptor.
452 Type: |Descriptor| object.
462 return filter(lambda descriptor: _match_all_fields(descriptor),
471 Type: Array of |Descriptor| objects.