| 367 | bool initialized; |
| 368 | |
| 369 | Freenect2Impl(void *usb_context) : |
| 370 | managed_usb_context_(usb_context == 0), |
| 371 | usb_context_(reinterpret_cast<libusb_context *>(usb_context)), |
| 372 | has_device_enumeration_(false), |
| 373 | initialized(false) |
| 374 | { |
| 375 | #ifdef __linux__ |
| 376 | if (libusb_get_version()->nano < 10952) |
| 377 | { |
| 378 | LOG_ERROR << "Your libusb does not support large iso buffer!"; |
| 379 | return; |
| 380 | } |
| 381 | #endif |
| 382 | |
| 383 | if(managed_usb_context_) |
| 384 | { |
| 385 | int r = libusb_init(&usb_context_); |
| 386 | if(r != 0) |
| 387 | { |
| 388 | LOG_ERROR << "failed to create usb context: " << WRITE_LIBUSB_ERROR(r); |
| 389 | return; |
| 390 | } |
| 391 | |
| 392 | #if defined(_WIN32) || defined (__WIN32__) || defined(__WINDOWS__) |
| 393 | (void)libusb_set_option(usb_context_, LIBUSB_OPTION_USE_USBDK); |
| 394 | #endif |
| 395 | } |
| 396 | |
| 397 | usb_event_loop_.start(usb_context_); |
| 398 | initialized = true; |
| 399 | } |
| 400 | |
| 401 | ~Freenect2Impl() |
| 402 | { |