summaryrefslogtreecommitdiff
path: root/device.cc
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2019-01-13 12:04:12 +0100
committerRobin Krahl <me@robin-krahl.de>2019-01-13 12:04:12 +0100
commit6c52c50d59eafa5acc7ae650695f199b7a014841 (patch)
treee76c59dde7ddf2cba0873487901bdee4a31513df /device.cc
parentd0d934e8333cffe093569b9f48a10b3500d1ff60 (diff)
downloadlibnitrokey-6c52c50d59eafa5acc7ae650695f199b7a014841.tar.gz
libnitrokey-6c52c50d59eafa5acc7ae650695f199b7a014841.tar.bz2
Add product_id_to_model function
Diffstat (limited to 'device.cc')
-rw-r--r--device.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/device.cc b/device.cc
index 74de0b3..d3f6e09 100644
--- a/device.cc
+++ b/device.cc
@@ -36,12 +36,24 @@ std::mutex mex_dev_com;
using namespace nitrokey::device;
using namespace nitrokey::log;
+using namespace nitrokey::misc;
using namespace std::chrono;
const uint16_t nitrokey::device::NITROKEY_VID = 0x20a0;
const uint16_t nitrokey::device::NITROKEY_PRO_PID = 0x4108;
const uint16_t nitrokey::device::NITROKEY_STORAGE_PID = 0x4109;
+Option<DeviceModel> nitrokey::device::product_id_to_model(uint16_t product_id) {
+ switch (product_id) {
+ case NITROKEY_PRO_PID:
+ return DeviceModel::PRO;
+ case NITROKEY_STORAGE_PID:
+ return DeviceModel::STORAGE;
+ default:
+ return {};
+ }
+}
+
std::atomic_int Device::instances_count{0};
std::chrono::milliseconds Device::default_delay {0} ;