diff options
author | xiphon <xiphon@protonmail.com> | 2018-10-18 03:33:42 +0000 |
---|---|---|
committer | xiphon <xiphon@protonmail.com> | 2018-10-18 17:53:06 +0300 |
commit | 25d327e796e60b2dceab4aeab26fbc4edf7a5537 (patch) | |
tree | d9f617cabd64b5bc35573c205b100f6695b02baf /src/device/device_io_hid.hpp | |
parent | device: fixed Ledger Nano S device selection (diff) | |
download | monero-25d327e796e60b2dceab4aeab26fbc4edf7a5537.tar.xz |
device: extended logging, refactored device selection code
Diffstat (limited to '')
-rw-r--r-- | src/device/device_io_hid.hpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/device/device_io_hid.hpp b/src/device/device_io_hid.hpp index ffd3f534f..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" @@ -54,7 +55,6 @@ namespace hw { unsigned int pid; int interface_number; unsigned short usage_page; - bool interface_OR_page ; }; @@ -82,13 +82,11 @@ 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; - static const unsigned int OR_SELECT = 1; - static const unsigned int AND_SELECT = 2; - static const unsigned short DEFAULT_CHANNEL = 0x0001; static const unsigned char DEFAULT_TAG = 0x01; static const unsigned int DEFAULT_PACKET_SIZE = 64; @@ -100,7 +98,7 @@ namespace hw { void init(); void connect(void *params); - void connect(unsigned int vid, unsigned int pid, int interface_number, unsigned short 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(); |