aboutsummaryrefslogtreecommitdiff
path: root/include/device_proto.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-09 18:49:24 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:45 +0100
commitadbc664125142c434294bfa795666c90c7608429 (patch)
tree15db66af5acd4422b5e66678dbe45a953b9dbdb0 /include/device_proto.h
parentc69604e8ba099b1421af86c34d904b0b380f996c (diff)
downloadlibnitrokey-adbc664125142c434294bfa795666c90c7608429.tar.gz
libnitrokey-adbc664125142c434294bfa795666c90c7608429.tar.bz2
Adjust for compilation on Visual Studio 2017
Building works however tests are not. Possibly linking with original hidapi solution would work.
Diffstat (limited to 'include/device_proto.h')
-rw-r--r--include/device_proto.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/device_proto.h b/include/device_proto.h
index cbb74fb..1e381dd 100644
--- a/include/device_proto.h
+++ b/include/device_proto.h
@@ -6,7 +6,6 @@
#include <type_traits>
#include <stdexcept>
#include <string>
-#include <strings.h>
// a local version for compatibility with Windows
#include <stdint.h>
#include "cxx_semantics.h"
@@ -34,6 +33,7 @@
#include <mutex>
#include "DeviceCommunicationExceptions.h"
+#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
namespace nitrokey {
namespace proto {
@@ -43,7 +43,7 @@ namespace nitrokey {
*
* TODO (future) support for Big Endian
*/
-
+#pragma pack (push,1)
/*
* Every packet is a USB HID report (check USB spec)
*/
@@ -181,8 +181,10 @@ namespace nitrokey {
typedef command_payload CommandPayload;
typedef response_payload ResponsePayload;
+
typedef struct HIDReport<cmd_id, CommandPayload> OutgoingPacket;
typedef struct DeviceResponse<cmd_id, ResponsePayload> ResponsePacket;
+#pragma pack (pop)
static_assert(std::is_pod<OutgoingPacket>::value,
"outgoingpacket must be a pod type");
@@ -216,7 +218,7 @@ namespace nitrokey {
static std::mutex send_receive_mtx;
std::lock_guard<std::mutex> guard(send_receive_mtx);
- Log::instance()(__PRETTY_FUNCTION__, Loglevel::DEBUG_L2);
+ Log::instance()(__FUNCTION__, Loglevel::DEBUG_L2);
if (dev == nullptr){
throw DeviceNotConnected("Device not initialized");