Implemented auto port detection
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -216,7 +216,17 @@ fn main() {
|
||||
|
||||
let start = SystemTime::now();
|
||||
|
||||
let mut target = PhysicalTarget::init(args.port, if args.slow { 57600 } else { 312500 }).unwrap();
|
||||
let port = args.port.or_else(|| {
|
||||
for port in serial_enumerator::get_serial_list() {
|
||||
if let Some(vendor) = port.vendor && vendor.as_str() == "TUL" {
|
||||
return Some(port.name.into())
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}).unwrap();
|
||||
|
||||
let mut target = PhysicalTarget::init(port, if args.slow { 57600 } else { 312500 }).unwrap();
|
||||
|
||||
let res = match args.command {
|
||||
ArgCommand::Read(args) => read_chip(args, &mut target),
|
||||
|
Reference in New Issue
Block a user