summaryrefslogtreecommitdiff
path: root/examples/list.rs
blob: ee59ceb56663789e5fd3ce46c68cf658a8c4142d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use nitrokey_hid::features::Basic;

fn main() -> Result<(), nitrokey_hid::Error> {
    let device = nitrokey_hid::connect()?;
    let status = device.get_status()?;
    println!(
        r#"Status:
  model:             {model:?}
  serial number:     0x{id:08x}
  firmware version:  {fwv_maj}.{fwv_min}
  user retry count:  {urc}
  admin retry count: {arc}"#,
        model = device.get_model(),
        id = status.serial_number,
        fwv_maj = status.firmware_version_major,
        fwv_min = status.firmware_version_minor,
        urc = device.get_user_retry_count()?,
        arc = device.get_admin_retry_count()?,
    );
    Ok(())
}