-
Notifications
You must be signed in to change notification settings - Fork 103
Host Architecture
A abstract host proxy class defines the interface detail below. Implementations of this class are used to communicate with a host, either physical or virtual over various mediums.
-
int connect(): tells the proxy to connect to the host
- return: 0 on success, nonzero on error (implementation dependent)
-
void disconnect(): tells the proxy to disconnect from the host
-
void reset(): tells the proxy to reset the host (disconnect/reconnect)
-
bool is_connected(): checks if host is connected, will be called frequently to check for disconnects
-
int control_request(const usb_ctrlrequest* request, int nbytes, __u8* dataptr): used to poll for a incoming setup request
- request: the actual request header
- nbytes: used to return the actual bytes returned for an in (to host) transaction, or the bytes sent for an out (to device) transaction
- dataptr: returns a buffer for extra data coming in, or to place returned data, the caller is responsible for freeing this buffer
- return: 0 on success, nonzero on error (implementation dependent)
-
void send_data(__u8 endpoint,__u8* dataptr,int length): sends data to host on a non zero EP
- endpoint: endpoint to transmit to
- dataptr: data to send
- length: size of data
-
void receive_data(__u8 endpoint,__u8** dataptr, int* length): receives data from host on a non zero EP
- endpoint: endpoint to transmit to
- dataptr: data received, caller must free
- length: size of data
-
char* toString(): returns a description of the host
- physical device via libusb
- tcp/ip interface
- device emulated by BBB
- facedancer emulation (i think the simplest way to handle this at a reasonable level of abstraction, is to write a interface that matches the MAXUSBApp class in the facedancer code, this could run either directly on the BBB or talk to the TCP/IP interface above)
- using gadgetfs
- tcp/ip interface
- host emulated by BBB