summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index eb5ec5f..259ff89 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -498,7 +498,11 @@ pub trait Device {
///
/// # fn try_main() -> Result<(), CommandError> {
/// let device = nitrokey::connect()?;
- /// println!("Firmware version: {}.x", device.get_major_firmware_version());
+ /// println!(
+ /// "Firmware version: {}.{}",
+ /// device.get_major_firmware_version(),
+ /// device.get_minor_firmware_version(),
+ /// );
/// # Ok(())
/// # }
/// ```
@@ -506,6 +510,28 @@ pub trait Device {
unsafe { nitrokey_sys::NK_get_major_firmware_version() }
}
+ /// Returns the minor part of the firmware version (for example 8 for
+ /// version 0.8).
+ ///
+ /// # Example
+ ///
+ /// ```no_run
+ /// use nitrokey::Device;
+ /// # use nitrokey::CommandError;
+ ///
+ /// # fn try_main() -> Result<(), CommandError> {
+ /// let device = nitrokey::connect()?;
+ /// println!(
+ /// "Firmware version: {}.{}",
+ /// device.get_major_firmware_version(),
+ /// device.get_minor_firmware_version(),
+ /// );
+ /// # Ok(())
+ /// # }
+ fn get_minor_firmware_version(&self) -> i32 {
+ unsafe { nitrokey_sys::NK_get_minor_firmware_version() }
+ }
+
/// Returns the current configuration of the Nitrokey device.
///
/// # Example