Skip to content

Bidirectional endpoints not supported #12

@mmmspatz

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

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