#[cfg(feature = "bitbox")]
pub mod bitbox;
#[cfg(feature = "coldcard")]
pub mod coldcard;
#[cfg(feature = "jade")]
pub mod jade;
#[cfg(feature = "ledger")]
pub mod ledger;
#[cfg(feature = "specter")]
pub mod specter;
#[cfg(any(feature = "trezor", feature = "keepkey"))]
pub mod trezor;
use async_trait::async_trait;
pub use bhwi::device::DeviceId;
use crate::ErrorKind;
#[async_trait(?Send)]
pub trait Channel {
async fn send(&self, data: &[u8]) -> Result<usize, std::io::Error>;
async fn receive(&mut self, data: &mut [u8]) -> Result<usize, std::io::Error>;
}
pub fn io_error_kind(error: &std::io::Error) -> ErrorKind {
use std::io::ErrorKind as Io;
match error.kind() {
Io::BrokenPipe
| Io::UnexpectedEof
| Io::NotConnected
| Io::ConnectionReset
| Io::ConnectionAborted => ErrorKind::Disconnected,
_ => ErrorKind::Transport,
}
}