| 193 | #define WRITE_LIBUSB_ERROR(__RESULT) libusb_error_name(__RESULT) << " " << libusb_strerror((libusb_error)__RESULT) << ". Try debugging with environment variable: export LIBUSB_DEBUG=3 ." |
| 194 | |
| 195 | UsbControl::ResultCode UsbControl::setConfiguration() |
| 196 | { |
| 197 | UsbControl::ResultCode code = Success; |
| 198 | int desired_config_id = 1; |
| 199 | int current_config_id = -1; |
| 200 | int r; |
| 201 | |
| 202 | r = libusb_get_configuration(handle_, ¤t_config_id); |
| 203 | CHECK_LIBUSB_RESULT(code, r) << "failed to get configuration! " << WRITE_LIBUSB_ERROR(r); |
| 204 | |
| 205 | if(code == Success) |
| 206 | { |
| 207 | if(current_config_id != desired_config_id) |
| 208 | { |
| 209 | r = libusb_set_configuration(handle_, desired_config_id); |
| 210 | CHECK_LIBUSB_RESULT(code, r) << "failed to set configuration! " << WRITE_LIBUSB_ERROR(r); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | return code; |
| 215 | } |
| 216 | |
| 217 | UsbControl::ResultCode UsbControl::claimInterfaces() |
| 218 | { |
nothing calls this directly
no outgoing calls
no test coverage detected