| 101 | } |
| 102 | |
| 103 | bool CommandTransaction::receive(CommandTransaction::Result& result, uint32_t min_length) |
| 104 | { |
| 105 | int length = 0; |
| 106 | |
| 107 | int r = libusb_bulk_transfer(handle_, inbound_endpoint_, &result[0], result.size(), &length, timeout_); |
| 108 | result.resize(length); |
| 109 | |
| 110 | if(r != LIBUSB_SUCCESS) |
| 111 | { |
| 112 | LOG_ERROR << "bulk transfer failed: " << WRITE_LIBUSB_ERROR(r); |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | if ((uint32_t)length < min_length) |
| 117 | { |
| 118 | LOG_ERROR << "bulk transfer too short! expected at least: " << min_length << " got : " << length; |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | return true; |
| 123 | } |
| 124 | |
| 125 | bool CommandTransaction::isResponseCompleteResult(CommandTransaction::Result& result, uint32_t sequence) |
| 126 | { |