Skip to content
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

UVC device power #13082

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from
Draft

Conversation

OhadMeir
Copy link
Contributor

DRAFT ONLY, to share the code we have discussed during our meeting

auto & dev = environment::get_instance().get_uvc_device( info.unique_id );
if( ! dev )
{
dev = get_backend()->create_uvc_device( info );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually does a set...
I.e., the next line means nothing.
But this is also dangerous if multiple threads are in this same loop.

return _device_info_uid_to_uvc_device[uvc_device_info_uid];
}

void set_uvc_device( const std::string & uvc_device_info_uid, std::shared_ptr< platform::uvc_device > & device )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK but the device is NEVER removed! I don't think that's what we want.
We want it to be removed when the last reference to it is gone.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that not only is it never removed but if we have new info with the same ID then we'll use the old one. I don't know if this will ever happen - but it'd be worth checking.

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.

2 participants