Skip to content

Bidirectional endpoints not supported #12

Description

@mmmspatz

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.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions