facedancer.backends.MAXUSBApp module
- class facedancer.backends.MAXUSBApp.MAXUSBApp(device, verbose=0)[source]
Bases:
FacedancerApp,FacedancerBackend- app_name = 'MAXUSB'
- configured(configuration)[source]
Callback that’s issued when a USBDevice is configured, e.g. by the SET_CONFIGURATION request. Allows us to apply the new configuration.
- Parameters:
configuration – The configuration applied by the SET_CONFIG request.
- connect(usb_device, max_packet_size_ep0=64, device_speed=None)[source]
Prepares backend to connect to the target host and emulate a given device.
- Parameters:
usb_device – The USBDevice object that represents the emulated device.
max_packet_size_ep0 – Max packet size for control endpoint.
device_speed – Requested usb speed for the Facedancer board.
- ep0_in_nak = 32
- ep2_in_nak = 64
- ep3_in_nak = 128
- full_duplex = 16
- interrupt_level = 8
- is_in0_buffer_avail = 1
- is_in2_buffer_avail = 8
- is_in3_buffer_avail = 16
- is_out0_data_avail = 2
- is_out1_data_avail = 4
- is_setup_data_avail = 32
- read_from_endpoint(ep_num)[source]
Reads a block of data from the given endpoint.
- Parameters:
endpoint_number – The number of the OUT endpoint on which data is to be rx’d.
- reg_clr_togs = 10
- reg_cpu_control = 16
- reg_endpoint_interrupt_enable = 12
- reg_endpoint_irq = 11
- reg_ep0_byte_count = 5
- reg_ep0_fifo = 0
- reg_ep1_out_byte_count = 6
- reg_ep1_out_fifo = 1
- reg_ep2_in_byte_count = 7
- reg_ep2_in_fifo = 2
- reg_ep3_in_byte_count = 8
- reg_ep3_in_fifo = 3
- reg_ep_stalls = 9
- reg_function_address = 19
- reg_io_pins = 20
- reg_pin_control = 17
- reg_revision = 18
- reg_setup_data_fifo = 4
- reg_usb_control = 15
- reg_usb_interrupt_enable = 14
- reg_usb_irq = 13
- send_on_endpoint(ep_num, data, blocking=False)[source]
Sends a collection of USB data on a given endpoint.
- Parameters:
endpoint_number – The number of the IN endpoint on which data should be sent.
data – The data to be sent.
blocking – If true, this function should wait for the transfer to complete.
- service_irqs()[source]
Core routine of the Facedancer execution/event loop. Continuously monitors the Facedancer’s execution status, and reacts as events occur.
- set_address(address, defer=False)[source]
Sets the device address of the Facedancer. Usually only used during initial configuration.
- Parameters:
address – The address that the Facedancer should assume.
- stall_endpoint(ep_number, direction=0)[source]
Stalls an arbitrary endpoint.
- Parameters:
ep_number – The endpoint number to be stalled
direction – 0 for out, 1 for in
- usb_control_connect = 8
- usb_control_vbgate = 64