// Copyright (C) 2021-2022 Robin Krahl // SPDX-License-Identifier: CC0-1.0 //! Lists all available CTAPHID devices and tries to ping them. fn main() -> Result<(), Box> { env_logger::init(); let hidapi = hidapi::HidApi::new()?; let devices: Vec<_> = hidapi .device_list() .filter(|device| ctaphid::is_known_device(*device)) .collect(); println!("Found {} CTAPHID devices", devices.len()); for device_info in devices { let device = device_info.open_device(&hidapi)?; let device = ctaphid::Device::new(device, device_info.to_owned())?; println!("- {}: {:x?}", device_info.path().to_string_lossy(), device); device.ping(&[0xaa; 256])?; } Ok(()) }