20 const std::vector<uint8_t>&
data,
21 int timeout_ms = 5000,
22 bool require_response =
true) = 0;
34 const std::vector<uint8_t>&
data,
38 auto intfs = _device->get_interfaces();
39 auto it = std::find_if(intfs.begin(), intfs.end(),
41 if (
it == intfs.end())
42 throw std::runtime_error(
"can't find VENDOR_SPECIFIC interface of device: " + _device->get_info().id);
46 std::vector<uint8_t> output;
47 if (
const auto&
m = _device->open(hwm->get_number()))
53 throw std::runtime_error(
"command transfer failed to execute bulk transfer, error: " +
usb_status_to_string.at(sts));
55 output.resize(DEFAULT_BUFFER_SIZE);
59 throw std::runtime_error(
"command transfer failed to execute bulk transfer, error: " +
usb_status_to_string.at(sts));
61 output.resize(transfered_count);
66 s <<
"access failed for " << std::hex << _device->get_info().vid <<
":" 67 <<_device->get_info().pid <<
" uid: " << _device->get_info().id << std::dec;
68 throw std::runtime_error(s.str().c_str());
76 static const uint32_t DEFAULT_BUFFER_SIZE = 1024;