bump async-hwi for hw serial connection fix

This commit is contained in:
edouardparis 2024-06-21 16:31:41 +02:00
parent 67d835a7b3
commit 5a31324358
3 changed files with 45 additions and 30 deletions

4
gui/Cargo.lock generated
View File

@ -199,9 +199,9 @@ dependencies = [
[[package]]
name = "async-hwi"
version = "0.0.18"
version = "0.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9db4e95bcb10d14662ffcf56bc33330f47947677e5834a7edaa5ec8520562b36"
checksum = "a278b99ded5aa103de53c13496b0fd9266f2218ec7a37c8f7083285bba567fa7"
dependencies = [
"async-trait",
"bitbox-api",

View File

@ -15,7 +15,7 @@ path = "src/main.rs"
[dependencies]
async-trait = "0.1"
async-hwi = "0.0.18"
async-hwi = { version = "0.0.21" }
liana = { git = "https://github.com/wizardsardine/liana", branch = "master", default-features = false, features = ["nonblocking_shutdown"] }
liana_ui = { path = "ui" }
backtrace = "0.3"

View File

@ -414,20 +414,30 @@ async fn refresh(mut state: State) -> (HardwareWalletMessage, State) {
if state.connected_supported_hws.contains(&id) {
still.push(id);
} else {
let device = specter::Specter::<specter::SerialTransport>::new(port.clone());
if tokio::time::timeout(
std::time::Duration::from_millis(500),
device.fingerprint(),
)
.await
.is_ok()
{
match HardwareWallet::new(id, Arc::new(device), Some(&state.keys_aliases))
match specter::Specter::<specter::SerialTransport>::new(port.clone()) {
Err(e) => {
warn!("{}", e);
}
Ok(device) => {
if tokio::time::timeout(
std::time::Duration::from_millis(500),
device.fingerprint(),
)
.await
{
Ok(hw) => hws.push(hw),
Err(e) => {
debug!("{}", e);
.is_ok()
{
match HardwareWallet::new(
id,
Arc::new(device),
Some(&state.keys_aliases),
)
.await
{
Ok(hw) => hws.push(hw),
Err(e) => {
debug!("{}", e);
}
}
}
}
}
@ -444,23 +454,28 @@ async fn refresh(mut state: State) -> (HardwareWalletMessage, State) {
if state.connected_supported_hws.contains(&id) {
still.push(id);
} else {
let device =
Jade::new(jade::SerialTransport::new(port)).with_network(state.network);
match handle_jade_device(
id,
state.network,
device,
state.wallet.as_ref().map(|w| w.as_ref()),
Some(&state.keys_aliases),
)
.await
{
Ok(hw) => {
hws.push(hw);
}
match jade::SerialTransport::new(port) {
Err(e) => {
warn!("{:?}", e);
}
Ok(device) => {
match handle_jade_device(
id,
state.network,
Jade::new(device).with_network(state.network),
state.wallet.as_ref().map(|w| w.as_ref()),
Some(&state.keys_aliases),
)
.await
{
Ok(hw) => {
hws.push(hw);
}
Err(e) => {
warn!("{:?}", e);
}
}
}
}
}
}