From 4c6929ebb96b01312c129777940f69edda70cc98 Mon Sep 17 00:00:00 2001 From: ryan kurte Date: Fri, 11 Sep 2026 08:52:33 +1200 Subject: [PATCH 1/2] chore: downgrade some noisy log lines from debug to trace also adds a note about status bytes where you'll probably end up looking if they're not working --- lib/src/device.rs | 5 ++++- lib/src/provider/context.rs | 6 +++--- lib/src/transport/ble.rs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/src/device.rs b/lib/src/device.rs index 56e8a79..539e2b8 100644 --- a/lib/src/device.rs +++ b/lib/src/device.rs @@ -158,9 +158,12 @@ impl Device for T { } // Decode response data - status bytes + // NOTE: the `comm.tx`` vs. `comm.tx_length` distinction in io_legacy can + // result in some unexpected behaviour when trying to send status bytes. + // see: https://github.com/LedgerHQ/ledger-device-rust-sdk/issues/431 let (resp, _) = RESP::decode(&buff[..n - 2])?; - debug!("RX: {resp:?}"); + debug!("RX: {resp:02x?}"); // Return decode response Ok(resp) diff --git a/lib/src/provider/context.rs b/lib/src/provider/context.rs index 927eb2a..da454b1 100644 --- a/lib/src/provider/context.rs +++ b/lib/src/provider/context.rs @@ -5,7 +5,7 @@ use tokio::{ sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}, task::LocalSet, }; -use tracing::{debug, error, warn}; +use tracing::{debug, error, trace, warn}; use crate::{ error::Error, @@ -107,10 +107,10 @@ impl ProviderImpl { // Poll on incoming requests while let Some((req, tx)) = self.req_rx.recv().await { - debug!("LedgerProvider request: {:02x?}", req); + trace!("LedgerProvider request: {:02x?}", req); if let Some(resp) = self.handle_req(&req).await { - debug!("LedgerProvider response: {:02x?}", resp); + trace!("LedgerProvider response: {:02x?}", resp); if let Err(e) = tx.send(resp) { error!("Failed to forward response: {}", e); diff --git a/lib/src/transport/ble.rs b/lib/src/transport/ble.rs index 378f0f9..7e48fb8 100644 --- a/lib/src/transport/ble.rs +++ b/lib/src/transport/ble.rs @@ -100,7 +100,7 @@ impl BleTransport { } }; - debug!("Peripheral: {p:?} props: {properties:?}"); + trace!("Peripheral: {p:?} props: {properties:?}"); let Some(model) = properties .services From e52737e5cfce92d7daaf60aa195c90b96d49cff4 Mon Sep 17 00:00:00 2001 From: ryan kurte <120750323+ryan-sentz@users.noreply.github.com> Date: Mon, 14 Sep 2026 12:29:48 +1200 Subject: [PATCH 2/2] downgrade EmptyResponse error logging as this happens when talking to stax (and presumably other touch) devices --- lib/src/transport/usb.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/transport/usb.rs b/lib/src/transport/usb.rs index 812ecb1..2083ec9 100644 --- a/lib/src/transport/usb.rs +++ b/lib/src/transport/usb.rs @@ -257,7 +257,9 @@ impl UsbDevice { // Check read length is valid for following operations if n == 0 { - error!("Empty response"); + // NOTE: this can happen when interacting with the new touch devices in + // situations that are not -strictly- errors. + debug!("Empty response"); return Err(Error::EmptyResponse); } else if n < 7 { error!("Unexpected read length {n}");