MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / setConfiguration

Method setConfiguration

src/usb_control.cpp:195–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
195UsbControl::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_, &current_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
217UsbControl::ResultCode UsbControl::claimInterfaces()
218{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected