Struct devices::usb::backend::fido_backend::fido_device::FidoDevice     
source · pub struct FidoDevice {
    pub guest_key: Arc<Mutex<FidoGuestKey>>,
    pub transaction_manager: Arc<Mutex<TransactionManager>>,
    pub is_active: bool,
    pub is_device_lost: bool,
    event_loop: Arc<EventLoop>,
    pub transfer_timer: PollTimer,
    pub fd: Arc<Mutex<File>>,
}Expand description
A virtual representation of a FidoDevice emulated on the Host.
Fields§
§guest_key: Arc<Mutex<FidoGuestKey>>Guest representation of the virtual security key device
transaction_manager: Arc<Mutex<TransactionManager>>The TransactionManager which handles starting and stopping u2f transactions
is_active: boolMarks whether the current device is active in a transaction. If it is not active, the fd polling event loop does not handle the device fd monitoring.
is_device_lost: boolMarks whether the device has been lost. In case the FD stops being responsive we signal that the device is lost and any further transaction will return a failure.
event_loop: Arc<EventLoop>Backend provider event loop to attach/detach the monitored fd.
transfer_timer: PollTimerTimer to poll for active USB transfers
fd: Arc<Mutex<File>>fd of the actual hidraw device
Implementations§
source§impl FidoDevice
 
impl FidoDevice
pub fn new(hidraw: File, event_loop: Arc<EventLoop>) -> Result<FidoDevice>
sourcepub fn set_active(&mut self, active: bool)
 
pub fn set_active(&mut self, active: bool)
Sets the device active state. If the device becomes active, it toggles polling on the file descriptor for the host hid device. If the devices becomes inactive, it stops polling. In case of error, it’s not possible to recover so we just log the warning and continue.
sourcepub fn start_transaction(&mut self, packet: &InitPacket) -> Result<()>
 
pub fn start_transaction(&mut self, packet: &InitPacket) -> Result<()>
Starts a new transaction from a given init packet.
Trait Implementations§
source§impl AsRawDescriptor for FidoDevice
 
impl AsRawDescriptor for FidoDevice
source§fn as_raw_descriptor(&self) -> RawDescriptor
 
fn as_raw_descriptor(&self) -> RawDescriptor
Auto Trait Implementations§
impl Freeze for FidoDevice
impl !RefUnwindSafe for FidoDevice
impl Send for FidoDevice
impl Sync for FidoDevice
impl Unpin for FidoDevice
impl !UnwindSafe for FidoDevice
Blanket Implementations§
source§impl<T> AsRawDescriptors for Twhere
    T: AsRawDescriptor,
 
impl<T> AsRawDescriptors for Twhere
    T: AsRawDescriptor,
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
§impl<T> Downcast for Twhere
    T: Any,
 
impl<T> Downcast for Twhere
    T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
 
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
 
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
 
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
 
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.