summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NitrokeyManager.cc9
-rw-r--r--libnitrokey/NitrokeyManager.h2
-rw-r--r--unittest/test_multiple_devices.cc5
3 files changed, 7 insertions, 9 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 8825fce..8ca4698 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -105,16 +105,11 @@ using nitrokey::misc::strcpyT;
return true;
}
- std::vector<std::string> NitrokeyManager::list_devices(){
+ std::vector<DeviceInfo> NitrokeyManager::list_devices(){
std::lock_guard<std::mutex> lock(mex_dev_com_manager);
auto p = make_shared<Stick20>();
- auto device_infos = p->enumerate();
- std::vector<std::string> strings;
- strings.resize(device_infos.size());
- std::transform(device_infos.begin(), device_infos.end(), strings.begin(),
- [](auto device_info) { return device_info.m_path; });
- return strings;
+ return p->enumerate();
}
std::vector<std::string> NitrokeyManager::list_devices_by_cpuID(){
diff --git a/libnitrokey/NitrokeyManager.h b/libnitrokey/NitrokeyManager.h
index d6e5df4..6908143 100644
--- a/libnitrokey/NitrokeyManager.h
+++ b/libnitrokey/NitrokeyManager.h
@@ -80,7 +80,7 @@ char * strndup(const char* str, size_t maxlen);
bool get_time(uint64_t time = 0);
bool erase_totp_slot(uint8_t slot_number, const char *temporary_password);
bool erase_hotp_slot(uint8_t slot_number, const char *temporary_password);
- std::vector<std::string> list_devices();
+ std::vector<DeviceInfo> list_devices();
std::vector<std::string> list_devices_by_cpuID();
/**
diff --git a/unittest/test_multiple_devices.cc b/unittest/test_multiple_devices.cc
index b224653..f9e9ad2 100644
--- a/unittest/test_multiple_devices.cc
+++ b/unittest/test_multiple_devices.cc
@@ -90,7 +90,10 @@ TEST_CASE("Use API", "[BASIC]") {
REQUIRE(v.size() > 0);
for (int i=0; i<10; i++){
- for (auto a : v) {
+ for (auto i : v) {
+ if (i.m_deviceModel != DeviceModel::STORAGE)
+ continue;
+ auto a = i.m_path;
std::cout <<"Connect with: " << a <<
" " << std::boolalpha << nm->connect_with_path(a) << " ";
try{