embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

CcidHost

Struct CcidHost 

Source
pub struct CcidHost<'d, A: UsbHostAllocator<'d>> { /* private fields */ }
Expand description

Host driver for one USB CCID interface.

Implementations§

Source§

impl<'d, A: UsbHostAllocator<'d>> CcidHost<'d, A>

Source

pub fn new( alloc: &A, config_desc: &[u8], enum_info: &EnumerationInfo, ) -> Result<Self, CcidError>

Discover the CCID interface and allocate its bulk pipes.

Source

pub fn info(&self) -> &CcidInfo

Discovered interface and endpoint information.

Source

pub async fn get_slot_status( &mut self, slot: u8, ) -> Result<SlotStatus, CcidError>

Query one reader slot without changing card power or protocol state.

Source

pub async fn power_off(&mut self, slot: u8) -> Result<SlotStatus, CcidError>

Power off one ICC slot.

Source

pub async fn power_on( &mut self, slot: u8, voltage: u8, atr: &mut [u8], ) -> Result<usize, CcidError>

Activate one ICC slot and return its Answer to Reset (ATR).

voltage is the CCID bPowerSelect value; zero lets the reader choose.

Source

pub async fn transfer_block( &mut self, slot: u8, apdu: &[u8], response: &mut [u8], ) -> Result<usize, CcidError>

Exchange one ISO 7816 APDU using PC_to_RDR_XfrBlock.

Returns the APDU response length, including its trailing SW1/SW2 bytes.

Trait Implementations§

Source§

impl<'d, A: UsbHostAllocator<'d>> HostClass<'d, A> for CcidHost<'d, A>

Source§

const NAME: &'static str = "CCID"

Human-readable class name, used for logging.
Source§

type Info = CcidInfo

Cheap, owned description of the interface(s) and endpoints to use. Read more
Source§

fn probe(_enum_info: &EnumerationInfo, cfg: &[u8]) -> Option<Self::Info>

Find the class in an enumerated device. Returns None when the class is not present. This must not allocate pipes or issue control requests. Read more
Source§

async fn open( alloc: &A, cfg: &[u8], _info: Self::Info, enum_info: &EnumerationInfo, ) -> Result<Self, ClassError>

Allocate pipes and perform any class-specific setup.
Source§

fn is_present(enum_info: &EnumerationInfo, cfg: &[u8]) -> bool

Convenience wrapper around probe.

Auto Trait Implementations§

§

impl<'d, A> Forget for CcidHost<'d, A>

§

impl<'d, A> Freeze for CcidHost<'d, A>
where <A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Freeze, <A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Freeze,

§

impl<'d, A> Move for CcidHost<'d, A>

§

impl<'d, A> RefUnwindSafe for CcidHost<'d, A>

§

impl<'d, A> Send for CcidHost<'d, A>
where <A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Send, <A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Send,

§

impl<'d, A> Sync for CcidHost<'d, A>
where <A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Sync, <A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Sync,

§

impl<'d, A> Unpin for CcidHost<'d, A>
where <A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Unpin, <A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Unpin,

§

impl<'d, A> UnsafeUnpin for CcidHost<'d, A>

§

impl<'d, A> UnwindSafe for CcidHost<'d, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.