ctaphid 0.3.1

Rust implementation of the CTAPHID protocol
Documentation
// Copyright (C) 2021-2022 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: CC0-1.0

//! Executes the wink command on all CTAPHID devices.

fn main() -> Result<(), Box<dyn std::error::Error>> {
    env_logger::init();

    let hidapi = hidapi::HidApi::new()?;
    let devices = hidapi
        .device_list()
        .filter(|device| ctaphid::is_known_device(*device));
    for device_info in devices {
        let device = device_info.open_device(&hidapi)?;
        let device = ctaphid::Device::new(device, device_info.to_owned())?;
        device.wink()?;
    }
    Ok(())
}