2020-06-09 09:52:27 +00:00
|
|
|
use std::error::Error;
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
for dev in rusb::devices()?.iter() {
|
|
|
|
let desc = dev.device_descriptor()?;
|
|
|
|
let suffix = match (desc.vendor_id(), desc.product_id()) {
|
|
|
|
(0x1366, 0x1015) => " <- J-Link on the nRF52840 Development Kit",
|
|
|
|
(0x1915, 0x521f) => " <- nRF52840 Dongle (in bootloader mode)",
|
2020-07-13 14:27:13 +00:00
|
|
|
(0x2020, pids::LOOPBACK) => " <- nRF52840 Dongle (loopback.hex)",
|
|
|
|
(0x2020, pids::PUZZLE) => " <- nRF52840 Dongle (puzzle.hex)",
|
2020-06-16 08:16:25 +00:00
|
|
|
(consts::VID, consts::PID) => " <- nRF52840 on the nRF52840 Development Kit",
|
2020-06-09 09:52:27 +00:00
|
|
|
_ => "",
|
|
|
|
};
|
|
|
|
|
|
|
|
println!("{:?}{}", dev, suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|