diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-12-06 19:56:14 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-12-06 19:56:42 +0100 |
commit | 740b85c7f935029003e205dcbb5d49842eac1ad6 (patch) | |
tree | 7cfbc8f2ea79499ee5d3beaf1770746791deed19 /NitrokeyManager.cc | |
parent | f4b1f29058f55a716cb6e4e8a4f9bf0e6c7332fe (diff) | |
download | libnitrokey-740b85c7f935029003e205dcbb5d49842eac1ad6.tar.gz libnitrokey-740b85c7f935029003e205dcbb5d49842eac1ad6.tar.bz2 |
Get major firmware version
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index b130f4f..da31c8d 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -4,6 +4,7 @@ #include "include/LibraryException.h" #include <algorithm> #include <unordered_map> +#include <stick20_commands.h> #include "include/misc.h" namespace nitrokey{ @@ -589,9 +590,24 @@ namespace nitrokey{ {DeviceModel::STORAGE, 43}, }); auto status_p = GetStatus::CommandTransaction::run(*device); + //FIXME use different function for checking storage firmware version return status_p.data().firmware_version <= m[device->get_device_model()]; } + int NitrokeyManager::get_major_firmware_version(){ + switch(device->get_device_model()){ + case DeviceModel::PRO:{ + auto status_p = GetStatus::CommandTransaction::run(*device); + return status_p.data().firmware_version; //7 or 8 + } + case DeviceModel::STORAGE:{ + auto status = stick20::GetDeviceStatus::CommandTransaction::run(*device); + return status.data().versionInfo.major; + } + } + return 0; + } + bool NitrokeyManager::is_AES_supported(const char *user_password) { auto a = get_payload<IsAESSupported>(); strcpyT(a.user_password, user_password); |