aboutsummaryrefslogtreecommitdiff
path: root/src/device/device_io_hid.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/device/device_io_hid.hpp')
-rw-r--r--src/device/device_io_hid.hpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/device/device_io_hid.hpp b/src/device/device_io_hid.hpp
index 560208c77..bb0f0a814 100644
--- a/src/device/device_io_hid.hpp
+++ b/src/device/device_io_hid.hpp
@@ -29,6 +29,7 @@
#if defined(HAVE_HIDAPI)
+#include <boost/optional/optional.hpp>
#include <hidapi/hidapi.h>
#include "device_io.hpp"
@@ -52,9 +53,8 @@ namespace hw {
struct hid_conn_params {
unsigned int vid;
unsigned int pid;
- unsigned int interface_number;
- unsigned int usage_page;
- bool interface_OR_page ;
+ int interface_number;
+ unsigned short usage_page;
};
@@ -82,17 +82,15 @@ namespace hw {
unsigned int wrapCommand(const unsigned char *command, size_t command_len, unsigned char *out, size_t out_len);
unsigned int unwrapReponse(const unsigned char *data, size_t data_len, unsigned char *out, size_t out_len);
+ hid_device_info *find_device(hid_device_info *devices_list, boost::optional<int> interface_number, boost::optional<unsigned short> usage_page);
public:
bool hid_verbose = false;
- const unsigned int OR_SELECT = 1;
- const unsigned int AND_SELECT = 2;
-
- const unsigned char DEFAULT_CHANNEL = 0x0001;
- const unsigned char DEFAULT_TAG = 0x01;
- const unsigned int DEFAULT_PACKET_SIZE = 64;
- const unsigned int DEFAULT_TIMEOUT = 120000;
+ static const unsigned short DEFAULT_CHANNEL = 0x0001;
+ static const unsigned char DEFAULT_TAG = 0x01;
+ static const unsigned int DEFAULT_PACKET_SIZE = 64;
+ static const unsigned int DEFAULT_TIMEOUT = 120000;
device_io_hid(unsigned short channel, unsigned char tag, unsigned int packet_zize, unsigned int timeout);
device_io_hid();
@@ -100,7 +98,7 @@ namespace hw {
void init();
void connect(void *params);
- void connect(unsigned int vid, unsigned int pid, unsigned int interface_number, unsigned int usage_page, bool interface_OR_page );
+ void connect(unsigned int vid, unsigned int pid, boost::optional<int> interface_number, boost::optional<unsigned short> usage_page);
bool connected() const;
int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len);
void disconnect();