- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.9k
rs usb interface api and implementations added #3639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, nothing is wrong in any major way.
Requires more review
Amazing job
|  | ||
| std::shared_ptr<device_watcher_usbhost> device_watcher_usbhost::instance() | ||
| { | ||
| if(!_instance) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not
static std::shared_ptr<device_watcher_usbhost> instance = std::make_shared<device_watcher_usbhost>();
return instance;
?
|  | ||
| void device_watcher_usbhost::notify() | ||
| { | ||
| std::lock_guard<std::mutex> lk(_mutex); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoking callback under lock, lets discuss
|  | ||
| // libusb_init(&ctx); | ||
| // count = libusb_get_device_list(ctx, &list); | ||
| libusb_init(NULL); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok to work without libusb context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, will be fixed
| auto rc = libusb_get_device_descriptor(device, &desc); | ||
| if (desc.idVendor != 0x8086) | ||
| continue; | ||
| if ((std::find(ds::rs400_sku_recovery_pid.begin(), ds::rs400_sku_recovery_pid.end(), desc.idProduct) == ds::rs400_sku_recovery_pid.end()) && | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just raise everything under 8086 + Movidious?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we may encounter non RS Intel devices
| // Copyright(c) 2015 Intel Corporation. All Rights Reserved. | ||
|  | ||
| #ifdef RS2_USE_WMF_BACKEND | ||
| #ifdef WIN32 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't compile / run on Win7 I fear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planing to remove all the backend ifdefs and handle that on cmake
| if (!WinUsb_GetDescriptor(handle, USB_CONFIGURATION_DESCRIPTOR_TYPE, 0, 0, (PUCHAR)&cfgDesc, sizeof(cfgDesc), &returnLength)) | ||
| { | ||
| LOG_ERROR("WinUsb_GetDescriptor failed - GetLastError = %d\n" << GetLastError()); | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And...?
cfgDesc.wTotalLength will be uninitialized if WinUsb_GetDescriptor fails
Need to review error handling flows in all cases
No description provided.