aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-04-19 17:04:22 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2018-04-19 17:04:22 +0200
commitd68e702014b9a4e548950f6090ee0a403908459c (patch)
treed54c89ea96047d3c1a77147b37298417a207efe5
parent9d4911d02e9e87ebd3b2a36acce4a347a58e9fff (diff)
downloadlibnitrokey-d68e702014b9a4e548950f6090ee0a403908459c.tar.gz
libnitrokey-d68e702014b9a4e548950f6090ee0a403908459c.tar.bz2
WIP Use volatilewip-use_volatile
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--device.cc6
-rw-r--r--libnitrokey/device.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/device.cc b/device.cc
index da54e33..81f8623 100644
--- a/device.cc
+++ b/device.cc
@@ -107,7 +107,7 @@ void Device::set_path(const std::string path){
m_path = path;
}
-int Device::send(const void *packet) {
+int Device::send(volatile void *packet) {
LOG(__FUNCTION__, Loglevel::DEBUG_L2);
std::lock_guard<std::mutex> lock(mex_dev_com);
LOG(std::string(__FUNCTION__) + std::string(" *IN* "), Loglevel::DEBUG_L2);
@@ -128,7 +128,7 @@ int Device::send(const void *packet) {
return send_feature_report;
}
-int Device::recv(void *packet) {
+int Device::recv(volatile void *packet) {
LOG(__FUNCTION__, Loglevel::DEBUG_L2);
std::lock_guard<std::mutex> lock(mex_dev_com);
LOG(std::string(__FUNCTION__) + std::string(" *IN* "), Loglevel::DEBUG_L2);
@@ -141,7 +141,7 @@ int Device::recv(void *packet) {
throw DeviceNotConnected("Attempted HID receive on an invalid descriptor.");
}
- status = (hid_get_feature_report(mp_devhandle, (unsigned char *)(packet),
+ status = (hid_get_feature_report(mp_devhandle, (volatile unsigned char *)(packet),
HID_REPORT_SIZE));
auto pwherr = hid_error(mp_devhandle);
diff --git a/libnitrokey/device.h b/libnitrokey/device.h
index f6d2380..329fd7e 100644
--- a/libnitrokey/device.h
+++ b/libnitrokey/device.h
@@ -92,13 +92,13 @@ public:
/*
* Sends packet of HID_REPORT_SIZE.
*/
- virtual int send(const void *packet);
+ virtual int send(volatile void *packet);
/*
* Gets packet of HID_REPORT_SIZE.
* Can sleep. See below.
*/
- virtual int recv(void *packet);
+ virtual int recv(volatile void *packet);
/***
* Returns true if some device is visible by OS with given VID and PID