aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r--NK_C_API.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 56340ac..d8b8168 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -238,28 +238,23 @@ extern "C" {
}
- NK_C_API bool NK_get_device_model(enum NK_device_model *out) {
- if (out == nullptr) {
- return false;
- }
+ NK_C_API enum NK_device_model NK_get_device_model() {
auto m = NitrokeyManager::instance();
try {
auto model = m->get_connected_device_model();
switch (model) {
case DeviceModel::PRO:
- *out = NK_PRO;
- return true;
+ return NK_PRO;
case DeviceModel::STORAGE:
- *out = NK_STORAGE;
- return true;
+ return NK_STORAGE;
default:
- /* unknown device -- should not happen */
- return false;
+ /* unknown or not connected device */
+ return NK_device_model::NK_DISCONNECTED;
}
} catch (const DeviceNotConnected& e) {
- return false;
+ return NK_device_model::NK_DISCONNECTED;
}
- }
+}
void clear_string(std::string &s) {