summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/list.rs21
1 files changed, 21 insertions, 0 deletions
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(())
+}