-
Notifications
You must be signed in to change notification settings - Fork 23
Description
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:
Libusbpp/src/InterfaceImpl.cpp
Line 424 in 389ceea
| m_EndpointContainer.insert(std::make_pair(pEndpoint->Number(), pEndpoint)); |
The map key being generated by Endpoint::Number, which is implemented like so:
Line 57 in 389ceea
| 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.)