pub struct FidoTransfer {
pub buffer: TransferBuffer,
status: TransferStatus,
pub actual_length: usize,
pub endpoint: u8,
submission_time: Instant,
pub callback: Option<Box<dyn Fn(FidoTransfer) + Send + Sync>>,
}Expand description
Implementation of a generic USB transfer for the FIDO backend. It implements common USB transfer functionality since it cannot rely on the transfer structures provided by the usb_utils crate as the FIDO backend does not use usbdevfs to communicate with the host.
Fields§
§buffer: TransferBufferTransferBuffer structure with either a request or response data from the guest/host.
status: TransferStatusStatus of the transfer, used by the xhci layer for a successful completion.
actual_length: usizeActual length of the transfer, as per USB specs.
endpoint: u8USB endpoint associated with this transfer.
submission_time: InstantTimestamp of the transfer submission time.
callback: Option<Box<dyn Fn(FidoTransfer) + Send + Sync>>Callback to be executed once the transfer has completed, to signal the xhci layer.
Implementations§
Source§impl FidoTransfer
impl FidoTransfer
pub fn new(endpoint: u8, buffer: TransferBuffer) -> FidoTransfer
Sourcepub fn signal_device_lost(&mut self)
pub fn signal_device_lost(&mut self)
Called when the device is lost and we need to signal to the xhci layer that the transfer cannot continue and the device should be detached.
Sourcepub fn timeout_expired(&self) -> bool
pub fn timeout_expired(&self) -> bool
Checks if the current transfer should time out or not
Sourcepub fn complete_transfer(self)
pub fn complete_transfer(self)
Finalizes the transfer by setting the right status and then calling the callback to signal the xhci layer.
Trait Implementations§
Source§impl BackendTransfer for FidoTransfer
impl BackendTransfer for FidoTransfer
Source§fn status(&self) -> TransferStatus
fn status(&self) -> TransferStatus
TransferStatus enumSource§fn actual_length(&self) -> usize
fn actual_length(&self) -> usize
Source§fn buffer(&self) -> &TransferBuffer
fn buffer(&self) -> &TransferBuffer
TransferBuffer object.