pub(crate) struct UsbConnection {
pub(crate) vsock_service: Arc<VsockService<Vec<u8>>>,
pub(crate) usb_socket_reader: ReadHalf<Socket>,
pub(crate) usb_socket_writer: WriteHalf<Socket>,
pub(crate) connection_tx: Sender<ConnectionRequest>,
}
Expand description
Processes a connection to the underlying USB device through a datagram socket where each packet received or sent corresponds to a USB bulk transfer buffer. It will call the callback with a new link and close the old one whenever a magic reset packet is received from the host.
Fields§
§vsock_service: Arc<VsockService<Vec<u8>>>
§usb_socket_reader: ReadHalf<Socket>
§usb_socket_writer: WriteHalf<Socket>
§connection_tx: Sender<ConnectionRequest>
Implementations§
Source§impl UsbConnection
impl UsbConnection
pub(crate) fn new( vsock_service: Arc<VsockService<Vec<u8>>>, usb_socket: Socket, connection_tx: Sender<ConnectionRequest>, ) -> Self
pub(crate) async fn clear_host_requests( &mut self, found_magic: &[u8], ) -> Option<()>
Sourcepub(crate) async fn next_socket(
&mut self,
found_magic: Option<Vec<u8>>,
) -> Option<u32>
pub(crate) async fn next_socket( &mut self, found_magic: Option<Vec<u8>>, ) -> Option<u32>
Waits for an PacketType::Sync
packet and sends the reply back, and then returns the
negotiated device CID for the connection.
pub(crate) async fn run(self, synchronized: Option<Sender<()>>)
Auto Trait Implementations§
impl Freeze for UsbConnection
impl !RefUnwindSafe for UsbConnection
impl Send for UsbConnection
impl Sync for UsbConnection
impl Unpin for UsbConnection
impl !UnwindSafe for UsbConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more