aboutsummaryrefslogtreecommitdiff
path: root/include/device_proto.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-28 14:36:59 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:58 +0200
commitdebee8aa477fbec7c1c23d5dec565de11241f814 (patch)
tree4e95f150e8936f09c941792c226b625da20f7fcb /include/device_proto.h
parent349b7b65583ec2366511823b0c0f3bac3c23d642 (diff)
downloadlibnitrokey-debee8aa477fbec7c1c23d5dec565de11241f814.tar.gz
libnitrokey-debee8aa477fbec7c1c23d5dec565de11241f814.tar.bz2
Use int instead of CommError
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/device_proto.h')
-rw-r--r--include/device_proto.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/device_proto.h b/include/device_proto.h
index 2bbb38a..c248b10 100644
--- a/include/device_proto.h
+++ b/include/device_proto.h
@@ -168,7 +168,7 @@ class Transaction : semantics::non_constructible {
Log::instance()(__PRETTY_FUNCTION__, Loglevel::DEBUG_L2);
- CommError status;
+ int status;
OutgoingPacket outp;
ResponsePacket resp;
@@ -185,7 +185,7 @@ class Transaction : semantics::non_constructible {
if (!outp.isValid()) throw std::runtime_error("Invalid outgoing packet");
status = dev.send(&outp);
- if ((int)(status) < 0 && status != CommError::ERR_NO_ERROR)
+ if (status <= 0)
throw std::runtime_error(
std::string("Device error while sending command ") +
std::to_string((int)(status)));
@@ -204,10 +204,10 @@ class Transaction : semantics::non_constructible {
std::this_thread::sleep_for(dev.get_retry_timeout());
continue;
}
- if ((int)(status) < 0 && status != CommError::ERR_NO_ERROR)
+ if (status <= 0)
throw std::runtime_error(
std::string("Device error while executing command ") +
- std::to_string((int)(status)));
+ std::to_string(status));
Log::instance()("Incoming HID packet:", Loglevel::DEBUG);
Log::instance()((std::string)(resp), Loglevel::DEBUG);