aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-08-17 13:39:56 +0200
committerDaniel Mueller <deso@posteo.net>2017-08-17 13:39:56 +0200
commit8d4a7d0ec9c3a82c7546482875be80827e2be57a (patch)
tree9ba73c2f1557fb74b9f507d37be898bae9c86749
parentac29709a644682c61a5a28d2a23f8887174fcc31 (diff)
downloadnitrocli-8d4a7d0ec9c3a82c7546482875be80827e2be57a.tar.gz
nitrocli-8d4a7d0ec9c3a82c7546482875be80827e2be57a.tar.bz2
Fix display of firmware version
The nitrokey-storage-firmware package defines an array of four byte values to hold information about the firmware version. libnitrokey uses a similar definition but overlays it with some more semantically meaningful information by putting it into a union: union { uint8_t VersionInfo_au8[4]; struct { uint8_t __unused; uint8_t major; uint8_t __unused2; uint8_t minor; } versionInfo; }; In order to derive the firmware version representation for nitrocli we used the same major/minor version definition as libnitrokey. This definition, however, is wrong or at least not in line with how the firmware is versioned officially. This change reworks the way we interpret the version information reported by the Nitrokey Storage device. Like the firmware, we treat the first byte as the major version and the second one as the minor version. The remaining two bytes seem to represent the build number and an internal version according to usage of those fields in nitrokey-storage-firmware but we ignore both to keep the reported string similar to that of the nitrokey-app.
-rw-r--r--nitrocli/README.md2
-rw-r--r--nitrocli/src/nitrokey.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/nitrocli/README.md b/nitrocli/README.md
index 2817691..4e41c80 100644
--- a/nitrocli/README.md
+++ b/nitrocli/README.md
@@ -23,7 +23,7 @@ $ nitrocli open
$ nitrocli status
Status:
SD card ID: 0xdeadbeef
- firmware version: 44.0
+ firmware version: 0.44
firmware: unlocked
storage keys: created
user retry count: 3
diff --git a/nitrocli/src/nitrokey.rs b/nitrocli/src/nitrokey.rs
index 00a681c..2691c01 100644
--- a/nitrocli/src/nitrokey.rs
+++ b/nitrocli/src/nitrokey.rs
@@ -292,10 +292,10 @@ pub struct DeviceStatusResponse {
pub magic: u16,
pub unencrypted_volume_read_only: u8,
pub encrypted_volume_read_only: u8,
- pub padding1: u8,
pub version_major: u8,
- pub padding2: u8,
pub version_minor: u8,
+ pub version_build: u8,
+ pub version_internal: u8,
pub hidden_volume_read_only: u8,
pub firmware_locked: u8,
pub new_sdcard_found: u8,