From 434e61c231e142b6f5f8d81eb25f4ef97686d85a Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 27 Mar 2021 16:10:53 +0100 Subject: Initial commit --- examples/list.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/list.rs (limited to 'examples') diff --git a/examples/list.rs b/examples/list.rs new file mode 100644 index 0000000..ee59ceb --- /dev/null +++ b/examples/list.rs @@ -0,0 +1,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(()) +} -- cgit v1.2.3