Skip to content

Commit

Permalink
Merge branch 'general-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
szszszsz committed Oct 11, 2017
2 parents d9adae4 + 1a44693 commit 91f88b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ OPTION(LIBNITROKEY_STATIC "Build libnitrokey statically" FALSE)


IF (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
IF(APPLE)
# Issues occur when build with enabled optimizations
set(CMAKE_BUILD_TYPE Debug)
ELSE()
set(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF()
ENDIF()
MESSAGE("${PROJECT_NAME}: Build type: ${CMAKE_BUILD_TYPE}")

Expand Down Expand Up @@ -118,6 +123,11 @@ IF (NO_LOG)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG")
ENDIF()

OPTION(LOG_VOLATILE_DATA "Log volatile data (debug)" OFF)
IF (LOG_VOLATILE_DATA)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "LOG_VOLATILE_DATA")
ENDIF()


file(GLOB LIB_INCLUDES "include/*.h")
install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libnitrokey)
Expand Down
12 changes: 7 additions & 5 deletions include/device_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,14 @@ namespace nitrokey {
}

LOG(std::string("<= ") +
std::string(
commandid_to_string(static_cast<CommandID>(resp.command_id))
+ std::string(" ")
+ std::to_string(resp.storage_status.device_status)
std::string(
commandid_to_string(static_cast<CommandID>(resp.command_id))
+ std::string(" ")
+ std::to_string(resp.device_status)
+ std::string(" ")
+ std::to_string(resp.storage_status.device_status)
// + std::to_string( status_translate_command(resp.storage_status.device_status))
), Loglevel::DEBUG_L1);
), Loglevel::DEBUG_L1);

LOG("Incoming HID packet:", Loglevel::DEBUG);
LOG(static_cast<std::string>(resp), Loglevel::DEBUG);
Expand Down
5 changes: 3 additions & 2 deletions unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,22 @@ def C(request):
import os, sys
path_build = os.path.join("..", "build")
paths = [
os.environ.get('LIBNK_PATH', None),
os.path.join(path_build,"libnitrokey.so"),
os.path.join(path_build,"libnitrokey.dylib"),
os.path.join(path_build,"libnitrokey.dll"),
os.path.join(path_build,"nitrokey.dll"),
]
for p in paths:
print(p)
if not p: continue
print("Trying " +p)
p = os.path.abspath(p)
if os.path.exists(p):
print("Found: "+p)
C = ffi.dlopen(p)
break
else:
print("File does not exist: " + p)
print("Trying another")
if not C:
print("No library file found")
sys.exit(1)
Expand Down

0 comments on commit 91f88b1

Please sign in to comment.