Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
add target in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Feb 14, 2018
1 parent 4d073b8 commit 3317ba3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions hw/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,20 +372,20 @@ impl EventHandler {
impl libusb::Hotplug for EventHandler {
fn device_arrived(&mut self, device: libusb::Device) {
if let (Some(ledger), Ok(_)) = (self.ledger.upgrade(), Manager::is_valid_ledger(&device)) {
debug!("Ledger arrived");
debug!(target: "hw", "Ledger arrived");
// Wait for the device to boot up
thread::sleep(Duration::from_millis(1000));
if let Err(e) = ledger.update_devices() {
debug!("Ledger connect error: {:?}", e);
debug!(target: "hw", "Ledger connect error: {:?}", e);
}
}
}

fn device_left(&mut self, device: libusb::Device) {
if let (Some(ledger), Ok(_)) = (self.ledger.upgrade(), Manager::is_valid_ledger(&device)) {
debug!("Ledger left");
debug!(target: "hw", "Ledger left");
if let Err(e) = ledger.update_devices() {
debug!("Ledger disconnect error: {:?}", e);
debug!(target: "hw", "Ledger disconnect error: {:?}", e);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions hw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,12 @@ impl HardwareWalletManager {
.name("hw_wallet_ledger".to_string())
.spawn(move || {
if let Err(e) = l.update_devices() {
debug!("Ledger could not connect at startup, error: {}", e);
debug!(target: "hw", "Ledger couldn't connect at startup, error: {}", e);
//debug!("Ledger could not connect at startup, error: {}", e);
}
loop {
usb_context_ledger.handle_events(Some(Duration::from_millis(500)))
.unwrap_or_else(|e| debug!("Ledger event handler error: {}", e));
.unwrap_or_else(|e| debug!(target: "hw", "Ledger event handler error: {}", e));
if thread_exiting_ledger.load(atomic::Ordering::Acquire) {
break;
}
Expand All @@ -190,11 +191,11 @@ impl HardwareWalletManager {
.name("hw_wallet_trezor".to_string())
.spawn(move || {
if let Err(e) = t.update_devices() {
debug!("Trezor could not connect at startup, error: {}", e);
debug!(target: "hw", "Trezor couldn't connect at startup, error: {}", e);
}
loop {
usb_context_trezor.handle_events(Some(Duration::from_millis(500)))
.unwrap_or_else(|e| debug!("Trezor event handler error: {}", e));
.unwrap_or_else(|e| debug!(target: "hw", "Trezor event handler error: {}", e));
if thread_exiting_trezor.load(atomic::Ordering::Acquire) {
break;
}
Expand Down
8 changes: 4 additions & 4 deletions hw/src/trezor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,22 +417,22 @@ impl EventHandler {

impl libusb::Hotplug for EventHandler {
fn device_arrived(&mut self, _device: libusb::Device) {
debug!("Trezor V1 arrived");
debug!(target: "hw", "Trezor V1 arrived");
if let Some(trezor) = self.trezor.upgrade() {
// Wait for the device to boot up
thread::sleep(Duration::from_millis(1000));
if let Err(e) = trezor.update_devices() {
debug!("Trezor V1 connect error: {:?}", e);
debug!(target: "hw", "Trezor V1 connect error: {:?}", e);
}

}
}

fn device_left(&mut self, _device: libusb::Device) {
debug!("Trezor V1 left");
debug!(target: "hw", "Trezor V1 left");
if let Some(trezor) = self.trezor.upgrade() {
if let Err(e) = trezor.update_devices() {
debug!("Trezor V1 disconnect error: {:?}", e);
debug!(target: "hw", "Trezor V1 disconnect error: {:?}", e);
}
}
}
Expand Down

0 comments on commit 3317ba3

Please sign in to comment.