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

Bidirectional endpoints not supported #12

Open
mmmspatz opened this issue Dec 28, 2020 · 1 comment
Open

Bidirectional endpoints not supported #12

mmmspatz opened this issue Dec 28, 2020 · 1 comment

Comments

@mmmspatz
Copy link

mmmspatz commented Dec 28, 2020

I have a device that has two bulk endpoints with addresses 0x05 and 0x85. Libusbcpp ignores the latter completely for the following reason.

In InterfaceImpl::CreateEndpoints(), a new std::shared_ptr<Endpoint> named pEndpoint is created and then inserted into a std::map like so:

m_EndpointContainer.insert(std::make_pair(pEndpoint->Number(), pEndpoint));

The map key being generated by Endpoint::Number, which is implemented like so:

return (m_pEndpointDescriptor->bEndpointAddress & 0x0F);

Since the key omits the upper nibble of the address, it's impossible to store a pair of endpoints with opposite directions but the same endpoint number. The second insert has no effect (because the key already exits), and the newly created Endpoint is deleted.

A subsequent call to Interface::getEPNumberByIndex() throws std::logic_error(LibUSB::InterfaceImpl::getEPNumberByIndex(): Endpoint not found.)

@mmmspatz
Copy link
Author

Made a PR: #13

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

No branches or pull requests

1 participant