From ac7c16d5f90f329a02b35b90f671823df360c2de Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 13 Mar 2017 19:15:18 +0100 Subject: Never call hid exit on OSX Signed-off-by: Szczepan Zalega --- device.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/device.cc b/device.cc index 66877da..4cb492d 100644 --- a/device.cc +++ b/device.cc @@ -49,10 +49,12 @@ bool Device::_disconnect() { hid_close(mp_devhandle); mp_devhandle = nullptr; +#ifndef __APPLE__ if (instances_count == 1){ LOG(std::string("Calling hid_exit"), Loglevel::DEBUG_L2); hid_exit(); } +#endif return true; } @@ -204,4 +206,4 @@ std::string Device::ErrorCounters::get_as_string() { p(receiving_error); return ss.str(); } -#undef p \ No newline at end of file +#undef p -- cgit v1.2.3 From cbf6cbbfcb4e8b8273b8ca551b687ffd9e7378f7 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 13 Mar 2017 20:04:14 +0100 Subject: Use hidapi patched for mac Signed-off-by: Szczepan Zalega --- hidapi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hidapi b/hidapi index 69c45b0..b24dd9c 160000 --- a/hidapi +++ b/hidapi @@ -1 +1 @@ -Subproject commit 69c45b083821037667a9409b952282f9cb4dcca2 +Subproject commit b24dd9c36c4aacfd5ba7b1f0277d98bbbee43f1b -- cgit v1.2.3 From 4c0409c5a2d5abeafb8b115876791ab74440c577 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 14 Mar 2017 17:51:45 +0100 Subject: Do not link hidapi under OSX Signed-off-by: Szczepan Zalega --- CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46405a9..1dcffb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,10 @@ set(SOURCE_FILES NK_C_API.cc DeviceCommunicationExceptions.cpp) -IF(UNIX) +IF(APPLE) + #include_directories(hidapi/hidapi) + #add_library(hidapi-libusb STATIC hidapi/mac/hid.c ) +ELSEIF(UNIX) # add_library(hidapi-libusb STATIC hidapi/libusb/hid.c ) ELSEIF(WIN32) include_directories(hidapi/hidapi) @@ -80,8 +83,11 @@ ELSE() add_library(nitrokey-static-log STATIC ${SOURCE_FILES}) SET(LIBNAME nitrokey-static) ENDIF() -target_link_libraries(${LIBNAME} hidapi-libusb) -target_link_libraries(${LIBNAME}-log hidapi-libusb) + +IF(NOT APPLE) + target_link_libraries(${LIBNAME} hidapi-libusb) + target_link_libraries(${LIBNAME}-log hidapi-libusb) +ENDIF() SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG") @@ -124,4 +130,4 @@ include (InstallRequiredSystemLibraries) set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") -include (CPack) \ No newline at end of file +include (CPack) -- cgit v1.2.3 From dc63e51bd6bf71559829f61030b94c1bfdbf4401 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 14 Mar 2017 20:45:16 +0100 Subject: Add function comment Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 140d4d3..12f4671 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -15,6 +15,13 @@ namespace nitrokey{ std::mutex mex_dev_com; + /** + * Copies string from pointer to fixed size C-style array. Src needs to be a valid C-string - eg. ended with '\0'. + * Throws when source is bigger than destination. + * @tparam T type of destination array + * @param dest fixed size destination array + * @param src pointer to source c-style valid string + */ template void strcpyT(T& dest, const char* src){ -- cgit v1.2.3