-
Notifications
You must be signed in to change notification settings - Fork 103
Device Architecture
A abstract device proxy class defines the interface detail below. Implementations of this class are used to communicate with a device, either physical or virtual over various mediums.
-
int connect(): tells the proxy to connect to the device
- return: 0 on success, nonzero on error (implementation dependent)
-
void disconnect(): tells the proxy to disconnect from the device
-
void reset(): tells the proxy to reset the device
-
bool is_connected(): tests if device is still connected, will be called frequently to detect disconnects
-
int control_request(const usb_ctrlrequest* request, int nbytes, __u8 dataptr): for setup requests, here the data could be in or out depending on the request
- request: the actual request header
- nbytes: used to return the actual bytes returned for an OUT (to host) transaction
- dataptr: buffer for extra data coming in, or to place returned data
- return: 0 on success, nonzero on error (implementation dependent)
-
void send_data(__u8 endpoint,__u8* dataptr,int length): sends data to device 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 device on a non zero EP
- endpoint: endpoint to transmit to
- dataptr: data received, caller must free
- length: size of data
-
__u8 get_address(): get address of device
-
char* toString(): returns a description of the device
- 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)