facedancer.endpoint module
Functionality for describing USB endpoints.
- class facedancer.endpoint.USBEndpoint(*, number: int, direction: ~facedancer.types.USBDirection, transfer_type: ~facedancer.types.USBTransferType = USBTransferType.BULK, synchronization_type: ~facedancer.types.USBSynchronizationType = USBSynchronizationType.NONE, usage_type: ~facedancer.types.USBUsageType = USBUsageType.DATA, max_packet_size: int = 64, interval: int = 0, extra_bytes: bytes = b'', attached_descriptors: ~typing.List[~facedancer.descriptor.USBDescriptor] = <factory>, requestable_descriptors: ~typing.Dict[tuple[int, int], ~facedancer.descriptor.USBDescriptor] = <factory>, parent: ~facedancer.descriptor.USBDescribable = None)[source]
Bases:
USBDescribable,AutoInstantiable,USBRequestHandlerClass representing a USBEndpoint object.
- Field:
- number:
The endpoint number (without the direction bit) for this endpoint.
- direction:
A USBDirection constant indicating this endpoint’s direction.
- transfer_type:
A USBTransferType constant indicating the type of communications used.
- max_packet_size:
The maximum packet size for this endpoint.
- interval:
The polling interval, for an INTERRUPT endpoint.
- DESCRIPTOR_TYPE_NUMBER = 5
- add_descriptor(descriptor: USBDescriptor)[source]
Adds the provided descriptor to the endpoint.
- property address
Fetches the address for the given endpoint.
- static address_for_number(endpoint_number: int, direction: USBDirection) int[source]
Computes the endpoint address for a given number + direction.
- attached_descriptors: List[USBDescriptor]
- property attributes
Fetches the attributes for the given endpoint, as a single byte.
- direction: USBDirection
- extra_bytes: bytes = b''
- classmethod from_binary_descriptor(data, strings={})[source]
Creates an endpoint object from a description of that endpoint.
- get_identifier() int[source]
Returns a unique integer identifier for this object.
This is usually the index or address of the relevant USB object.
- handle_clear_feature_request = <ControlRequestHandler wrapping USBEndpoint.handle_clear_feature_request at 0x7f80aa9ac560
- handle_data_received(data: bytes)[source]
Handler for receipt of non-control request data.
- Parameters:
data – The raw bytes received.
- interval: int = 0
- max_packet_size: int = 64
- number: int
- parent: USBDescribable = None
- requestable_descriptors: Dict[tuple[int, int], USBDescriptor]
- send(data: bytes, *, blocking: bool = False)[source]
Sends data on this endpoint. Valid only for IN endpoints.
- Parameters:
data – The data to be sent.
blocking – True if we should block until the backend reports the transmission to be complete.
- synchronization_type: USBSynchronizationType = 0
- transfer_type: USBTransferType = 2
- usage_type: USBUsageType = 0