Skip to content

Conversation

@matkatz
Copy link
Contributor

@matkatz matkatz commented Apr 1, 2019

No description provided.

Copy link
Contributor

@dorodnic dorodnic left a 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)
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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()) &&
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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());
}
Copy link
Contributor

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

@dorodnic dorodnic assigned ev-mp and unassigned ev-mp Apr 1, 2019
@dorodnic dorodnic requested review from aangerma and ev-mp April 1, 2019 18:35
@dorodnic dorodnic added this to the v2.21.0 milestone Apr 2, 2019
@ev-mp ev-mp closed this May 16, 2019
@matkatz matkatz deleted the rsusb branch July 9, 2019 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants