feat: add tracing
This commit is contained in:
parent
160b4f834b
commit
692133c36b
@ -2,6 +2,7 @@ use std::{sync::Arc, time::Duration};
|
|||||||
|
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use rusb::UsbContext;
|
use rusb::UsbContext;
|
||||||
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ pub fn read(vid: u16, pid: u16, tx: &Sender<Arc<str>>) -> Result<(), Error> {
|
|||||||
|
|
||||||
let mut buf = [0; 128];
|
let mut buf = [0; 128];
|
||||||
let mut last_scan = std::time::Instant::now();
|
let mut last_scan = std::time::Instant::now();
|
||||||
|
debug!("Card reader ready");
|
||||||
loop {
|
loop {
|
||||||
match handle.read_interrupt(0x81, &mut buf, Duration::from_secs(1)) {
|
match handle.read_interrupt(0x81, &mut buf, Duration::from_secs(1)) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
@ -62,7 +64,7 @@ pub fn read(vid: u16, pid: u16, tx: &Sender<Arc<str>>) -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(rusb::Error::Timeout) => (),
|
Err(rusb::Error::Timeout) => (),
|
||||||
Err(e) => eprintln!("Error: {e}"),
|
Err(e) => error!("Error: {e}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user