5 #include "../backend.h" 11 #define HW_MONITOR_BUFFER_SIZE (1024) 31 bool read_pipe(
unsigned char*
buffer, ULONG bufferLength, PULONG lengthTransferred, LPOVERLAPPED hOvl)
const;
32 bool write_pipe(
const unsigned char*
buffer, ULONG bufferLength, PULONG lengthTransferred, LPOVERLAPPED hOvl)
const;
34 bool read_interupt_pipe(
unsigned char*
buffer, ULONG bufferLength, PULONG lengthTransferred, LPOVERLAPPED hOvl)
const;
38 void init_interface(HANDLE deviceHandle);
40 void init_winusb_pipe();
41 void query_endpoints();
42 void set_timeout_policy(
unsigned char pipeID,
unsigned long timeOutInMs)
const;
44 unsigned long _in_out_pipe_timeout_ms = 7000;
45 WINUSB_INTERFACE_HANDLE _interface_handle;
46 UCHAR _out_pipe_id = 0;
47 UCHAR _in_pipe_id = 0;
48 UCHAR _interrupt_pipe_id = 0;
61 void open(std::wstring lpDevicePath);
64 std::wstring _lp_device_path;
65 HANDLE _device_handle;
66 std::unique_ptr<usb_interface> _usb_interface;
71 static std::vector<std::wstring>
query_by_interface(
const std::string&
guid,
const std::string& vid,
const std::string& pid);
74 static bool get_device_data(_GUID
guid,
int i,
const HDEVINFO&
device_info, std::wstring& lp_device_path);
82 const std::vector<uint8_t>& data,
83 int timeout_ms = 5000,
84 bool require_response =
true)
override;
90 void write_to_pipe_and_read_response(
const std::vector<uint8_t>& input,
91 std::vector<uint8_t>& output,
92 DWORD TimeOut,
bool readResponse =
true);
94 static bool read_pipe_sync(
winusb_device* usbDevice,
unsigned char*
buffer,
int bufferLength, ULONG& lengthTransferred, DWORD TimeOut);
96 std::wstring _lp_device_path = L
"";