Skip to content

Commit 91f88b1

Browse files
committed
Merge branch 'general-fixes'
2 parents d9adae4 + 1a44693 commit 91f88b1

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" FALSE)
4343

4444

4545
IF (NOT CMAKE_BUILD_TYPE)
46-
set(CMAKE_BUILD_TYPE RelWithDebInfo)
46+
IF(APPLE)
47+
# Issues occur when build with enabled optimizations
48+
set(CMAKE_BUILD_TYPE Debug)
49+
ELSE()
50+
set(CMAKE_BUILD_TYPE RelWithDebInfo)
51+
ENDIF()
4752
ENDIF()
4853
MESSAGE("${PROJECT_NAME}: Build type: ${CMAKE_BUILD_TYPE}")
4954

@@ -118,6 +123,11 @@ IF (NO_LOG)
118123
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG")
119124
ENDIF()
120125

126+
OPTION(LOG_VOLATILE_DATA "Log volatile data (debug)" OFF)
127+
IF (LOG_VOLATILE_DATA)
128+
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "LOG_VOLATILE_DATA")
129+
ENDIF()
130+
121131

122132
file(GLOB LIB_INCLUDES "include/*.h")
123133
install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libnitrokey)

include/device_proto.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,14 @@ namespace nitrokey {
393393
}
394394

395395
LOG(std::string("<= ") +
396-
std::string(
397-
commandid_to_string(static_cast<CommandID>(resp.command_id))
398-
+ std::string(" ")
399-
+ std::to_string(resp.storage_status.device_status)
396+
std::string(
397+
commandid_to_string(static_cast<CommandID>(resp.command_id))
398+
+ std::string(" ")
399+
+ std::to_string(resp.device_status)
400+
+ std::string(" ")
401+
+ std::to_string(resp.storage_status.device_status)
400402
// + std::to_string( status_translate_command(resp.storage_status.device_status))
401-
), Loglevel::DEBUG_L1);
403+
), Loglevel::DEBUG_L1);
402404

403405
LOG("Incoming HID packet:", Loglevel::DEBUG);
404406
LOG(static_cast<std::string>(resp), Loglevel::DEBUG);

unittest/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,22 @@ def C(request):
3636
import os, sys
3737
path_build = os.path.join("..", "build")
3838
paths = [
39+
os.environ.get('LIBNK_PATH', None),
3940
os.path.join(path_build,"libnitrokey.so"),
4041
os.path.join(path_build,"libnitrokey.dylib"),
4142
os.path.join(path_build,"libnitrokey.dll"),
4243
os.path.join(path_build,"nitrokey.dll"),
4344
]
4445
for p in paths:
45-
print(p)
46+
if not p: continue
47+
print("Trying " +p)
4648
p = os.path.abspath(p)
4749
if os.path.exists(p):
4850
print("Found: "+p)
4951
C = ffi.dlopen(p)
5052
break
5153
else:
5254
print("File does not exist: " + p)
53-
print("Trying another")
5455
if not C:
5556
print("No library file found")
5657
sys.exit(1)

0 commit comments

Comments
 (0)