Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ impl<T: Exchange + Send> 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)
Expand Down
6 changes: 3 additions & 3 deletions lib/src/provider/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/transport/ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl BleTransport {
}
};

debug!("Peripheral: {p:?} props: {properties:?}");
trace!("Peripheral: {p:?} props: {properties:?}");

let Some(model) = properties
.services
Expand Down
4 changes: 3 additions & 1 deletion lib/src/transport/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
Expand Down