thegecko / webusb

Node.js implementation of the WebUSB Specification
https://thegecko.github.io/webusb/
MIT License
183 stars 27 forks source link

device.getEndpoint(endpointNumber, direction) needs updating #19

Closed monteslu closed 6 years ago

monteslu commented 6 years ago

According to : https://wicg.github.io/webusb/#endpoints The endpointNumber MUST equal the 4 least significant bits of the bEndpointAddress field of the endpoint descriptor defining the endpoint.

When the direction is in, I think we need to add 0x80 to the endpointNumber when comparing it to usbEndpoint.endpointNumber

When doing a device.getEndpoint('in', 5), the resulting comparison would be 133 instead of 5